B
brian
Mark.
Turns out the problem was in the code below, which is part of dropdown load logic.
When I commented out the line " 'Me.ddlODGroups.DataValueField = "ID"" the problem went away. With the my dataset ID will always be 1 except for the ID that comes from the union. In this example with line not commented out when users selects value and clicks submit the seelcted value gets changed to the first item with a value of 1. When the line is commented out is works correctly.
Same is true if load/bind of control is done in pageload or page_init.
Apparently, duplicate values in the ID is a problem. Don't know if it's a bug or what.
cmd.CommandText = "Select distinct '1' as ID , substring(emWorkGroup,2,len(emWorkGroup)-1) as wGroup " & _
"from ld..tEmployeeMaster " & _
"Where emStatus = '3' and len(emWorkGroup) > 0 " & _
"union " & _
"Select '0' as ID, 'All' as wGroup " & _
"order by ID; "
Me.ddlODGroups.Items.Clear()
Me.ddlODGroups.DataSource = ds.Tables("dsGroups")
'Me.ddlODGroups.DataValueField = "ID"
Me.ddlODGroups.DataTextField = "wGroup"
Me.ddlODGroups.DataBind()
--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-
Turns out the problem was in the code below, which is part of dropdown load logic.
When I commented out the line " 'Me.ddlODGroups.DataValueField = "ID"" the problem went away. With the my dataset ID will always be 1 except for the ID that comes from the union. In this example with line not commented out when users selects value and clicks submit the seelcted value gets changed to the first item with a value of 1. When the line is commented out is works correctly.
Same is true if load/bind of control is done in pageload or page_init.
Apparently, duplicate values in the ID is a problem. Don't know if it's a bug or what.
cmd.CommandText = "Select distinct '1' as ID , substring(emWorkGroup,2,len(emWorkGroup)-1) as wGroup " & _
"from ld..tEmployeeMaster " & _
"Where emStatus = '3' and len(emWorkGroup) > 0 " & _
"union " & _
"Select '0' as ID, 'All' as wGroup " & _
"order by ID; "
Me.ddlODGroups.Items.Clear()
Me.ddlODGroups.DataSource = ds.Tables("dsGroups")
'Me.ddlODGroups.DataValueField = "ID"
Me.ddlODGroups.DataTextField = "wGroup"
Me.ddlODGroups.DataBind()
--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-