making datalist more rich

making datalist more rich

Post by Jeff Krisfalus » Sun, 08 Jul 2001 04:29:31



In ASP.Net the premise is that you separate logic from display info.  But
when I'm using something like a datalist, I can't figure out how to do
things dynamically, such as:

I'm returning a dataset from the database, it has an int column. If the
column is greater then 0, then I want to create an edit button control, but
only some records will have this.  So what would I want to do in ASP.Net?
In
"classic" asp, I would just check during each row as I was painting the
screen.

Thanks,
Jeff

 
 
 

1. DataList.SelectedItemTemplate using prior DataList.SelectedItemIndex

Environment Info:
Visual Studio .Net IDE:  v7.0.9466
Framework .SDK: 1.0.3705
OS:  Windows 2000 Advanced Server

I'm working on an ASP application that uses the DataList Control.  When the
Page is re-rendered after the DataList_ItemCommand Event, the
DataList.SelectedItemTemplate is rendered using the prior
DataList.SelectedItemIndex.  I'm debugging this functionality using a
TextBox Object whose "Text" property I set to the DataList.SelectedItemIndex
value within the DataList_ItemCommand.

//Below is a copy of my code for the DataList1_ItemCommand Event
Private Sub DataList1_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataListCommandEventArgs) Handles
DataList1.ItemCommand

DataList1.SelectedIndex = e.Item.ItemIndex

txtSearch.Text = DataList1.SelectedIndex

End Sub

Below is a Table of Results

Data List First Rendered:
-------------------------
SelectedItemTemplate:  Not Rendered
SelectedItemIndex:  -1

Second Item in List Selected
-----------------------------
SelectedItemTemplate:  Not Rendered
SelectedItemIndex: 1

Third Item in List Selected
--------------------------
SelectedItemTemplate:  Rendered for Secord Item
SelectedItemIndex:  2

Any ideas?

-Dylan Phillips

2. printer information

3. how to use datalist inside a datalist

4. How do I make a CD that will play a QuickTime movie

5. DataList.SelectedItemTemplate using prior DataList.SelectedItemIndex

6. virii - please send

7. DATALIST into DATALIST

8. Frontier assasinations

9. DataList in a Datalist

10. DataList in Datalist

11. Like in MS Jet and Datalist inside a Datalist

12. datalist in datalist's footer