Sunday, March 11, 2012

Value from DropDownList in GridView

protected void GV_Top_SelectedIndexChanged(object sender, EventArgs e){ GridViewRow row = GV_Top.SelectedRow; hj_persID.Text = row.Cells[14].Text; dropdownlist d = row.Cells[5].Controls.FindControl("DDL_sprak");if (d !=null) { ' found the control hj_spraak_kode.Text = d.SelectedText;// or SelectedValue }else {//error handling}}

Thank You for Your help

This works: DropDownList d = (DropDownList)row.Cells[5].FindControl("DDL_Spraak");


Any chance of having this code in VB.Net?

Thanks


rbekhechi:

Any chance of having this code in VB.Net?

Thanks

Protected Sub GV_Top_SelectedIndexChanged(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles GV_Top.SelectedIndexChangedDim rowAs GridViewRow= GV_Top.SelectedRow hj_persID.Text = row.Cells(14).TextDim d as DropDownList = row.Cells(5).Controls.FindControl("DDL_sprak")If d IsNotNothing Then' found the control hj_spraak_kode.Text = d.SelectedText' or SelectedValueElse' error handlingEnd IfEnd Sub

Thanks for your help. I really appreciate it.

No comments:

Post a Comment