GridView自定义分页导航

自己做的一个项目中所运用到的技术:|

1. 日历控件(带时分秒)
2. GridView 批量删除,自定义分页,定位页码
3. GridView 修改
4. GridView 鼠标经过改变行的颜色
效果如下:
GridView自定义分页导航_第1张图片
HTML:
<% @PageLanguage = " C# " AutoEventWireup = " true " CodeFile = " StfCmpManager.aspx.cs " Inherits = " StfCmpManager " %>

<! DOCTYPEhtmlPUBLIC " -//W3C//DTDXHTML1.0Transitional//EN " " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >

< htmlxmlns = " http://www.w3.org/1999/xhtml " >
< headid = " Head1 " runat = " server " >
< title > 合作商信息维护 </ title >
< scriptlanguage = " javascript " type = " text/javascript " >
// 判断多选是否与选中项(没有选中的返回false)
functionslcNo_click()
... {
if(document.form1.checkboxname.length)
...{
for(vari=0;i<document.form1.checkboxname.length;i++)
...{
if(document.form1.checkboxname[i].checked)
...{
returntrue;
}

}

}

else
...{
if(document.form1.checkboxname.checked)
...{
returntrue;
}

}

alert(
"请选择后再操作!");
returnfalse;
}


// 鼠标经过改变行的颜色
if ( ! objbeforeItem)
... {
varobjbeforeItem
=null;
varobjbeforeItembackgroundColor
=null;
}

functionItemOver(obj)
... {
if(objbeforeItem)
...{
objbeforeItem.style.backgroundColor
=objbeforeItembackgroundColor;
}

objbeforeItembackgroundColor
=obj.style.backgroundColor;
objbeforeItem
=obj;
obj.style.backgroundColor
="#B9D1F3";
}

//

// 多选的全选与取消
functioncheckJs(boolvalue)
... {
if(document.all.checkboxname.length>1)
...{
for(vari=0;i<document.all.checkboxname.length;i++)
...{
document.all.checkboxname[i].
checked=boolvalue;
}

}

else
document.all.checkboxname.
checked=boolvalue;
}

//

// 只有全部选中时“全选”选中
functionSingleCheckJs()
... {
varflag1
=false;
varflag2
=false;

if(document.form1.checkboxname.length)
...{
for(vari=0;i<document.form1.checkboxname.length;i++)
...{
if(document.form1.checkboxname[i].checked)
flag1
=true;
else
flag2
=true;
}

}

else
...{
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 >
< scripttype = " text/javascript " language = " javascript " src = " Selecttime/calendar.js " ></ script >
</ head >
< body >
< formid = " form1 " runat = " server " >
< tableid = " Table10 " cellSpacing = " 0 " cellPadding = " 0 " border = " 0 " Style = " z-index:103;
left:21px;position:absolute;top:20px;width: 90 % ; " >
< tr >
< tdbgColor = " #fafafa " >
< FIELDSETstyle = " BORDER-RIGHT:#cccccc1pxsolid;BORDER-TOP:#cccccc1pxsolid;BORDER-LEFT:#cccccc1pxsolid;BORDER-BOTTOM:#cccccc1pxsolid;HEIGHT:45px " >< LEGEND >< FONTface = " 宋体 " size = " 2 " > 合作商查询 </ FONT ></ LEGEND >
< tableid = " Table1 " height = " 40 " cellSpacing = " 0 " cellPadding = " 0 " width = " 100% " align = " center "
border
= " 0 " >
< tr >
< tdheight = " 30 " >< FONTface = " 宋体 " >& nbsp; </ FONT >< FONTface = " 宋体 " >& nbsp;合作商名称
< asp:textboxid = " TStfName " runat = " server " BorderStyle = " Groove " Width = " 144px " ></ asp:textbox >& nbsp; </ FONT ></ td >
</ tr >
< tr >
< tdstyle = " height:30px " >& nbsp; < FONTface = " 宋体 " > 添加时间 </ FONT >
< asp:textboxid = " StartTime " onfocus = " setday(this) " runat = " server " Width = " 159px " ></ asp:textbox >& nbsp;到
< asp:textboxid = " EndTime " onfocus = " setday(this) " runat = " server " Width = " 160px " ></ asp:textbox >& nbsp; & nbsp; & nbsp; < FONTface = " TimesNewRoman " >& nbsp; & nbsp; & nbsp; </ FONT ></ td >
</ tr >
< TR >
< TDheight = " 30 " >< FONTface = " 宋体 " >& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; < FONTface = " 宋体 " >
< asp:buttonid = " SelectClient " runat = " server " Text = " 搜 索 " onclick = " SelectClient_Click " ></ asp:button >& nbsp; & nbsp; & nbsp; </ FONT ></ FONT ></ TD >
</ TR >
</ table >
</ FIELDSET >
</ td >
</ tr >
</ table >
< tablecellpadding = " 0 " cellspacing = " 0 " border = " 0 " Style = " z-index:103;
left:21px;position:absolute;top:140px;width: 90 % ; " >
< trbgColor = " #6B696B " >
< tdalign = " center " style = " width:85% " >
< asp:GridViewID = " 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:BoundFieldHeaderText = " 编号 " DataField = " id " Visible = " False " />
< asp:TemplateFieldHeaderText = " &lt;inputtype='checkbox'id='chk'name='chk'onclick='checkJs(this.checked);'/&gt;全选 " >
< ItemTemplate >
< inputtype = " checkbox " id = " checkboxname " name = " checkboxname " value = ' <%#DataBinder.Eval(Container.DataItem,"StfId")%> ' onclick = ' SingleCheckJs(); ' />
</ ItemTemplate >
</ asp:TemplateField >

< asp:TemplateFieldHeaderText = " 序号 " >
< ItemTemplate >
<% #(Container.DataItemIndex + 1 ).ToString() %>
</ ItemTemplate >
</ asp:TemplateField >
< asp:TemplateFieldHeaderText = " 充值 " >
< ItemTemplate >
<% #GetClientVisitInfoShowCmpMoney(DataBinder.Eval(Container.DataItem, " StfId " ),DataBinder.Eval(Container.DataItem, " StfName " )) %>
</ ItemTemplate >
</ asp:TemplateField > <br
分享到:
评论
varsoft
  • 浏览: 511588 次
  • 性别: Icon_minigender_1
  • 来自: 上海
文章分类
社区版块
存档分类
最新评论

你可能感兴趣的:(JavaScript,XHTML,asp)