自己做的一个项目中所运用到的技术:|
1. 日历控件(带时分秒)
2. GridView 批量删除,自定义分页,定位页码
3. GridView 修改
4. GridView
鼠标经过改变行的颜色
效果如下:
HTML:
<%
@ Page Language
=
"
C#
"
AutoEventWireup
=
"
true
"
CodeFile
=
"
StfCmpManager.aspx.cs
"
Inherits
=
"
StfCmpManager
"
%>
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
<!
DOCTYPE html PUBLIC
"
-//W3C//DTD XHTML 1.0 Transitional//EN
"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
"
>
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
<
html xmlns
=
"
http://www.w3.org/1999/xhtml
"
>
<
head id
=
"
Head1
"
runat
=
"
server
"
>
<
title
>
合作商信息维护
</
title
>
<
script language
=
"
javascript
"
type
=
"
text/javascript
"
>
//
判断多选是否与选中项(没有选中的返回false)
function slcNo_click()
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
...
{
if (document.form1.checkboxname.length)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
for (var i=0;i<document.form1.checkboxname.length;i++)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
if(document.form1.checkboxname[i].checked)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
return true;
}
}
}
else
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
if(document.form1.checkboxname.checked)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
return true;
}
}
alert("请选择后再操作!");
return false;
}
//
鼠标经过改变行的颜色
if
(
!
objbeforeItem)
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
...
{
var objbeforeItem=null;
var objbeforeItembackgroundColor=null;
}
function ItemOver(obj)
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
...
{
if(objbeforeItem)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
objbeforeItem.style.backgroundColor = objbeforeItembackgroundColor;
}
objbeforeItembackgroundColor = obj.style.backgroundColor;
objbeforeItem = obj;
obj.style.backgroundColor = "#B9D1F3";
}
//
//
多选的全选与取消
function checkJs(boolvalue)
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
...
{
if(document.all.checkboxname.length>1)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
for(var i=0;i<document.all.checkboxname.length;i++)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
document.all.checkboxname[i].checked = boolvalue;
}
}
else
document.all.checkboxname.checked = boolvalue;
}
//
//
只有全部选中时“全选”选中
function SingleCheckJs()
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
...
{
var flag1=false;
var flag2=false;
if (document.form1.checkboxname.length)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
for (var i=0;i<document.form1.checkboxname.length;i++)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
if(document.form1.checkboxname[i].checked)
flag1 = true;
else
flag2 = true;
}
}
else
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
if(document.form1.checkboxname.checked)
flag1 = true;
else
flag2 = true;
}
if(flag1==true&&flag2==false)
document.getElementById("chk").checked = true;
else
document.getElementById("chk").checked = false;
}
</
script
>
<
script type
=
"
text/javascript
"
language
=
"
javascript
"
src
=
"
Selecttime/calendar.js
"
></
script
>
</
head
>
<
body
>
<
form id
=
"
form1
"
runat
=
"
server
"
>
<
table id
=
"
Table10
"
cellSpacing
=
"
0
"
cellPadding
=
"
0
"
border
=
"
0
"
Style
=
"
z-index: 103;
left: 21px; position: absolute; top: 20px; width:
90
%
;
"
>
<
tr
>
<
td bgColor
=
"
#fafafa
"
>
<
FIELDSET style
=
"
BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; BORDER-BOTTOM: #cccccc 1px solid; HEIGHT: 45px
"
><
LEGEND
><
FONT face
=
"
宋体
"
size
=
"
2
"
>
合作商查询
</
FONT
></
LEGEND
>
<
table id
=
"
Table1
"
height
=
"
40
"
cellSpacing
=
"
0
"
cellPadding
=
"
0
"
width
=
"
100%
"
align
=
"
center
"
border
=
"
0
"
>
<
tr
>
<
td height
=
"
30
"
><
FONT face
=
"
宋体
"
>&
nbsp;
</
FONT
><
FONT face
=
"
宋体
"
>&
nbsp;合作商名称
<
asp:textbox id
=
"
TStfName
"
runat
=
"
server
"
BorderStyle
=
"
Groove
"
Width
=
"
144px
"
></
asp:textbox
>&
nbsp;
</
FONT
></
td
>
</
tr
>
<
tr
>
<
td style
=
"
height: 30px
"
>&
nbsp;
<
FONT face
=
"
宋体
"
>
添加时间
</
FONT
>
<
asp:textbox id
=
"
StartTime
"
onfocus
=
"
setday(this)
"
runat
=
"
server
"
Width
=
"
159px
"
></
asp:textbox
>&
nbsp;到
<
asp:textbox id
=
"
EndTime
"
onfocus
=
"
setday(this)
"
runat
=
"
server
"
Width
=
"
160px
"
></
asp:textbox
>&
nbsp;
&
nbsp;
&
nbsp;
<
FONT face
=
"
Times New Roman
"
>&
nbsp;
&
nbsp;
&
nbsp;
</
FONT
></
td
>
</
tr
>
<
TR
>
<
TD height
=
"
30
"
><
FONT face
=
"
宋体
"
>&
nbsp;
&
nbsp;
&
nbsp;
&
nbsp;
&
nbsp;
&
nbsp;
<
FONT face
=
"
宋体
"
>
<
asp:button id
=
"
SelectClient
"
runat
=
"
server
"
Text
=
"
搜 索
"
onclick
=
"
SelectClient_Click
"
></
asp:button
>&
nbsp;
&
nbsp;
&
nbsp;
</
FONT
></
FONT
></
TD
>
</
TR
>
</
table
>
</
FIELDSET
>
</
td
>
</
tr
>
</
table
>
<
table cellpadding
=
"
0
"
cellspacing
=
"
0
"
border
=
"
0
"
Style
=
"
z-index: 103;
left: 21px; position: absolute; top: 140px; width:
90
%
;
"
>
<
tr bgColor
=
"
#6B696B
"
>
<
td align
=
"
center
"
style
=
"
width: 85%
"
>
<
asp:GridView ID
=
"
GridView1
"
runat
=
"
server
"
Width
=
"
100%
"
CellPadding
=
"
4
"
ForeColor
=
"
#333333
"
AutoGenerateColumns
=
"
False
"
AllowPaging
=
"
True
"
BorderColor
=
"
Silver
"
BorderStyle
=
"
Solid
"
BorderWidth
=
"
1px
"
OnRowDataBound
=
"
GridView1_RowDataBound
"
ShowFooter
=
"
false
"
EmptyDataText
=
"
没有数据记录!!
"
AllowSorting
=
"
True
"
OnSorting
=
"
GridView1_Sorting
"
>
<
Columns
>
<
asp:BoundField HeaderText
=
"
编号
"
DataField
=
"
id
"
Visible
=
"
False
"
/>
<
asp:TemplateField HeaderText
=
"
<input type='checkbox' id='chk' name='chk' οnclick='checkJs(this.checked);' />全选
"
>
<
ItemTemplate
>
<
input type
=
"
checkbox
"
id
=
"
checkboxname
"
name
=
"
checkboxname
"
value
=
'
<%# DataBinder.Eval(Container.DataItem, "StfId")%>
'
onclick
=
'
SingleCheckJs();
'
/>
</
ItemTemplate
>
</
asp:TemplateField
>
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
<
asp:TemplateField HeaderText
=
"
序号
"
>
<
ItemTemplate
>
<%
# (Container.DataItemIndex
+
1
).ToString()
%>
</
ItemTemplate
>
</
asp:TemplateField
>
<
asp:TemplateField HeaderText
=
"
充值
"
>
<
ItemTemplate
>
<%
#GetClientVisitInfoShowCmpMoney(DataBinder.Eval(Container.DataItem,
"
StfId
"
),DataBinder.Eval(Container.DataItem,
"
StfName
"
))
%>
</
ItemTemplate
>
</
asp:TemplateField
>
<
asp:BoundField HeaderText
=
"
公司名称
"
DataField
=
"
StfCmpName
"
SortExpression
=
"
StfCmpName
"
/>
<
asp:BoundField HeaderText
=
"
登陆名
"
DataField
=
"
StfName
"
SortExpression
=
"
StfName
"
/>
<
asp:BoundField HeaderText
=
"
帐户金额
"
DataField
=
"
StfCmpMoney
"
SortExpression
=
"
StfCmpMoney
"
/>
<
asp:BoundField HeaderText
=
"
帐户Q币
"
DataField
=
"
StfQbmoney
"
SortExpression
=
"
StfQbmoney
"
/>
<
asp:BoundField HeaderText
=
"
合作日期
"
DataField
=
"
StfRegisterTime
"
HtmlEncode
=
"
False
"
SortExpression
=
"
StfRegisterTime
"
/>
<
asp:TemplateField HeaderText
=
"
操作
"
>
<
ItemTemplate
>
<%
#GetClientVisitInfoShowAnchorStr(DataBinder.Eval(Container.DataItem,
"
StfId
"
),DataBinder.Eval(Container.DataItem,
"
StfName
"
))
%>
</
ItemTemplate
>
</
asp:TemplateField
>
</
Columns
>
<
RowStyle BackColor
=
"
#F7F6F3
"
ForeColor
=
"
#333333
"
/>
<
EditRowStyle BackColor
=
"
#999999
"
/>
<
SelectedRowStyle BackColor
=
"
#E2DED6
"
Font
-
Bold
=
"
True
"
ForeColor
=
"
#333333
"
/>
<
PagerStyle BackColor
=
"
#284775
"
ForeColor
=
"
White
"
HorizontalAlign
=
"
Center
"
/>
<
AlternatingRowStyle BackColor
=
"
White
"
ForeColor
=
"
#284775
"
/>
<
PagerSettings Visible
=
"
False
"
/>
<
HeaderStyle Font
-
Bold
=
"
False
"
Font
-
Italic
=
"
False
"
/>
</
asp:GridView
>
</
td
>
</
tr
>
<
tr
>
<
td align
=
"
center
"
style
=
"
height: 25px; width: 569px;
"
>
<
asp:LinkButton ID
=
"
btnFirst
"
CommandArgument
=
"
first
"
OnClick
=
"
PagerButtonClick
"
runat
=
"
server
"
>
首 页
</
asp:LinkButton
>&
nbsp;
<
asp:LinkButton ID
=
"
btnPrev
"
CommandArgument
=
"
prev
"
OnClick
=
"
PagerButtonClick
"
runat
=
"
server
"
>
上一页
</
asp:LinkButton
>
<
asp:LinkButton ID
=
"
btnNext
"
CommandArgument
=
"
next
"
OnClick
=
"
PagerButtonClick
"
runat
=
"
server
"
>
下一页
</
asp:LinkButton
>
<
asp:LinkButton ID
=
"
btnLast
"
CommandArgument
=
"
last
"
OnClick
=
"
PagerButtonClick
"
runat
=
"
server
"
>
尾 页
</
asp:LinkButton
>
<
asp:Label ID
=
"
LblCurrentIndex
"
runat
=
"
server
"
></
asp:Label
>
<
asp:Label ID
=
"
LblPageCount
"
runat
=
"
server
"
></
asp:Label
>
<
asp:Label ID
=
"
LblRecordCount
"
runat
=
"
server
"
></
asp:Label
>
跳转到第
<
asp:DropDownList ID
=
"
ddlCurrentPage
"
runat
=
"
server
"
AutoPostBack
=
"
True
"
OnSelectedIndexChanged
=
"
DropDownList1_SelectedIndexChanged
"
>
</
asp:DropDownList
>
页
</
td
>
<
tr
>
<
td style
=
"
width: 569px
"
>
&
nbsp;操作:
<
asp:Button ID
=
"
Button3
"
runat
=
"
server
"
OnClick
=
"
Button3_Click
"
Text
=
"
删除合作商
"
/>
</
td
>
</
tr
>
</
table
>
</
form
>
</
body
>
</
html
>
CS:
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;
![](https://i-blog.csdnimg.cn/blog_migrate/6810355c2f78c12e91b7997a8e8c583a.gif)
public
partial
class
StfCmpManager : System.Web.UI.Page
![](https://i-blog.csdnimg.cn/blog_migrate/a41954a27d6ad96fa2c2cf816e677448.gif)
...
{
protected void Page_Load(object sender, System.EventArgs e)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
string StfRight = "";
// 在此处放置用户代码以初始化页面
if (Session["UserId"] == null)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
Response.Write("<script language='javascript'>alert('工作超时,请重新登录。');top.window.location='default.aspx';</script>");
return;
}
else
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
StfRight = Session["UserRight"].ToString().Trim();
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
if (!this.IsPostBack)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
if (StfRight != "7" && StfRight != "8")
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
Response.Write("<script language='javascript'>alert('你没有权限察看此页。');top.window.location='default.aspx';</script>");
return;
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
GridViewBind("");
}
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
}
private void GridViewBind(string Sqlsort)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
string where = string.Empty;
where = "and a.StfRight='6' and a.StfId=b.Stfid";
if (TStfName.Text.Trim() != "")
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
where += " and a.StfCmpName like '%" + TStfName.Text.Trim() + "%'";
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
if (StartTime.Text.Trim() != "")
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
where += " and a.StfRegistertime >= '" + StartTime.Text + "'";
}
if (EndTime.Text.Trim() != "")
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
where += " and a.StfRegistertime <= '" + EndTime.Text + "'";
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
if (where != string.Empty)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
where = "Where " + where.Substring(4);
}
string connStr = ConfigurationManager.AppSettings.Get("DataConnectionString");
string SqlStr = "Select a.StfId as StfId,a.StfName as StfName,a.StfRealName as StfRealName,a.StfCmpName as StfCmpName,b.StfCmpMoney as StfCmpMoney,b.StfQbmoney as StfQbmoney,a.StfRegistertime as StfRegistertime From TStafferInfo a,TCmpMoney b " + where + Sqlsort;
//Response.Write(SqlStr);
//Response.End();
DataSet ds = new DataSet();
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
try
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
SqlConnection conn = new SqlConnection(connStr);
if (conn.State.ToString() == "Closed") conn.Open();
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
SqlDataAdapter da = new SqlDataAdapter(SqlStr, conn);
da.Fill(ds, "TStafferInfo");
if (conn.State.ToString() == "Open") conn.Close();
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
GridView1.DataSource = ds.Tables[0].DefaultView;
GridView1.DataBind();
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
LblCurrentIndex.Text = "第 " + (GridView1.PageIndex + 1).ToString() + " 页";
LblPageCount.Text = "共 " + GridView1.PageCount.ToString() + " 页";
LblRecordCount.Text = "总共 " + ds.Tables[0].Rows.Count.ToString() + " 条";
if (ds.Tables[0].Rows.Count == 0)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
btnFirst.Visible = false;
btnPrev.Visible = false;
btnNext.Visible = false;
btnLast.Visible = false;
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
LblCurrentIndex.Visible = false;
LblPageCount.Visible = false;
LblRecordCount.Visible = false;
}
else if (GridView1.PageCount == 1)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
btnFirst.Visible = false;
btnPrev.Visible = false;
btnNext.Visible = false;
btnLast.Visible = false;
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
// 计算生成分页页码,分别为:"首 页" "上一页" "下一页" "尾 页"
btnFirst.CommandName = "1";
btnPrev.CommandName = (GridView1.PageIndex == 0 ? "1" : GridView1.PageIndex.ToString());
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
btnNext.CommandName = (GridView1.PageCount == 1 ? GridView1.PageCount.ToString() : (GridView1.PageIndex + 2).ToString());
btnLast.CommandName = GridView1.PageCount.ToString();
//
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
this.ddlCurrentPage.Items.Clear();
for (int i = 1; i <= this.GridView1.PageCount; i++)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
this.ddlCurrentPage.Items.Add(i.ToString());
}
this.ddlCurrentPage.SelectedIndex = this.GridView1.PageIndex;
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
}
catch (Exception ex)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
Response.Write("数据库错误,错误原因:" + ex.Message);
Response.End();
}
}
protected void PagerButtonClick(object sender, EventArgs e)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
GridView1.PageIndex = Convert.ToInt32(((LinkButton)sender).CommandName) - 1;
GridViewBind("");
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
e.Row.Attributes["onmouseover"] = "ItemOver(this)";
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
protected void Button1_Click(object sender, EventArgs e)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
Response.Write(Request.Form.Get("RadioName"));
}
protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
string sql = "";
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
if (ViewState["DataConnectionString"] == null || ViewState["DataConnectionString"].ToString().CompareTo("") == 0)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
ViewState["DataConnectionString"] = " desc";
}
else
ViewState["DataConnectionString"] = "";
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
sql = " order by " + e.SortExpression + ViewState["DataConnectionString"];
GridViewBind(sql);
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
//DataFormatString="{0:yyyy年MM月dd日 hh时mm分ss秒}"
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
this.GridView1.PageIndex = this.ddlCurrentPage.SelectedIndex;
GridViewBind("");
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
private bool CheckAddClientInfoForm()
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
int Tag = 0;
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
if (Tag == 1)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
Response.Write("<script>alert('请将带*项填写!')</script>");
return false;
}
if (Tag == 2)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
Response.Write("<script>alert('两次输入密码不同')</script>");
return false;
}
else
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
return true;
}
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
public string GetClientVisitInfoShowAnchorStr(object StfId, object StfName)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
string AnchorStr = "<a href='#'><Div οnclick='javascript:window.open("TManageModify.aspx?StfId=" + StfId + "&StfName=" + StfName + "","","height=280,Width=600,scrollbars=yes,resizable=yes,status=no")'>修改</Div></a>";
return AnchorStr;
}
public string GetClientVisitInfoShowCmpMoney(object StfId, object StfName)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
string AnchorStr = "<a href='#'><Div οnclick='javascript:window.open("StfCmpMoneyInfo.aspx?StfId=" + StfId + "&StfName=" + StfName + "","","height=250,Width=500,scrollbars=yes,resizable=yes,status=no")'>充值</Div></a>";
return AnchorStr;
}
protected void Button3_Click(object sender, EventArgs e)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
string str = "";
string[] ckb = null;
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
str = Request.Form.Get("checkboxname");
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
ckb = str.Split(new char[] ...{ ',' });
for (int i = 0; i < ckb.Length; i++)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{ //帐户和信息同时删除
string StrSql = " Delete TStafferInfo where StfId ='" + ckb[i] + "'";
String StrSql_d = " Delete TCmpMoneyInfo where StfId ='" + ckb[i] + "'";
SqlConnection Conn = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings.Get("DataConnectionString"));
SqlCommand Cmd = new System.Data.SqlClient.SqlCommand(StrSql, Conn);
SqlCommand Cmd_d = new System.Data.SqlClient.SqlCommand(StrSql_d, Conn);
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
Conn.Open();
SqlTransaction Trans = Conn.BeginTransaction();
try
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
Cmd.Transaction = Trans;
Cmd_d.Transaction = Trans;
Cmd.ExecuteNonQuery();
Cmd_d.ExecuteNonQuery();
Trans.Commit();
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
}
catch (Exception Err)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
Trans.Rollback();
Response.Write(Err.Message);
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
}
Response.Write("<script>window.close();alert('操作员删除成功!');</script>");
GridViewBind("");
}
![](https://i-blog.csdnimg.cn/blog_migrate/6a9c071a08f1dae2d3e1c512000eef41.gif)
protected void SelectClient_Click(object sender, EventArgs e)
![](https://i-blog.csdnimg.cn/blog_migrate/37c8bf68cdc3cc81759c34160776bc53.gif)
...{
GridViewBind("");
}
}
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1511765