<%@ Page Title="" Language="C#" AutoEventWireup="true" CodeFile="ScriptFile.aspx.cs" Inherits="ScriptFile" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <asp:treeview ID="Treeview1" runat="server"></asp:treeview> </div> </form> </body> </html>
using System; using System.Data; using System.IO; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using MySql.Data.MySqlClient; public partial class ScriptFile : System.Web.UI.Page { string str; MySqlCommand com; protected void Page_Load(object sender, EventArgs e) { bindtreeview(); } void bindtreeview() { MySqlConnection con = new MySqlConnection("Data Source=localhost;Database=utaf;User ID=root;Password=admin;"); con.Open(); str = "Select * from scriptgeneratetable"; com = new MySqlCommand(str, con); MySqlDataReader reader = com.ExecuteReader(); com.Dispose(); string[,] ParentNode = new string[100, 2]; int count = 0; while (reader.Read()) { ParentNode[count, 0] = reader.GetValue(reader.GetOrdinal("Foldername")).ToString(); ParentNode[count++, 1] = reader.GetValue(reader.GetOrdinal("textfilename")).ToString(); } reader.Close(); } protected void MyTree_SelectedNodeChanged(object sender, EventArgs e) { } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)