1
Answer

How to change the Button color which in the nested Gridview

Vasanth Jack

Vasanth Jack

7y
212
1
I have a button which is inside the datalist,te datalist which is inside the Gridview.
 
I want to change the button color which is inside the datalist 
 
protected void rptrbus_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string id = rptrbus.DataKeys[e.Row.RowIndex].Value.ToString();
// Session["id"] = id.ToString();
DataList dlseat = e.Row.FindControl("dlSeat") as DataList;
string strConnString = ConfigurationManager.ConnectionStrings["str"].ConnectionString;
using (SqlConnection con = new SqlConnection(strConnString))
{
SqlCommand cmd = new SqlCommand("sp_Trial1", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
cmd.CommandType = System.Data.CommandType.StoredProcedure;
// string id = HttpContext.Current.Session["id"].ToString();
cmd.Parameters.AddWithValue("@id", id);
DataTable dt = new DataTable();
da.Fill(dt);
dlseat.DataSource = dt;
dlseat.DataBind();
}
 
Answers (1)