Udostępnij za pośrednictwem


Getting a Value

Let’s start with a DataGrid that looks like the following

If we wanted to retrieve the value that a user selects from the drop down list control shown in Column 4 into a value. We would use the following code.

' Gets the value the dropdown control in the fourth column
Dim drop As DropDownList
drop = CType(e.Item.Cells(4).Controls(1), DropDownList)currentquantity = drop.SelectedValue

The above code is creating a local copy of the control using a cast. Once the local copy is created you can access the standard controls defined for the control.

Comments

  • Anonymous
    August 25, 2004
    How do you retrieve this information from cross page post? i.e if I use postbackurl and posts to a different page, in the other page how do I retrieve this value?
  • Anonymous
    August 26, 2004
    hmmm - well I actually am not aware of a way to do this on a cross page post. Anybody else know how to do it?