I am using the following RadContextMenu in conjunction with a radgrid
As you can see I am using a web service call to populate the menu items of a submenu when I right click on one of the grid rows. This works perfectly.
However, I have run into a problem. The service call at times can take a second or two. That is not really an issue. However, if I select to expand the menu item that is populated using the web service (thus initializing the web call), then click a different menu item (which performs a partial postback) before the web service populates the menu, I get the following error: 'this.get_element()' is null or not an object.
I am guessing that the callback function for the webservice is looking for the radmenu and not finding it, because a postback has occurred. Using the OnClientItemPopulationFailed to suppress the error does not work. I would like to cancel the service call in the OnClientItemClosing event. Does anyone have any idea how to get an instance of the web call and abort it?
Thanks
<telerik:RadContextMenu ID="grdContextMenu" runat="server" EnableRoundedCorners="true" EnableShadows="true" OnClientItemPopulating="FetchUserList_Pre" EnableAutoScroll="true" OnClientItemPopulationFailed="ServiceFailure" > <WebServiceSettings Path="../Services/TimeSchedule.asmx" Method="FetchUserList" /> <LoadingStatusTemplate> <div style="padding-top:100px;text-align:right;width:120px;float:left;"> <asp:Image runat="server" ID="LoadingImage" ImageUrl="../Images/Working.gif" ToolTip="Loading..." Width="50px" Height="50px" /> <br /> Loading Users... </span> </LoadingStatusTemplate> <Items> <telerik:RadMenuItem Text="Add" ToolTip="Add a new record" /> <telerik:RadMenuItem Text="Delete" ToolTip="Delete this record"/> <telerik:RadMenuItem Text="Copy To Day" ToolTip="Copy this shift to the selected day" GroupSettings-Height="165" GroupSettings-ExpandDirection="Auto" > <Items> <telerik:RadMenuItem Text="Sunday" Value="Sunday"></telerik:RadMenuItem> <telerik:RadMenuItem Text="Monday" Value="Monday"></telerik:RadMenuItem> <telerik:RadMenuItem Text="Tuesday" Value="Tuesday"></telerik:RadMenuItem> <telerik:RadMenuItem Text="Wednesday" Value="Wednesday"></telerik:RadMenuItem> <telerik:RadMenuItem Text="Thursday" Value="Thursday"></telerik:RadMenuItem> <telerik:RadMenuItem Text="Friday" Value="Friday"></telerik:RadMenuItem> <telerik:RadMenuItem Text="Saturday" Value="Saturday"></telerik:RadMenuItem> </Items> </telerik:RadMenuItem> <telerik:RadMenuItem Text="Copy Shift (Open)" ToolTip="Copy this shift as open or to another user" GroupSettings-Height="250" GroupSettings-Width="200" GroupSettings-ExpandDirection="Auto" ExpandMode="WebService" > </telerik:RadMenuItem> </Items> </telerik:RadContextMenu>As you can see I am using a web service call to populate the menu items of a submenu when I right click on one of the grid rows. This works perfectly.
However, I have run into a problem. The service call at times can take a second or two. That is not really an issue. However, if I select to expand the menu item that is populated using the web service (thus initializing the web call), then click a different menu item (which performs a partial postback) before the web service populates the menu, I get the following error: 'this.get_element()' is null or not an object.
I am guessing that the callback function for the webservice is looking for the radmenu and not finding it, because a postback has occurred. Using the OnClientItemPopulationFailed to suppress the error does not work. I would like to cancel the service call in the OnClientItemClosing event. Does anyone have any idea how to get an instance of the web call and abort it?
Thanks