WebForm中TreeView的使用
protected void Page_Load(object sender, EventArgs e)
{
DatabaseBind();
TreeView1.ShowLines = true;
TreeView1.ExpandDepth = 1;
}
public void DatabaseBind()
{
string connName = ConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
SqlConnection conn = new SqlConnection(connName);
string sql = "select * from Employees";
SqlDataAdapter sda =new SqlDataAdapter (sql, conn);
DataSet ds = new DataSet();
sda.Fill(ds, "Employees");
TreeNode tree1 = new TreeNode("雇员信息");
TreeView1.Nodes.Add(tree1);
for (int i = 0; i < ds.Tables["Employees"].Rows.Count; i++)
{
TreeNode tree2 = new TreeNode(ds.Tables["Employees"].Rows[i][1].ToString(),
ds.Tables["Employees"].Rows[1][1].ToString());
tree1.ChildNodes.Add(tree2);
for (int j = 0; j <ds.Tables["Employees"].Columns.Count ; j++)
{
TreeNode tree3 = new TreeNode(ds.Tables["Employees"].Rows[i][j].ToString(),
ds.Tables["Employees"].Rows[i][j].ToString());
tree2.ChildNodes.Add(tree3);
}
}
}
WebForm中TreeView的使用的更多相关文章
- webform 中使用ajax
常用的方式有 js –> WebService , js->*.ashx, js->WebAPI, js->MVC Controller->Action. 前两种就不说 ...
- webform中使用webapi,并且使用autofac
private void AutofacIoCRegister() { HttpConfiguration config = GlobalConfiguration.Configuration; if ...
- 【Ext.Net学习笔记】01:在ASP.NET WebForm中使用Ext.Net
Ext.NET是基于跨浏览器的ExtJS库和.NET Framework的一套支持ASP.NET AJAX的开源Web控件,包含有丰富的Ajax运用,其前身是Coolite. 下载地址:http:// ...
- 在ASP.NET非MVC环境中(WebForm中)构造MVC的URL参数
目前项目中有个需求,需要在WebForm中去构造MVC的URL信息,这里写了一个帮助类可以在ASP.NET非MVC环境中(WebForm中)构造MVC的URL信息,主要就是借助当前Http上下文去构造 ...
- Ext.Net学习笔记01:在ASP.NET WebForm中使用Ext.Net
Ext.Net是一个对ExtJS进行封装了的.net控件库,可以在ASP.NET WebForm和MVC中使用.从今天开始记录我的学习笔记,这是第一篇,今天学习了如何在WebForm中使用Ext.Ne ...
- ASP.NET WebForm中前台代码如何绑定后台变量
转载自 http://www.cnblogs.com/lerit/archive/2010/10/22/1858007.html 经常会碰到在前台代码中要使用(或绑定)后台代码中变量值的问题.一般有& ...
- 返璞归真 asp.net mvc (11) - asp.net mvc 4.0 新特性之自宿主 Web API, 在 WebForm 中提供 Web API, 通过 Web API 上传文件, .net 4.5 带来的更方便的异步操作
原文:返璞归真 asp.net mvc (11) - asp.net mvc 4.0 新特性之自宿主 Web API, 在 WebForm 中提供 Web API, 通过 Web API 上传文件, ...
- c#中treeview的使用方法(转 )
本文主要介绍treeView控件中,添加,修改.删除节点的操作, 首先当窗体加载的时候,我们添加上图中所示的节点. 当点击“Delete the Selected”按钮时,被选中的节点将被删除. 当点 ...
- WPF中TreeView.BringIntoView方法的替代方案
原文:WPF中TreeView.BringIntoView方法的替代方案 WPF中TreeView.BringIntoView方法的替代方案 周银辉 WPF中TreeView.BringIntoVie ...
随机推荐
- [Whole Web, Nods.js, PM2] Passing environment variables to node.js using pm2
learn how to pass environment variables to your node.js app using the pm2 config file. This is usefu ...
- android112 jni 把java的字符串转换成c的字符串,数组处理
package com.itheima.charencode; import android.os.Bundle; import android.app.Activity; import androi ...
- AFNetworking 3.0迁移指南
AFNetworking是一款在OS X和iOS下都令人喜爱的网络库.为了迎合iOS新版本的升级, AFNetworking在3.0版本中删除了基于 NSURLConnection API的所有支持. ...
- iOS之AVPlayer的简单应用
1.引入系统框架 2.创建视频的url 3.创建播放项目 4.初始化播放器 5.设置播放页面 //引入系统文件 #import <AVFoundation/AVFoundation.h> ...
- oracle Form Builer:ID_NULL Built-in
Description Returns a BOOLEAN va ...
- AWS ElastiCache 使用笔记
使用 AWS 管理控制台创建 Redis 缓存集群 创建子网组 在 Amazon VPC 中创建集群,则您必须指定缓存子网组.ElastiCache 使用该缓存子网组选择一个子网和此子网内的 IP 地 ...
- CentOS6.4安装ati显卡驱动
台式机安装CentOS 6.4 x86_64位 集成显卡ati4290 CentOS的release notes上: The proprietary drivers for older AMD ( ...
- C# winCE连接SQL数据库
General network error. Check your network documentation. 错误解决方法 1. public static string Sqlstr = &q ...
- DI(依赖注入)简单理解 NO1
依赖注入:目的削减程序的耦合度,达到高内聚/低耦合 常用形式:Interface Driven Design接口驱动,接口驱动有很多好处,可以提供不同灵活的子类实现,增加代码稳定和健壮性等等.通过Io ...
- 20151217jqueryUI--自动补全工具
自动补全(autocomplete),是一个可以减少用户输入完整信息的 UI 工具.一般在输入邮箱.搜索关键字等,然后提取出相应完整字符串供用户选择.一. 调用 autocomplete()方法 $( ...