RowDataBound for Grid not working always

Joined
Jul 7, 2009
Messages
1
Reaction score
0
Hi there,

I am facing a typical problem here. I have a page Reports.aspx which has a gridview containing a Select All checkbox in the header section. This page also contains a search section which comes from a master page (master page which contains the page Reports.aspx).

On my Page_Load event, this line of code is always fired
gvStudyList.RowDataBound += new GridViewRowEventHandler(gvStudyList_RowDataBound);

And in the gvStudyList_RowDataBound event i am setting the javascript function for the Select All checkbox as follows:

private void gvStudyList_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
CheckBox chkBox = e.Row.Cells[1].Controls[0] as CheckBox;

if (chkBox != null)
{
chkBox.Attributes.Add("onclick", "javascript:SelectAll('" + chkBox.ClientID + "');");
}
}
}


The issue is that whenever i use the search functionality to filter the grid.
I am binding the grid using a session variable coming from the master page.
But my RowDataBound event does not get fired.

Can someone please help me with this issue? I need a solution asap due to urgent deliverable.

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top