Thursday, 1 May 2014

Dropdownlist binding when edit index change in gridview

No comments
 protected void gridcollages_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if ((e.Row.RowState & DataControlRowState.Edit) > 0)
            {
                DropDownList d1 = (DropDownList)e.Row.FindControl("dropcat");
                d1.DataSource = bl.select_collage_cat();
                d1.DataBind();
                DropDownList d2 = (DropDownList)e.Row.FindControl("dropcountry");
                d2.DataSource = bl1.bind_country();
                d2.DataBind();
            }
        }
    }