Hi,

I am trying to create a tree structure based on an XML. For each row,
I need to add couple of text boxes and a button for which I am using
HTML controls, which i am embedding dynamically as shown below. After
postback i am losing the values of the text box controls. How can I
retrieve the values of my text boxes after the post back operation. I
have added the runat=server option as well.

Also, please suggest if there is a better way to accomplish what i am
trying to do.

Regards,
Rao

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            int num = 0;
            // Add the root node
            TreeNode rootNode = new TreeNode("ROOT");
            // This is to prevent the postback operation
            rootNode.SelectAction = TreeNodeSelectAction.None;

            TreeView1.Nodes.Add(rootNode);

            TreeNode childNode = new TreeNode();
            StringBuilder nodeText =  new StringBuilder();
            // This is to prevent the postback operation when clicking
the name
            childNode.SelectAction = TreeNodeSelectAction.None;
            nodeText.Append("CHILD...TextBox1:");
            nodeText.Append(@"<input type='Text' id='CPU0' value='000'
runat='server' >");
            nodeText.Append(@"<input type='button' id='btn0'
value='Submit'  onclick='javascript:__doPostBack(\"btnAsp\",\"0\");'
runat='server' >");
            childNode.Text = nodeText.ToString();
            nodeTest.ChildNodes.Add(childNode);
        }

        if (Request.Form["__EVENTTARGET"] != null && Request.Form
["__EVENTTARGET"] == "btnAsp")
        {
            btnAsp_Click(null, null);
        }
    }

Reply via email to