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
Data Disappears from node template after post back when clicking image buttons in node..
posted

I have a WebDataTree with two templates.  I bind the data on the initial page load.

This works fine.  My templates contain image buttons.  If I click an image button, the data-derived portions of the template disappear.  Loading the data during each postback causes other problems.

Is there anyway for this data to persist between postbacks?  

Here is my html code:

            <asp:Label runat="server" ID="lblCommandName" />

            <asp:Label runat="server" ID="lblCommandArgument" />

 

            <ig:WebDataTree ID="wdtCurricula" runat="server" DataMember="CATEGORIES" DataLoadingMessage="Please Wait"

                DragDropSettings-AllowDrop="true" DragDropSettings-DragDropMode="Move" OnNodeBound="wdtCurricula_NodeBound"

                OnItemCommand="wdtCurricula_ItemCommand">

                <DragDropSettings AllowDrop="True" DragDropMode="Move">

                </DragDropSettings>

                <DataBindings>

                    <ig:DataTreeNodeBinding DataMember="CATEGORIES" TextField="Category" />

                    <ig:DataTreeNodeBinding DataMember="REPORTS_LIST" TextField="Display_Name" />

                </DataBindings>

                <Templates>

                    <ig:ItemTemplate ID="Template1" runat="server" TemplateID="Template1">

                        <Template>

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

                                CausesValidation="false" CommandArgument="argLevel0" CommandName="AddLevel0"

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

                            <asp:ImageButton ID="ibEdit" runat="server" AlternateText="Edit Student Score" ToolTip="Edit Student Score"

                                CausesValidation="false" CommandArgument="something" CommandName="Edit" ImageUrl="~/Images/icons/edit_enabled16x16.png" />

                            <asp:ImageButton ID="ibRemove" runat="server" AlternateText="Remove Student" ToolTip="Remove student from class."

                                CausesValidation="false" CommandArgument="something" CommandName="RemoveStudent"

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

                            <asp:Label runat="server" ID="lblCategory" Text='<%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "Category")%>' />

                        </Template>

                    </ig:ItemTemplate>

                    <ig:ItemTemplate ID="Template2" runat="server" TemplateID="Template2">

                        <Template>

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

                                CausesValidation="false" CommandArgument="argLevel1" CommandName="AddLevel1"

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

                            <asp:ImageButton ID="ibEdit" runat="server" AlternateText="Edit Student Score" ToolTip="Edit Student Score"

                                CausesValidation="false" CommandArgument="something" CommandName="Edit" ImageUrl="~/Images/icons/edit_enabled16x16.png" />

                            <asp:ImageButton ID="ibRemove" runat="server" AlternateText="Remove Student" ToolTip="Remove student from class."

                                CausesValidation="false" CommandArgument="something" CommandName="RemoveStudent"

                                ImageUrl="~/Images/icons/delete_enabled16x16.png" /><%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "Display_Name") %>

                        </Template>

                    </ig:ItemTemplate>

                </Templates>

            </ig:WebDataTree>

 

Here is the relevant C# code:

        protected void Page_Load(object sender, EventArgs e)

        {

 

            if (!IsPostBack)

            {

                BindTree();

                BindGrid();

            }

        }

        private void BindTree()

        {            

            wdtCurricula.DataSource = GetReportsDS();            

            wdtCurricula.DataBind();

        }

        protected void wdtCurricula_NodeBound(object sender, DataTreeNodeEventArgs e)

        {

            DataTreeNode thisNode = e.Node;

            if (thisNode.Level == 0)

            {

                thisNode.TemplateId = Template1.TemplateID;               

            }

            else

            {

                thisNode.TemplateId = Template2.TemplateID;

            }

        }

 

        protected void wdtCurricula_ItemCommand(object sender, DataTreeCommandEventArgs e)

        {

            lblCommandName.Text = e.CommandName;

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

        }

 

Thanks!

Parents
  • 37874
    posted

    Hi jmakuch,

    Thank you for posting in our forum.

    I would suggest that you try to bind the WebDataTree on each page load and set EnableViewState to "false".

    Please let me know if this helps.

Reply Children