In this last scenario we will show you how the EmployeeList
UserControl, which is now not placed inside an UpdatePanel, will cause a
partial-update for the UpdatePanel containing the OrderList UserControl.
In the above two scenarios you noticed that we were using
the EmployeeList GridView just to show some data in the OrderList GridView. In
this case, there is no need for you to have any kind of AJAX for the
EmployeeList. However, if you plan to add some functionalities to the
EmployeeList GridView, like editing for example, then it would be a good choice
to consider one of the above two scenarios.
In this scenario, the EmployeeList will be placed as it is
on the host page with no UpdatePanels and the OrderList will still be placed
inside an UpatePanel. Now the question is how will the EmployeeList
UsreControl’s event cause a partial-update for the OrderList UserControl?
Well, you have two options to work around it in this case.
The first option is to add a Triggers property to the UpdatePanel and specify
that the EmployeeList UserControl that has the RowSelected event will cause a
partial-update. The other option is simply add the following line of code into
the Page_Load event handler of the host page:
protected void Page_Load(object sender, EventArgs e)
The RegsiterAsyncPostBackControl method that belongs to the
ScriptManager changes the behavior of a server control from causing a postback
to causing an asynchronous postback. In this case, the EmployeeList
UserControl’s event RowSelected will cause an asynchronous postback. Since this
UserControl is not registered as a Trigger to the UpdatePanel, you will have to
make the UpdateMode of the UpdatePanel to Always. This way, any server control
on the host page causing an asynchronous postback, the UpdatePanel will refresh
If you do not want the UpdatePanel to refresh every time the
EmployeeList UserControl’s event RowSelected fires, you can change its
UpdateMode to Conditional and add the EmployeeList UserControl with its event
RowSelected as a Trigger to the UpdatePanel. This way, the UpdatePanel will
refresh its content any time the EmployeeList UserControl’s event RowSelected