Aamir Khan

Aamir Khan

  • NA
  • 277
  • 439k

Dropdown in Gridview should be filled on Selection of another Dropdown which is outside Gridview

Jun 20 2012 3:36 AM
Hi friends,
i have a requirement where i have to fill a dropdown in a Gridview on Selection or IndexChange of another Dropdown Control which is not inside of any Gridview.
i have done some code but i get the Null value;
code is as below


protected
{
void DrpProtocol_ID_SelectedIndexChanged(object sender, EventArgs e)//DataRowView drv = e.Row.DataItem as DataRowView;

dt = objDal.GetDataQry(
{
ddlCity = (
DataSet dt = new DataSet();"select InvId from dbo.InvDetails where ProtocolId='" + DrpProtocol_ID.SelectedItem.Text + "'", Convert.ToString(ConfigurationManager.ConnectionStrings["ConDMUtils_BackUp"].ConnectionString));DropDownList ddlCity = new DropDownList();foreach (GridViewRow row in GridView1.Rows)DropDownList)row.FindControl("ddlSite");//dropdown inside Gridview}
{
ddlCity.DataSource = dt.Tables[0];
if (ddlCity != null)//ddlCity.DataTextField = "InvId";ddlCity.DataValueField = "InvId";
ddlCity.DataBind();
}
}

what is the mistake being done


Answers (7)