Hello,
I have a page with a RadMenu on it. Some of the menu items are getting created in the markup, and some are created in code-behind
inside Page_Load(). Most of the menu items work fine. One of the menu items, however, does not. When I click on it, it performs
a postback, and some time after Page_Load() is executed, I get the following error:
[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +7471479
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +119
System.Convert.ToInt32(String value) +63
Telerik.Web.UI.HierarchicalControlItemContainer.FindItemByHierarchicalIndex(String hierarchicalIndex) +213
Telerik.Web.UI.RadMenu.RaisePostBackEvent(String nodeIndex) +44
Telerik.Web.UI.RadMenu.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String nodeIndex) +39
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
In debug mode, I have examined the contents of the menu within Page_Load() at the postback, and the menu items look correct to me.
Can anyone tell me what I am doing wrong here?
The following is the code for the menu creation in the aspx file and also the code-behind:
aspx:
<telerik:RadMenu ID="menuActions" runat="server" Font-Names="Arial" Skin="Windows7"> |
<Items> |
<telerik:RadMenuItem Value="delete" NavigateUrl="javascript:Delete();" Text="Delete" Enabled="false" /> |
<telerik:RadMenuItem Value="save" NavigateUrl="javascript:Save();" Text="Save" Enabled="false" /> |
</Items> |
</telerik:RadMenu> |
code-behind:
RadMenuItem effectiveDateItem = new RadMenuItem( |
"Current", |
string.Format("javascript:__doPostBack('{0}','{1}');", base.ActionMenu.UniqueID, WebUtils.ActionsMenuTags.ChangeListEffectiveDate)); |
effectiveDateItem.Value = WebUtils.ActionsMenuTags.ChangeListEffectiveDate; |
effectiveDateItem.ImageUrl = ResolveUrl(WebUtils.ImageUrls.EditDate); |
RadMenuItem clearEffectiveDateItem = new RadMenuItem("Clear", |
string.Format("javascript:__doPostBack('{0}','{1}');", base.ActionMenu.UniqueID, WebUtils.ActionsMenuTags.ClearListEffectiveDate)); |
clearEffectiveDateItem.Value = WebUtils.ActionsMenuTags.ClearListEffectiveDate; |
effectiveDateItem.Items.Add(clearEffectiveDateItem); |
base.ActionMenu.Items.Add(effectiveDateItem); |
Thanks for any help.