0

I am using tree view in my web application, but I am using dynamic input text box when tree view data bind. The code is:

for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
    tables = node[0].ChildNodes[0].SelectNodes("col[@text='" + ds.Tables[0].Rows[i]["ModuleName"].ToString() + "']");
    TreeNode MyRoot = new TreeNode();
    string GUID = Guid.NewGuid().ToString();
    MyRoot.Text = " " + ds.Tables[0].Rows[i]["ModuleName"].ToString() + "  " + "<input type='text' id='" + GUID + "' />";
    MyRoot.Value = ds.Tables[0].Rows[i]["ModuleName"].ToString();
    if (RootNode != ds.Tables[0].Rows[i]["ModuleName"].ToString())
    {
        tv_GetMenu.Nodes.Add(MyRoot);

        RootNode = ds.Tables[0].Rows[i]["ModuleName"].ToString();
        var rows = from row in ds.Tables[0].AsEnumerable()
                   where row.Field<string>("ModuleName").Trim() == RootNode
                   select row;
        DataTable dt = new DataTable();
        dt = rows.CopyToDataTable();
        if (dt != null)
        {
            if (dt.Rows.Count > 0)
            {
                for (int j = 0; j < dt.Rows.Count; j++)
                {
                    string GUID1 = Guid.NewGuid().ToString();
                    TreeNode MyChild = new TreeNode();
                    if ((dt.Rows[j]["PageName"].ToString().Trim() != "Master Config") && (dt.Rows[j]["PageName"].ToString().Trim() != "Upload") && (dt.Rows[j]["PageName"].ToString().Trim() != "label configuration") && (dt.Rows[j]["PageName"].ToString().Trim() != "Dashboard Report"))
                    {
                        MyChild.Text = " " + dt.Rows[j]["PageName"].ToString() + "  " + "<input type='text' id='" + GUID1 + "' value='" + dt.Rows[j]["PageName"].ToString() + "'/>";
                        MyChild.Value = dt.Rows[j]["Address"].ToString();
                        MyRoot.ChildNodes.Add(MyChild);
                    }
                }
            }
        }
    }

}

The above code is working properly, but when I run the application and enter value in dynamic created text box then I am not getting this text box value for saving at run time. How we can access this value at run time?

Frank Boyne
  • 4,400
  • 23
  • 30
Pwavel002
  • 279
  • 2
  • 10

0 Answers0