protected void gridMain_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
GridView Grd = (GridView)e.Row.FindControl("gridSub");
Label lblB = (Label)e.Row.FindControl("lblGizli");
HyperLink hlMy = (HyperLink)e.Row.FindControl("hlSub");
if (lblB.Text==hfSayfaID.Value)
{
hlMy.CssClass = "selected";
hlMy.Font.Bold = true;
}
Grd.DataSource = myDB.Pages.Where(a=>a.MotherPageID.ToString() == lblB.Text).ToList();
// ** when there it fire with header not like DataRow
Grd.DataBind();
// when there it doesnt fire! *******
Grd.RowDataBound += new GridViewRowEventHandler(Grd_RowDataBound);
pnlMy.Visible = true;
if (Grd.Rows.Count == 0)
{
pnlMy.Visible = false;
}
else
{
//sth..
}
}
}
//this is rowdatabound of gridsub
void Grd_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Label lblB = (Label)e.Row.FindControl("lblGizli");
HyperLink hlMy = (HyperLink)e.Row.FindControl("hlSub");
if (lblB.Text == hfSayfaID.Value)
{
hlMy.Font.Bold = true;
}
}
}
|