I have a radgrid that uses a rad context menu. The rad grid itself is controlled through a rad ajax manager and it uses the automatic inserts, updates, and deletes. When the page loads, the context menu works fine. But if I insert a new record, edit a record, delete a record, sort the grid, or refresh the grid with the automatic refresh button, the context menu disappears and when I right click, I get the normal IE7 popup dialog.
Here's the code:
<telerik:RadCodeBlock ID="rcb" runat="server" > |
<script type="text/javascript" language="javascript" > |
var rgFunding = null |
var rcmFunding = null |
var motype = null |
function pageLoad() { |
rgFunding = $find('<%= rgFunding.ClientID %>') |
rcmFunding = $find('<%= rcmFunding.ClientID %>'); |
motype = $find('<%= motype.ClientID %>'); |
} |
function fundingClientClicked(sender, args) { |
var itemLabel = args.get_item().get_value(); |
switch (itemLabel) { |
case "Select All": |
rgFunding.get_masterTableView().selectAllItems(); |
break; |
case "Clear All": |
rgFunding.get_masterTableView().clearSelectedItems(); |
break; |
case "Move": |
var selectedRows = rgFunding.get_masterTableView().get_selectedItems(); |
for (i = 0; i < selectedRows.length; i++) { |
iID = selectedRows[i].getDataKeyValue("iID"); |
bIsFlag= selectedRows[i].getDataKeyValue("bIsFlag"); |
PageMethods.MoveFunding(iID, bIsFlag == "True" ? false : true, Repaint, HandleError); |
} |
break; |
} |
} |
function Repaint(results) { |
location.reload(true); |
} |
</script> |
</telerik:RadCodeBlock> |
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" |
DefaultLoadingPanelID="RadAjaxLoadingPanel1"> |
<ajaxsettings> |
<telerik:AjaxSetting AjaxControlID="rgFunding"> |
<updatedcontrols> |
<telerik:AjaxUpdatedControl ControlID="rgFunding" LoadingPanelID="RadAjaxLoadingPanel1" /> |
</updatedcontrols> |
</telerik:AjaxSetting> |
</ajaxsettings> |
</telerik:RadAjaxManager> |
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" |
Width="75px" Transparency="25" > |
<img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' |
style="border: 0px;" /> |
</telerik:RadAjaxLoadingPanel> |
<telerik:RadContextMenu ID="rcmFunding" runat="server" |
Skin="WebBlue" OnClientItemClicked="fundingClientClicked" |
style="top: 213px; left: 317px" > |
<Targets> |
<telerik:ContextMenuControlTarget ControlID="rgFunding" /> |
</Targets> |
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
</telerik:RadContextMenu> |
<asp:Label ID="lblFundingHeader" runat="server" CssClass="HeaderTag" /> |
<telerik:RadGrid ID="rgFunding" runat="server" Skin="WebBlue" |
AutoGenerateColumns="False" GridLines="None" ShowFooter="True" |
AllowSorting="True" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" |
AllowAutomaticDeletes="true" DataSourceID="ldsFunding" |
AllowMultiRowEdit="true" oncustomaggregate="rgFunding_CustomAggregate" |
OnDataBound="rgFunding_DataBound" Width="1000px" |
onitemdeleted="rgFunding_ItemDeleted" oniteminserted="rgFunding_ItemInserted" |
onitemupdated="rgFunding_ItemUpdated" AllowMultiRowSelection="True" |
onitemcreated="rgFunding_ItemCreated" > |
<ClientSettings> |
<Selecting AllowRowSelect="true" /> |
<Scrolling AllowScroll="true" UseStaticHeaders="true" ScrollHeight="200px" /> |
</ClientSettings> |
<HeaderContextMenu Skin="WebBlue"> |
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
</HeaderContextMenu> |
<MasterTableView DataSourceID="ldsFunding" CommandItemDisplay="Top" DataKeyNames="iID" ClientDataKeyNames="iID, bIsFlag" AutoGenerateColumns="false" EditMode="InPlace" > |
<Columns> |
<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="Edit" ItemStyle-Width="25px" > |
<ItemStyle CssClass="editbutton" /> |
</telerik:GridEditCommandColumn> |
<telerik:GridBoundColumn DataField="iID" HeaderText="ID" ReadOnly="true" SortExpression="iID" UniqueName="iID" Visible="False" /> |
<telerik:GridDateTimeColumn DataField="dtSettlement" ItemStyle-Width="55px" HeaderText="Settlement" SortExpression="dtSettlement" UniqueName="dtSettlement" DataFormatString="{0:d}" /> |
<telerik:GridDateTimeColumn DataField="dtMaturity" ItemStyle-Width="55px" HeaderText="Maturity" SortExpression="dtMaturity" UniqueName="dtMaturity" DataFormatString="{0:d}" /> |
<telerik:GridNumericColumn DataField="curAmount" ItemStyle-Width="55px" HeaderText="Amount" SortExpression="curAmount" UniqueName="curAmount" DataFormatString="{0:N3}" Aggregate="Sum" /> |
<telerik:GridBoundColumn DataField="iNoOfDays" ReadOnly="true" ItemStyle-Width="45px" HeaderText="# of<br />Days" SortExpression="iNoOfDays" UniqueName="iNoOfDays" DataFormatString="{0:0}" Aggregate="Custom" /> |
<telerik:GridBoundColumn DataField="sSource" ItemStyle-Width="55px" HeaderText="Source" SortExpression="sSource" UniqueName="sSource" /> |
<telerik:GridNumericColumn DataField="nCost" ItemStyle-Width="45px" HeaderText="Cost" SortExpression="nCost" UniqueName="nCost" DataFormatString="{0:N3}" Aggregate="Custom" /> |
<telerik:GridButtonColumn ConfirmText="Delete this Funding?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"> |
<ItemStyle HorizontalAlign="Center" CssClass="deletebutton" /> |
</telerik:GridButtonColumn> |
</Columns> |
</MasterTableView> |
<FilterMenu Skin="WebBlue"> |
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
</FilterMenu> |
</telerik:RadGrid> |
<asp:LinqDataSource ID="ldsFunding" runat="server" |
ContextTypeName="fhlb.debt.middletier.DAL.DebtDataContext" EnableInsert="true" |
EnableDelete="true" EnableUpdate="true" TableName="Funding_Currents" |
OnInserting="ldsFunding_Inserting" OnDeleting="ldsFunding_Deleting" |
OnUpdating="ldsFunding_Updating" oninserted="ldsFunding_Inserted" |
onupdated="ldsFunding_Updated" Where="bIsFlag == @ bIsFlag&& dtBOM == @dtBOM" > |
<WhereParameters> |
<asp:QueryStringParameter Name="bIsFlag" QueryStringField="Flag" DefaultValue="false" Type="Boolean" /> |
<asp:QueryStringParameter Name="dtBOM" QueryStringField="BOM" Type="DateTime" /> |
</WhereParameters> |
</asp:LinqDataSource> |
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" |
style="font-weight: 700"> |
</telerik:RadWindowManager> |
protected void Page_Load(object sender, EventArgs e) |
{ |
LoadFormElements(); |
} |
private void LoadFormElements() |
{ |
lblFundingHeader.Text = "Funding"; |
rcmFunding.Items.Clear(); |
RadMenuItem rmiMove = new RadMenuItem(); |
rmiMove.Text = "Move to " + (this.bIsFlag ? "Yes" : "No"); |
rmiMove.Value = "Move"; |
rmiMove.Attributes.Add("motype", (this.bIsFlag ? "Yes" : "No")); |
rmiMove.PostBack = true; |
RadMenuItem rmiSelectAll = new RadMenuItem(); |
rmiSelectAll.Text = "Select All"; |
rmiSelectAll.Value = "Select All"; |
RadMenuItem rmiClearAll = new RadMenuItem(); |
rmiClearAll.Text = "Clear All"; |
rmiClearAll.Value = "Clear All"; |
rcmFunding.Items.Add(rmiMove); |
rcmFunding.Items.Add(rmiSelectAll); |
rcmFunding.Items.Add(rmiClearAll); |
} |
[WebMethod] |
public static void MoveFunding(string sID, Boolean bIsFlag) |
{ |
Funding.MoveFunding(Convert.ToInt32(sID), bIsFlag); |
} |
Now the first thing I tried to fix it was to define the radcontextmenu items in the aspx page, but that netted the same results.
Any ideas?