Monday, July 1, 2013

Get dropdownlist selcted value in gridview in Asp.net

Title:
how Get Drop down List selected value  in grid view using c# in asp.net
Requirement: 
.Frame Work and Sql Server
Explanation:
Here i will show how to fire selected index event of drop down in grid view.When we work with drop down list in grid view ,Most  of  the confusion about how to get the selected value of DDL.By using this event(SelectedindexChanged) we can do it.
As per requirement have to display details of selected record details in report page.By using this ,will get Drop down selected value in grid view. In the above i have fetched the drop down list selected value which in grid view.

protected void ddlorders_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow GvOrderrow= (GridViewRow)ddlorders.NamingContainer;
DropDownList ddlOrdr_name= ((DropDownList)(GvOrderrow.FindControl(“ddlorders"))).SelectedValue;
if((ddlOrdr_name.SelectedValue.ToString()) =="")
{
Response.Write("No order Exist");
}
else
{
Respose.Redirect("Report.aspx?order='"+ CurrentOrdr+"'");
}


Post a Comment

Bel