Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Protected Sub ckPaging_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ckPaging.CheckedChanged
gvItem.AllowPaging = ((CheckBox)sender).Checked
BindData()
End Sub
//aspx
<asp:GridView ...
OnPagingIndexChanging="GridView_PageIndexChanging"
OnPagingIndexChanged="GridView_PageIndexChanged"
//code behind
protected sub GridView_PageIndexChanging(...)
end sub
protected sub GridView_PagIndexChanged(...)
end sub
protected void CheckBox_CheckedChanged(object sender, eventArgs e)
{
CheckBox cb = (CheckBox)sender;
gvItem.AllowPaging = cb.Checked;
if(cb.Checked)
{
gvItem.OnPageIndexChanging += new EventHandler(GridView_PageIndexChanging);
gvItem.OnPageIndexChanged += new EventHandler(GridView_PageIndexChanged);
}
else
{
gvItem.OnPageIndexChanging -= new EventHandler(GridView_PageIndexChanging);
gvItem.OnPageIndexChanged -= new EventHandler(GridView_PageIndexChanged);
}
BindData();
}
that would work, but it's alot of duplicate code and would quickly become a maintenance nightmare.sammyDashoe said:Why can't you define two gridViews and set visible=false to the one without paging.