I want to create dynamic folders at run time. Folder names with be input via a TextBox and output will be displayed in a TreeView.
The form will submit if I enter the first folder name into textbox1 and click the "Add Folder" button. When I submit multiple folders with the same name the output should be an indexed increment of the name. Eg. FooFolder, FooFolder(2), FooFolder(3), etc.
If I delete FooFolder(2) and then recreate a folder with the name FooFolder, the folder should be FooFolder(2), and if I create one more folder then it should be FooFolder(4).
For deletion one can select the particular folder from the TreeView which will be displayed in TextBox2 and click the "Remove Folder" button.
Here is my presentation code:
<asp:Button ID="btnAddFolder" runat="server" Height="24px" Text="Add Folder"
Width="148px" onclick="btnAddFolder_Click" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:Button ID="btnRemoveFolder" runat="server" Text="Remove Folder" />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<br />
<asp:TreeView ID="TreeView1" runat="server" ImageSet="XPFileExplorer"
NodeIndent="15">
<ParentNodeStyle Font-Bold="False" />
<HoverNodeStyle Font-Underline="True" ForeColor="#6666AA" />
<SelectedNodeStyle BackColor="#B5B5B5" Font-Underline="False"
HorizontalPadding="0px" VerticalPadding="0px" />
<NodeStyle Font-Names="Tahoma" Font-Size="8pt" ForeColor="Black"
HorizontalPadding="2px" NodeSpacing="0px" VerticalPadding="2px" />
</asp:TreeView>
Now how do I write the code to do the work?