易截截图软件、单文件、免安装、纯绿色、仅160KB

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();
  &


相关文档:

Asp.Net细节性问题精萃

1.<%=...%>与<%#... %>的区别:
   答:<%=...%>是在程序执行时调用,<%#... %>是在DataBind()方法之后被调用 
2.控件接收哪些类型数据? 
      答:接收Bind的控件,一般有DropDownList,DataList,DataGrid,ListBox这些集合性质 ......

ASP.NET中Repeater的嵌套、DetailsView的使用小例子

aspx页面代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ENRepeater.aspx.cs" Inherits="ENRepeater" %>
<!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" & ......

Asp.Net作用域

1.Application:用于保存所有用户共用的数据信息。 在Asp.Net中类似的配置数据最好保存在Web.config文件中。如果使用Application对象,一个需要考虑的问题是任何写操作都要在 Application_OnStart事件(global.asax)中完成。尽管使用Application.Lock和 Application.Unlock方法来避免写操作的同步,但是它串行化了Applicat ......

asp.net上传文件格式限制

if(MyFile.PostedFile.ContentType   !=   "image/gif"    
  &&   MyFile.PostedFile.ContentType   !=   "image/jpg"    
  &&   MyFile.PostedFile.ContentType   !=   "image/pjpeg"    
  && &n ......

asp.net 打印ReportViewer报表 rdlc报表

net 2.0中的新控件ReportViewer可以方便的制作并显示报表,但是它没有直接支持在网页中的打印。我在分析网页HTML源代码的基础上找到了直接打印的诀窍,先做成一个函数,方便直接使用。
    1.包含ReportViewer报表的网页的最终形式HTML DOM结构中,报表被放到一个<iframe>中,其id命名方式为: ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号