vendredi 29 décembre 2017

How to keep parent gridview checkbox value

CITY-STATE FILTER

I have a parent gridview. City and state. I binding City on Page_Load. If client click the plus button, i show the state gridview and choosing state with the checkbox. But, if you click the minus button and i missing the checkbox value. I hope you understand :)

protected void OnRowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string CityId = gridviewcity.DataKeys[e.Row.RowIndex].Value.ToString();

                string query = @"(SQL QUERY) where cityid= '" + CityId + "'";
                GridView gridviewstate = e.Row.FindControl("gridviewstate") as GridView;
                DataTable table = (DataTable)result.ReturnValue;
                gridviewstate .DataSource = table;
                gridviewstate .DataBind();

        }
    }




Aucun commentaire:

Enregistrer un commentaire