i added one dropdownlist in the edit mode of gridview , but i cannot read the selected value in the code behind page, i set the auto post back as true, still am not getting...
can anybody pls help.. its very urgent...
my code in aspx is
RowStyle-VerticalAlign="Middle" RowStyle-Height="2em" AllowPaging="True"
AllowSorting="True" CellPadding="4" ForeColor="#333333" GridLines="None"
onpageindexchanging="GridView_Subscription_PageIndexChanging"
onrowediting="GridView_Subscription_RowEditing"
onrowcancelingedit="GridView_Subscription_RowCancelingEdit"
onrowdeleting="GridView_Subscription_RowDeleting"
onrowupdating="GridView_Subscription_RowUpdating" >
<%--
OnClientClick="return confirm('Are you sure you want to delete this?')">
and in the code behind is
DropDownList ddl = (DropDownList)GridView_Subscription.Rows[e.RowIndex].FindControl("Freq_Combo");
string text = ddl.SelectedItem.Text;
am populating the dropdown from code behind.
thanks in advance
Sukesh MarlaPosted Sep 17, 2012, 11:22 AM
Example
if(!IsPostback)
{
gridview1.DataSource=SomeDataTable;
gridView1.DataBind();
}
Check this is correct answer if it helped.
R ACHUTHAPosted Sep 17, 2012, 11:20 AM
try the following,
DropDownList ddl = (DropDownList)GridView_Subscription.Rows[e.NewEditIndex].FindControl("DropDown_frequency ");
string text = ddl.SelectedItem.Text;