Pages

Thursday, 5 July 2012

How to Bind Check boxes checked if product is added....


 GetProductName(Convert.ToInt32(Session["Prdid"]));

        DataSet ds = obj.GetCatId(Session["ProductName"].ToString());


        for (int j = 0; j < ds.Tables[0].Rows.Count; j++)
        {
            DataSet ds2 = obj.GetCategoriesNamewithId(ds.Tables[0].Rows[j]["CategoriesId"].ToString());
            string name = ds2.Tables[0].Rows[0]["CategoriesName"].ToString();

            foreach (DataListItem item in DataList1.Items)
            {
                // Get the checkbox control that contain the user selection.
                CheckBox cbSelProducts1 = (CheckBox)item.FindControl("cbSelProduct");
                Label lblCatId1 = (Label)item.FindControl("lblCategoreisName");
                if (lblCatId1.Text == name)
                {
                    cbSelProducts1.Checked = true;
                }

            }
        }



try to implement in ur page based on ur requirement



No comments:

Post a Comment