Hi,
I am following the example on http://demos.telerik.com/aspnet-ajax/ajax/examples/manager/dynamicajaxsettings/defaultcs.aspx.
It works fine, so I updated it a bit to move the external form into the usercontrols and updated related code like find control and ajax setting registration etc, I then add code to dynamically load the EmployeesGrid usercontrol by follow the logic in this post http://www.telerik.com/help/aspnet-ajax/ajxloadusercontrols.html
I can load the user control, and select then delete item on the grid by using the grid's command button.
However, if I click edit to load a row into the external form and click update or delete button in the external form, I got exceptions.
For example, if I press the delete button on debug mode, and debug into the event hander below:
protected void Delete_Click(object sender, EventArgs e)
{
//RadGrid employeesGrid = (this.FindControl("EmployeesGrid1").FindControl("RadGrid1") as RadGrid);
// RadGrid1 now in the same user control as the external form so can reference directly
(RadGrid1.SelectedItems[0] as GridDataItem).FireCommandEvent("Delete", string.Empty);
}
RadGrid1's SelectedItems count always is 0. So seems the status is not persist during the ajax postback.
So I created another simple user control with another RadGrid with paging. Then if dynamically load that usercontrol, the paging seems not working. I add a OnPageIndexedChange event handler and put a break point inside it, the code flow after I page the grid to page 2 is:
main aspx page page_load which load the usercontrol
usercontrol page_load
grid NeedDataSource is called (note: current page index on the grid at this point is still 0)
grid PageIndexChanged is called and the event argument's NewPageIndex is 1, but current page index of the grid is still 0.
So I am confused what the code flow should be, did I missed something? What should I do to make these two examples working?
Many thanks in advance for your time.
I am following the example on http://demos.telerik.com/aspnet-ajax/ajax/examples/manager/dynamicajaxsettings/defaultcs.aspx.
It works fine, so I updated it a bit to move the external form into the usercontrols and updated related code like find control and ajax setting registration etc, I then add code to dynamically load the EmployeesGrid usercontrol by follow the logic in this post http://www.telerik.com/help/aspnet-ajax/ajxloadusercontrols.html
I can load the user control, and select then delete item on the grid by using the grid's command button.
However, if I click edit to load a row into the external form and click update or delete button in the external form, I got exceptions.
For example, if I press the delete button on debug mode, and debug into the event hander below:
protected void Delete_Click(object sender, EventArgs e)
{
//RadGrid employeesGrid = (this.FindControl("EmployeesGrid1").FindControl("RadGrid1") as RadGrid);
// RadGrid1 now in the same user control as the external form so can reference directly
(RadGrid1.SelectedItems[0] as GridDataItem).FireCommandEvent("Delete", string.Empty);
}
RadGrid1's SelectedItems count always is 0. So seems the status is not persist during the ajax postback.
So I created another simple user control with another RadGrid with paging. Then if dynamically load that usercontrol, the paging seems not working. I add a OnPageIndexedChange event handler and put a break point inside it, the code flow after I page the grid to page 2 is:
main aspx page page_load which load the usercontrol
usercontrol page_load
grid NeedDataSource is called (note: current page index on the grid at this point is still 0)
grid PageIndexChanged is called and the event argument's NewPageIndex is 1, but current page index of the grid is still 0.
So I am confused what the code flow should be, did I missed something? What should I do to make these two examples working?
Many thanks in advance for your time.
