Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
415
System.FormatException when clicking buttons in subnodes of WebDataTree
posted

Hello!

I have a webdatatree which contains templates which contain asp ImageButtons.

I would like to capture the clicking of these buttons in the ItemCommand event of the WebDataTree.

For "trunk", or top level nodes, it works perfectly.  But for subnodes which use the exact same template, I get the following error:

System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at Infragistics.Web.UI.NavigationControls.NavControl.ResolveItem(String fullAddress)
   at Infragistics.Web.UI.NavigationControls.WebDataTree.OnBubbleEvent(Object source, EventArgs e)
   at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

This is aspx code for my datatree:

<

 

 

 

ig:WebDataTree ID="wdtCurricula" runat="server" DataLoadingMessage

="Please Wait"

 

 

 

OnItemCommand="wdtCurricula_ItemCommand" DragDropSettings-AllowDrop="true" DragDropSettings-DragDropMode

="Move">

 

 

 

<DragDropSettings AllowDrop="True" DragDropMode

="Move">

 

 

 

</DragDropSettings

>

 

 

 

<DataBindings

>

 

 

 

</DataBindings

>

 

 

 

<Templates

>

 

 

 

<ig:ItemTemplate ID="RequirementTemplate" runat="server" TemplateID

="RequirementTemplate">

 

 

 

<Template

>

 

 

 

<asp:ImageButton ID="ibEditRequirement" runat="server" AlternateText="Edit" ToolTip

="Edit Requirement"

 

 

 

CausesValidation="false" CommandArgument="something" CommandName

="EditRequirement"

 

 

 

ImageUrl="~/Images/icons/edit_enabled16x16.png"

/>

 

 

 

<asp:ImageButton ID="ibRemoveRequirement" runat="server" AlternateText="Remove" ToolTip

="Remove Requirement"

 

 

 

CausesValidation="false" CommandArgument="something" CommandName

="RemoveRequirement"

 

 

 

ImageUrl="~/Images/icons/delete_enabled16x16.png"

/>

 

 

 

<asp:Label runat="server" ID="lblRequirementText"

/>

 

 

 

<asp:ImageButton ID="ibAddToRequirement" runat="server" AlternateText="Add" ToolTip

="Add"

 

 

 

CausesValidation="false" CommandArgument="something" CommandName

="AddToRequirement"

 

 

 

ImageUrl="~/Images/icons/add_16.png"

/>

 

 

 

<cc1:ConfirmButtonExtender ID="cbeRemoveRequirement" runat="server" ConfirmText

="Are you sure you want to permanantly remove this requirement?"

 

 

 

TargetControlID="ibRemoveRequirement"

/>

 

 

 

</Template

>

 

 

 

</ig:ItemTemplate

>

 

 

 

<ig:ItemTemplate ID="ElementTemplate" runat="server" TemplateID

="ElementTemplate">

 

 

 

<Template

>

 

 

 

<asp:ImageButton ID="ibEditElement" runat="server" AlternateText="Edit" ToolTip

="Edit Element"

 

 

 

CausesValidation="false" CommandArgument="something" CommandName

="EditElement"

 

 

 

ImageUrl="~/Images/icons/edit_enabled16x16.png"

/>

 

 

 

<asp:ImageButton ID="ibRemoveElement" runat="server" AlternateText="Remove" ToolTip

="Remove Element"

 

 

 

CausesValidation="false" CommandArgument="something" CommandName

="RemoveElement"

 

 

 

ImageUrl="~/Images/icons/delete_enabled16x16.png"

/>

 

 

 

<cc1:ConfirmButtonExtender ID="cbeRemoveElement" runat="server" ConfirmText

="Are you sure you want to permanantly remove this element?"

 

 

 

TargetControlID="ibRemoveElement"

/>

 

 

 

<asp:Label runat="server" ID="lblElementText"

/>

 

 

 

</Template

>

 

 

 

</ig:ItemTemplate

>

 

 

 

</Templates

>

 

 

 

</ig:WebDataTree

>

And finally, here is the code for my ItemCommand event for the WebDataTree:

protected void wdtCurricula_ItemCommand(object sender, DataTreeCommandEventArgs

e)

{

lblCommandName.Text = e.CommandName;

lblCommandArgument.Text = e.CommandArgument.ToString();

 

 

 

Guid commandArgument = new Guid

(e.CommandArgument.ToString());

 

 

 

switch

(e.CommandName)

{

 

 

 

case "RemoveRequirement"

:

RemoveRequirement(commandArgument);

 

 

 

break

;

 

 

 

case "EditRequirement"

:

EditRequirement(commandArgument);

 

 

 

break

;

 

 

 

case "AddToRequirement"

:

ucAddCurriculumRequirement.ParentRequirementId = commandArgument;

ucAddCurriculumRequirement.Show();

 

 

 

break

;

 

 

 

default

:

 

 

 

break

;

As I said, the ItemCommand event fires properly and behaves exactly as I would like for top level nodes.  The error only occurs in subnodes.  Also, the error occurs before the ItemCommand event is fired.

Any help would be appreciated.  You folks have been very helpful in the past, thanks!