• 大小: 14KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-29
  • 语言: C#
  • 标签:

资源简介

ASP.net GridView双击事件,弹出一个窗口显示详细信息,模式窗口显示详细信息。

资源截图

代码片段和文件信息

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.xml.Linq;
using System.Data.SqlClient;


namespace WebApplication3
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender EventArgs e)
        {
            string str = “Data Source=.;Initial Catalog=SSMS;Integrated Security=True“;
            SqlConnection sqlcon = new SqlConnection(str);
            sqlcon.Open();
          ///  SqlCommand sqlmm = new SqlCommand();
            SqlDataAdapter sda = new SqlDataAdapter(“select stu_id as ‘ID‘stu_name as ‘姓名‘stu_sex as ‘性别‘stu_age as ‘年龄‘ from student_tb“sqlcon);
            DataTable dt = new DataTable();
            sda.Fill(dt);
            GridView1.DataSource = dt;
            GridView1.DataBind();
            
        }

       
        protected void GridView1_RowDataBound(object sender GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //鼠标移动到每项时颜色交替效果
                e.Row.Attributes.Add(“onmouseout“ “this.style.backgroundColor=‘White‘;this.style.color=‘#003399‘“);
                e.Row.Attributes.Add(“onmouseover“ “this.style.backgroundColor=‘#6699FF‘;this.style.color=‘#8C4510‘“);

                //单击/双击 事件
                e.Row.Attributes.Add(“ondblclick“ “DbClickEvent(‘“ + e.Row.Cells[0].Text + “‘)“);
               //   e.Row.Attributes.Add(“onclick“ “ClickEvent(‘“ + e.Row.Cells[1].Text + “‘)“);
                //stuID = e.Row.Cells[0].Text;
                // mmm(thise);
                //  e.Row.Attributes.Add(“onkeydown“ “GridViewItemKeyDownEvent(‘“ + e.Row.Cells[1].Text + “‘)“);
 
                //设置悬浮鼠标指针形状为“小手“
                e.Row.Attributes[“style“] = “Cursor:hand“;

            }
        }

    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2011-10-28 22:06  ASP.net GridView 双击事件\
     目录           0  2011-10-28 22:06  ASP.net GridView 双击事件\WebApplication3\
     文件         935  2011-10-28 08:41  ASP.net GridView 双击事件\WebApplication3.sln
     文件       25088  2011-10-28 10:59  ASP.net GridView 双击事件\WebApplication3.suo
     文件        1427  2011-10-28 11:03  ASP.net GridView 双击事件\WebApplication3\Default.aspx
     文件        2171  2011-10-28 11:02  ASP.net GridView 双击事件\WebApplication3\Default.aspx.cs
     文件        1199  2011-10-28 11:03  ASP.net GridView 双击事件\WebApplication3\Default.aspx.designer.cs
     目录           0  2011-10-28 22:06  ASP.net GridView 双击事件\WebApplication3\Properties\
     文件        1320  2011-10-28 08:41  ASP.net GridView 双击事件\WebApplication3\Properties\AssemblyInfo.cs
     文件        7302  2011-10-28 08:50  ASP.net GridView 双击事件\WebApplication3\Web.config
     文件        4423  2011-10-28 09:29  ASP.net GridView 双击事件\WebApplication3\WebApplication3.csproj
     文件        1225  2011-10-28 09:29  ASP.net GridView 双击事件\WebApplication3\WebApplication3.csproj.user
     文件         540  2011-10-28 10:55  ASP.net GridView 双击事件\WebApplication3\WebForm1.aspx
     文件        1330  2011-10-28 11:00  ASP.net GridView 双击事件\WebApplication3\WebForm1.aspx.cs
     文件        1199  2011-10-28 10:53  ASP.net GridView 双击事件\WebApplication3\WebForm1.aspx.designer.cs

评论

共有 条评论

相关资源