Tuesday, 11 July 2017

Bind Data in DropDown in Gride View

//DropDown
DropDownList D_grade = (DropDownList)Grid_studenthealth.Rows[i].FindControl("drpGrade");

public void Grid_studenthealth_OnRowDataBound(object sender, GridViewRowEventArgs e)
    {
        dt = Bind_Disiplan_Grade();
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            DropDownList DDL_Grade = (DropDownList)e.Row.FindControl("drpGrade");
            Label di_Grade = (Label)e.Row.FindControl("grid_Grade");

            DDL_Grade.DataSource = dt;
            DDL_Grade.DataTextField = "grade";//grade Column Name
            DDL_Grade.DataValueField = "grade";
            DDL_Grade.DataBind();
            DDL_Grade.Items.Insert(0, new ListItem("--Select Grade--", "0"));//Add New Item
            DDL_Grade.SelectedValue = di_Grade.Text.Trim();
         
        }

No comments:

Post a Comment

IIS deployment support details

  Node JS - IIS deployment support details node: http://go.microsoft.com/?linkid=9784334 IISNode: https://github.com/azure/iisnode/releases/...