Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
List SelectedIndex value is incorrect
Message
From
30/08/2004 16:21:51
 
 
To
All
General information
Forum:
ASP.NET
Category:
WebForms
Title:
List SelectedIndex value is incorrect
Miscellaneous
Thread ID:
00937807
Message ID:
00937807
Views:
36
Hi,

I have a grid with two template columns set as labels/drop down lists and an Edit/Update/Cancel button. The list are both set up the same, with the exception that AutoPostBack is true for the first, but false for the second.
On Edit, the lists display correctly. Selecting a new item from the first list requeries and redisplays the data for the second list, but you can also select the second one without choosing the first.
On Update, the SelectedIndex is correct for the first, but always 0 for the second list. IOW, the selected item appears correct on the web page, but the value is always that of the first record. Why? And why does the first one work correctly?
I have tried setting AutoPostBack to true for the second list, but then the list immediately resets its display to the 0 index. Maddening. ;-0

Below is a snippet from the update code but of course, by then it is already set incorrectly. Any help would be appreciated!

Laura
Private Sub grdShowData_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles grdShowData.UpdateCommand
        Dim fx As New DataFunctions
        Dim fx2 As New DateFunctions
        With grdShowData
            Dim dgd As DataGrid = source
            Dim dgr As DataGridItem = dgd.SelectedItem
            Dim ddl As DropDownList = dgr.Cells(4).FindControl("lstPerson")
            Dim ddlx As DropDownList = dgr.Cells(5).FindControl("lstTarget")
            Dim strProfileID As String = ddl.SelectedItem.Value
            Dim strRotationID As String = dgr.Cells(2).Text
            Dim strNotifyID As String = Left(ddlx.SelectedItem.Text, 3)
            Dim strNotifyIDSeq As String = ddlx.SelectedItem.Value
Reply
Map
View

Click here to load this message in the networking platform