G
Guest
Hi all...
I have the following curious problem,
I have a GridView that I bind after I press a button in the web form. That
grid has a template column, which contains a checkbox (in the header and in
each row). The grid view is configured to be sortable.
These are the event handlers that causes the post back (click for the button
and when the grid has to be sorted)
protected void btnCargar_Click(object sender, EventArgs e)
{
ViewState["sort_expresion"] = "NUMPOL";
ViewState["sort_direction"] = "";
RefreshdataGrid();
}
protected void gvClaveInternet_Sorting(object sender,
GridViewSortEventArgs e)
{
ViewState["sort_expresion"] = e.SortExpression;
ViewState["sort_direction"] = e.SortDirection;
RefreshdataGrid();
}
RefreshdataGrid( ) method contains this code :
((CheckBox)gvClaveInternet.HeaderRow.Cells[0].Controls[1]).Attributes.Add("onclick", "check_all();");
foreach (GridViewRow row in gvClaveInternet.Rows)
((CheckBox)row.Cells[0].Controls[1]).Attributes.Add("onclick",
"row_click();");
btnDesmarcar.Attributes.Add("onclick", "return confirm('¿Está seguro que
desea proceder?');");
Well... when the page is loaded after btnCargar_Click event occurs,
"onclick" attribute is correctly added to the checkboxes, but when I press
some header text in order to sort by that column and the page is refreshed,
the "onclick" attribute isn't added to the checkboxes, but it is added for
btnDesmarcar button, so it's a problem only for the checkboxes.
When I debug the application, I see that the code is correctly executed.
What may be hapenning?
Thanks in advance
Jaime
I have the following curious problem,
I have a GridView that I bind after I press a button in the web form. That
grid has a template column, which contains a checkbox (in the header and in
each row). The grid view is configured to be sortable.
These are the event handlers that causes the post back (click for the button
and when the grid has to be sorted)
protected void btnCargar_Click(object sender, EventArgs e)
{
ViewState["sort_expresion"] = "NUMPOL";
ViewState["sort_direction"] = "";
RefreshdataGrid();
}
protected void gvClaveInternet_Sorting(object sender,
GridViewSortEventArgs e)
{
ViewState["sort_expresion"] = e.SortExpression;
ViewState["sort_direction"] = e.SortDirection;
RefreshdataGrid();
}
RefreshdataGrid( ) method contains this code :
((CheckBox)gvClaveInternet.HeaderRow.Cells[0].Controls[1]).Attributes.Add("onclick", "check_all();");
foreach (GridViewRow row in gvClaveInternet.Rows)
((CheckBox)row.Cells[0].Controls[1]).Attributes.Add("onclick",
"row_click();");
btnDesmarcar.Attributes.Add("onclick", "return confirm('¿Está seguro que
desea proceder?');");
Well... when the page is loaded after btnCargar_Click event occurs,
"onclick" attribute is correctly added to the checkboxes, but when I press
some header text in order to sort by that column and the page is refreshed,
the "onclick" attribute isn't added to the checkboxes, but it is added for
btnDesmarcar button, so it's a problem only for the checkboxes.
When I debug the application, I see that the code is correctly executed.
What may be hapenning?
Thanks in advance
Jaime