asp.net动态生成TreeView
using System;
using System.Data;
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 System.Data.SqlClient;
public partial class left : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
GetTreeView();
}
private void GetTreeView()
{
try
{
string connectionstring = "Server=(local);uid=sa;pwd=123456;database=web";//连接SQL数据库
SqlConnection conn = new SqlConnection(connectionstring);
string sql = "select * from menu where menu_level=1 and parent_id =0";//查询一级节点
SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);
DataSet ds1 = new DataSet();
adapter.Fill(ds1, "temp");
DataTable table1 = ds1.Tables["temp"];//把读取的数据放入DATATABLE中
TreeView1.Nodes.Clear();//建立根节点,遍历。
foreach (DataRow dr1 in table1.Rows)
{
TreeNode root = new TreeNode();
&
相关文档:
在gridview中
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
<asp:TemplateField HeaderText="Remove">
&nbs ......
1.Application:用于保存所有用户共用的数据信息。 在Asp.Net中类似的配置数据最好保存在Web.config文件中。如果使用Application对象,一个需要考虑的问题是任何写操作都要在 Application_OnStart事件(global.asax)中完成。尽管使用Application.Lock和 Application.Unlock方法来避免写操作的同步,但是它串行化了Applicat ......
引自: http://renhappy20066.blog.163.com/blog/static/112080786200961172521923/
ASP.NET页面重定向方法小结
asp.net 2009-07-11 07:25 阅读54 评论0
字号: 大大 中中 小小
页面重定向的使用很多,实现方法也有不同,自己也试过几种,现在总结一下。 ......
//部署桌面快捷方式*******************#region//部署桌面快捷方式*******************
StreamWriter sw2=System.IO.File.CreateText(Context.Parameters["des"].ToString()+"WebSetupTest.url");
stateSaver.Add("DeskQuick",Context.Parameters["des"].ToString() ......