checkbox element in the Header template of the GridView, and that occurs at the
row created subroutine as illustrated in Listing 5.
Protected Overloads Overrides Sub OnRowCreated(ByVal e As GridViewRowEventArgs)
If IncludeColumnCheckBox Then
If e.Row.RowType = DataControlRowType.Header Then
DirectCast(e.Row.FindControl("ChkHeader"), CheckBox).Attributes.Add("onclick", _
"ObjJs_" & Me.ID & ".CheckUnCheckRows(this.checked)")
files that need to be registered when the final HTML is generated for that
page. So we need to write a bit of code in the OnInit subroutine.
Protected Overrides Sub OnInit(ByVal e As EventArgs)
Me.Page.ClientScript.RegisterClientScriptInclude(Me.GetType(), "CustomGridJS", _
file which contains the client side code as in Listing 7. Using this way allows
us to drag and drop our new custom control many times in the page without
worrying about confliction between these instances.
Public Overrides Sub Rendercontrol(ByVal writer As System.Web.UI.HtmlTextWriter)
ScriptManager.RegisterStartupScript(Page, Me.GetType, Me.ID & "JSBlock", "var
ObjJs_" & Me.ID & " = new GridClass('" & Me.ClientID & "');", True)
I recommend you download the source so that you can preview