I have a user control called “DashboardUserControl.ascx”
It has a function:
public void setPagination(Boolean pagination)
{
this.DashboardGridView.AllowPaging = pagination;
}
I have two other pages with that user control inserted via drag and drop:
-
MyDashboard.aspx: I want to set the pagination of user control to “true” from this page.
-
SharedDashboard.aspx: I want to set the pagination of the user control to “false”.
How to do this?
If you have the usercontrol added to both pages, then you have two instances of the usercontrol. Which means the usercontrol on the pages are not connected.
So to call the method, you can simple do the following in the Page_Load of the pages. The following code sample is for MyDashboard.aspx.cs. Change true to false in SharedDashboard.aspx.cs.