R
Rob Venable
Hi all,
Can anyone tell me how to retrieve the ID of a selected item from a
DropDownList. My query brings back the ID and value and I cycle through
the .Read Method to add items to the DropDownList.
e.g.
While dr.Read
DDL.Items.Add(dr("value"))
End While
I can do it if I use this method:
DDL.DataSource = dr
DDL.DataTextField = "value"
DDL.DataValueField = "id"
DDL.DataBind()
and then refer the the DataValueField to get the ID.
This would be the easy way but I have to do it by adding items to the
DDL.
Is there a property I can set to make it equal to the ID and then be
able to retrieve it?
Thanks
Rob
Can anyone tell me how to retrieve the ID of a selected item from a
DropDownList. My query brings back the ID and value and I cycle through
the .Read Method to add items to the DropDownList.
e.g.
While dr.Read
DDL.Items.Add(dr("value"))
End While
I can do it if I use this method:
DDL.DataSource = dr
DDL.DataTextField = "value"
DDL.DataValueField = "id"
DDL.DataBind()
and then refer the the DataValueField to get the ID.
This would be the easy way but I have to do it by adding items to the
DDL.
Is there a property I can set to make it equal to the ID and then be
able to retrieve it?
Thanks
Rob