Note that there are some explanatory texts on larger screens.

plurals
  1. POwriting xml file for the checked values of treeview in asp.net
    primarykey
    data
    text
    <pre><code>&lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:TreeView ID="TreeView1" runat="server" ShowCheckBoxes="All" ShowLines="true" ShowExpandCollapse="true"&gt; &lt;Nodes&gt; &lt;asp:TreeNode Value="Child1" Expanded="True" Text="Server1"&gt; &lt;asp:TreeNode Value="Grandchild1" Text="MBS1" /&gt; &lt;asp:TreeNode Value="Grandchild2" Text="MBS2" /&gt; &lt;/asp:TreeNode&gt; &lt;asp:TreeNode Value="Child2" Text="Server2" /&gt; &lt;asp:TreeNode Value="Child3" Expanded="True" Text="MBS3"&gt; &lt;asp:TreeNode Value="Grandchild1" Text="MBS4" /&gt; &lt;/asp:TreeNode&gt; &lt;/Nodes&gt; &lt;/asp:TreeView&gt; &lt;/div&gt; &lt;p&gt; &lt;asp:Button ID="btnCreateXML" runat="server" onclick="btnCreateXML_Click" Text="Create XML" /&gt; &lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;/p&gt; &lt;/form&gt; </code></pre> <p>Code Behind:</p> <pre><code>using System.Xml; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { TreeView1.Attributes.Add("onclick", "javascript: OnTreeClick();"); } protected void btnCreateXML_Click(object sender, EventArgs e) { XmlDocument doc = new XmlDocument(); doc.Load(path); XmlNode Parent = doc.CreateElement("Parent"); XmlNode Child = doc.CreateElement("Child"); doc.Save(path); string temp; char[] al = new char[5]; foreach (TreeNode node in TreeView1.CheckedNodes) { //temp = (node.Text).ToString(); Child.InnerText = node.Text; Parent.AppendChild(Child); Response.Write(node.Text); // al[node] += al[node]; } } } </code></pre> <p>I do have asp.net TreeView control,when i do check the nodes, i can get those checked values from code behind on click event of btnCreateXML. The Values that I would get into the node.Text, I want to create XML file for it. How to acheive this(only for the selected nodes )? Any help would be greatful!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload