网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

asp.net如何实现全部选中与取消操作

这篇文章主要介绍asp.net如何实现全部选中与取消操作,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

企业建站必须是能够以充分展现企业形象为主要目的,是企业文化与产品对外扩展宣传的重要窗口,一个合格的网站不仅仅能为公司带来巨大的互联网上的收集和信息发布平台,创新互联公司面向各种领域:成都门帘成都网站设计公司营销型网站解决方案、网站设计等建站排名服务。


前台代码


:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>



用户信息操作










后台代码:

复制代码 代码如下:


using System;
using System.Data;
using System.Configuration;
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;
using System.Text;
public partial class _Default : System.Web.UI.Page
{
string Straction = "";
protected void Page_Load(object sender, EventArgs e)
{
Straction = Request["action"];
if(Straction=="action")
{
UserInfo();
}
if (Straction == "Delete")
{
DeleteUser();
}
}
///


/// 周昕 2009-6-8号加载用户详细信息
///

public void UserInfo()
{
SqlConnection mycon = new SqlConnection();
mycon.ConnectionString = ConfigurationManager.ConnectionStrings["BoBoConn"].ToString();
string sql = "select * from loginuser";
SqlCommand mycom = new SqlCommand(sql, mycon);
mycon.Open();
SqlDataReader myda = mycom.ExecuteReader();
StringBuilder str = new StringBuilder();
str.Append("");
while (myda.Read())
{
str.Append("");
str.Append("");
str.Append("");
}
str.Append("
全选用户名用户全名
");
str.Append("
" + myda["UserName"].ToString() + "" + myda["FullName"].ToString() + "
");
str.Append("
");
Response.Clear();
Response.ContentType = "application/text";
Response.Write(str);
Response.End();
}
///
/// 周昕 2009-6-8 删除选中用户的详细信息
///

public void DeleteUser()
{
//获取用户ID
string strID = Request["userid"];
string Userid = strID.Substring(0, strID.Length - 1);
//转换成为数组
string[] stridArray = Userid.Trim().Split(',');
string sql = "delete from loginuser where ID='" + stridArray[0].ToString() + "'";
for (int i = 0; i < stridArray.Length; i++)
{
string id = stridArray[i].ToString();
sql += "or ID='" + id + "'";
}
SqlConnection mycon = new SqlConnection();
mycon.ConnectionString = ConfigurationManager.ConnectionStrings["BoBoConn"].ToString();
mycon.Open();
SqlCommand mycom = new SqlCommand(sql, mycon);
int n = (int)mycom.ExecuteNonQuery();
mycon.Close();
if (n > 0)
{
Response.Clear();
Response.ContentType = "application/text";
Response.Write("ok");
Response.End();
}
else
{
Response.Clear();
Response.ContentType = "application/text";
Response.Write("no");
Response.End();
}
}
}

以上是“asp.net如何实现全部选中与取消操作”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!


当前名称:asp.net如何实现全部选中与取消操作
文章位置:http://bjjierui.cn/article/ghjdhe.html

其他资讯