Hey,
I've two issues currently preventing me from finishing two projects properly. I'll put them both here as I believe they're connected to the asp.net page lifecycle, but I can't find a way around them.
First I have a DropDownList which I must sort in codebehind. It only contains text, so I should be able to do that with the following method called in page load:
Dim alist As ArrayList = New ArrayList For Each litem As ListItem In ltEsittelyDropDownList.Items alist.Add(litem.Text) Next alist.Sort() Dim uusiDDList As New DropDownList For i As Integer = 0 To alist.Count - 1 Dim litem As New ListItem litem.Text = alist(i).ToString litem.Value = alist(i).ToString uusiDDList.Items.Add(litem) ' Response.Write(alist(i).ToString) Next ltEsittelyDropDownList = uusiDDList ltEsittelyDropDownList.DataBind()
As you can see, there's a commented response.write in there, which shows the list is actually sorted. So why, when I load the page, can't I see any effect?
The other problem, which is more critical and difficult, is as follows:
In the aspx page I'm binding a SQL Server 2005 datasource to a gridview. And in the code-behind I catch on to the RowDataBound event in which I handle some links and properties inside the gridviews' cells. But I cannot get this to work on the first page load, only after the first extra postback.
So, what is there to do? And thanks for all advice in front!