Skip to content

Attributes missing after postback

New Discussion
alejandro
alejandro asked on May 13, 2011 9:09 PM

I’m using the WebDataTree and when I’m creating programatically the structure I’m also creating custom attributes for the nodes, the first time the page is renderered the attributes are rendered too, but when a postback occur, the attributes are missing.

I’m not overriding, or deleting the attributes, they just dissapear.

Is there a solution, or maybe I’m doing something wrong?

Thanks in advance for the help.

Sign In to post a reply

Replies

  • 0
    [Infragistics] Surya
    [Infragistics] Surya answered on Feb 17, 2011 4:54 PM

    Hello,

    If you can provide me with a sample that demonstrates the behavior you are seeing then I can look into why the attributes are missing after postback.

    • 0
      alejandro
      alejandro answered on Feb 17, 2011 5:57 PM

      This is what I have in the page load:

      if (!IsPostBack)        {

              foreach (var nodeStructure in ListStructure)

                      {

                          DataTreeNode nodo = new DataTreeNode();

                          nodo.Attributes.Add("Estructura", nodeStructure.Id.ToString());

                          nodo.Text = nodeStructure.Nombre;

                          LoadHierarchy(nodo, nodeStructure);

                          tree.Nodes.Add(nodo);
                      }

      var nodes = from DataTreeNode nodo in tree.AllNodes
                                  where !string.IsNullOrEmpty(nodo.Key)
                                  select nodo;

                      int order = 1;
                      foreach (DataTreeNode nodo in nodes)
                      {
                          nodo.Attributes.Add("Order", order.ToString());
                          order++;
                      }

      }

      And this is the recursive method:

      private void LoadHierarchy(DataTreeNode nodoPadre, ModuloContenido contenidoPadre)
          {
              foreach (var nodoContenidoHijo in contenidoPadre.ColModuloContenidoHijos)
              {
                  DataTreeNode nodoHijo = new DataTreeNode();
                  nodoHijo.Attributes.Add("Estructura", nodoContenidoHijo.IdModuloContenido.ToString());
                  nodoHijo.Text = nodoContenidoHijo.Nombre;
                  ArmarJerarquia(nodoHijo, nodoContenidoHijo);
                  nodoPadre.Nodes.Add(nodoHijo);
              }
          }

      After a click in the node, the attributes are missing, but not all of them, the "Order" attribute still remains.

      Thanks in advance for the help.

       

  • 0
    alejandro
    alejandro answered on Feb 24, 2011 4:39 PM

    Please I need this urgent. I'm waiting for many days.

    Thanks.

    • 0
      [Infragistics] Surya
      [Infragistics] Surya answered on Feb 24, 2011 10:31 PM

      Hello,

      I am working on this issue. I will update you by the end of the day tomorrow.

      Please let me know if you have any questions regarding this issue

    • 0
      [Infragistics] Surya
      [Infragistics] Surya answered on Feb 25, 2011 9:01 PM

      Hello,

      The custom attributes are expected to be lost after postback. You need to change your logic to apply the custom attributes to the WebDataTree objects on every postback.

      Please let me know if you have any further questions regarding this matter.

       

  • 0
    [Infragistics] Surya
    [Infragistics] Surya answered on Mar 3, 2011 10:54 PM

    Hello,

    Were you able to resolve the issue?

    Please let me know if you have any questions regarding this matter.

    • 0
      Charles
      Charles answered on May 13, 2011 9:09 PM

      Hello,

      I am having an issue with a custom node attribute not being persisted (available) during postback of the page. I am already using node text, key and value for other values. I have hacked the tooltip to hold the data but that is not a clean solution. Please advise how I can persist an important string value associated with each node on postback.

      Thanks,

      Charlie

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
alejandro
Favorites
0
Replies
7
Created On
May 13, 2011
Last Post
15 years, 4 months ago

Suggested Discussions

Created by

Created on

May 13, 2011 9:09 PM

Last activity on

Feb 24, 2026 1:32 PM