Logo 
Search:

Asp.net Answers

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds
  Question Asked By: Tracey King   on Oct 16 In Asp.net Category.

  
Question Answered By: Luisa Fischer   on Oct 16

ok I got it now...
The way you can do this is a mix of what you have been doing. I will write you some steps you should follow to achieve this.

1. set the autpostback to true for the ddl.
2. You don't have to use the ddl_onselectedindexchange event handler because like you say you don't get access to the current row of the datagrid
3. set the onItemDataBound event handler of the datagrid. This event raises every time a row of the datasource is bounded to the datagrid
4. hook to that event in the code behind. This is the signature for that event
DataGrid_ItemDataBound(sender as Object, e as System.Web.UI.WebControls.DataGridItemEventArgs)

5. Note the second one (DataGridItemEventArgs) this one will provide the item  being bounded. So what you should do here is get the ddl with FindControl and use the selected value of it to write to the third column  of the dg. i.e.


Dim myDropdown As DropDownList = CType(e.Item.FindControl("myDDL"), DropDownList)

Dim value As String
value = myDropdown.SelectedItem.Text
e.Item.Cells(3).Text = value

I assume here that the third column is the index  3, maybe it's not there because you use another column hidden or whatever

Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Get events from dropdownlist in DataGrid Or get search suggestion and latest updates.


Tagged: