I have a we data tree, bound to a hierarchical data source, and on NodeBound event I am setting the Template ID for the node. This is working well, and my template has a number of command buttons in it.
When I click on any of the buttons I get an error:
Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.
this is the code for my tree:
<ig:WebDataTree ID="wdtMyPlans" runat="server" InitialExpandDepth="0" EnableConnectorLines="false" StyleSetName="Office2007Silver" onNodeBound="wdtMyPlans_NodeBound" EnableAjax="true" EnableHotTracking="true" BackColor="Gainsboro" OnItemCommand="wdtMyPlans_ItemCommand" > <ClientEvents NodeHovered="NodeHoveredHandler" NodeUnhovered="NodeUnhoveredHandler" /> <Templates> <ig:ItemTemplate ID="tptNormal" runat="server" TemplateID="tptNormal" > <Template> <div style="width:270px; text-align:left; vertical-align:middle; color:Black; background-color:Gainsboro "> <div style="float:left; vertical-align:middle; " runat="server" id="divNode"> <asp:Label ID="txtPlanName" Width="180px" Font-Size="8pt" runat="server" Text='<%# Eval("name") %>'></asp:Label> <div id="divButtons" class="Gone" runat="server"> <asp:ImageButton ID="btntEditPlan" runat="server" ImageUrl="~/Images/pencil16.png" ImageAlign="Middle" ToolTip="Edit this plan" CommandName="EditPlan" CommandArgument='<%# Eval("WorkoutPracticePlanId") %>' /> <asp:ImageButton ID="btntDeletePlan" runat="server" ImageUrl="~/Images/delete16.png" ImageAlign="Middle" ToolTip="Archive this plan" CommandName="DeletePlan" CommandArgument='<%# Eval("WorkoutPracticePlanId") %>' /> <asp:ImageButton ID="btntViewPlan" runat="server" ImageUrl="~/Images/view16.png" ImageAlign="Middle" ToolTip="View this plan for a specific athlete" CommandName="ViewPlan" CommandArgument='<%# Eval("WorkoutPracticePlanId") %>' /> <asp:ImageButton ID="btntAssignPlan" runat="server" ImageUrl="~/Images/group.png" ImageAlign="Middle" ToolTip="Assign this plan to athlete(s)" CommandName="AssignPlan" CommandArgument='<%# Eval("WorkoutPracticePlanId") %>' /> </div> <div style="font-size:7pt; margin-left:20px"><%# Eval("description") %> </div> </div> </div> </Template> </ig:ItemTemplate> <ig:ItemTemplate ID="tptFocus" runat="server" TemplateID="tptFocus"> <Template> <asp:Label ID="txtSportName" Width="180px" Font-Size="8pt" runat="server" Text='<%# Eval("name") %>'></asp:Label> </Template> </ig:ItemTemplate> </Templates> </ig:WebDataTree>
Hi,
This error can occur if the WebDataTree is being bound to a datasource in the Page_Load event every time the page loads. To prevent this error only bind your WebDataTree to the datasource when it is not a postback (!Page.IsPostBack).
Valerie