`
380071587
  • 浏览: 449651 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

GridView自定义分页导航

 
阅读更多
导读:
  自己做的一个项目中所运用到的技术:|
  1. 日历控件(带时分秒)
  2. GridView 批量删除,自定义分页,定位页码
  3. GridView 修改
  4. GridView 鼠标经过改变行的颜色
  效果如下:
  
  
  HTML:
  
  
  <!--Page Language="C#" AutoEventWireup="true" CodeFile="StfCmpManager.aspx.cs" Inherits="StfCmpManager"-->
  
  
  
  <!--CTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt-->
  
  
  
  
  
  
  
  
  
  <script language="javascript" type="text/javascript"> <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" width=11> <BR>   <BR>  // 判断多选是否与选中项(没有选中的返回false) <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" width=11> <BR>  function slcNo_click() <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" width=11> <BR>   <BR>  ...{ <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  if (document.form1.checkboxname.length) <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" width=11> <BR>   <BR>  ...{ <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  for (var i=0i<DOCUMENT.FORM1.CHECKBOXNAME.LENGTH;I++) <br>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" width=11> <BR>   <BR>  ...{ <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  if(document.form1.checkboxname[i].checked) <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" width=11> <BR>   <BR>  ...{ <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  return true <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" width=11> <BR>  } <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" width=11> <BR>  } <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" width=11> <BR>  } <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>  else <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" width=11> <BR>  ...{ <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  if(document.form1.checkboxname.checked) <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" width=11> <BR>   <BR>  ...{ <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  return true <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" width=11> <BR>  } <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" width=11> <BR>  } <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>  alert("请选择后再操作!"); <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  return false <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" width=11> <BR>  } <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" width=11> <BR>   <BR>  // 鼠标经过改变行的颜色 <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" width=11> <BR>  if (!objbeforeItem) <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" width=11> <BR>   <BR>  ...{ <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  var objbeforeItem=null <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>  var objbeforeItembackgroundColor=null <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" width=11> <BR>  } <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" width=11> <BR>   <BR>  function ItemOver(obj) <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" width=11> <BR>   <BR>  ...{ <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  if(objbeforeItem) <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" width=11> <BR>   <BR>  ...{ <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  objbeforeItem.style.backgroundColor = objbeforeItembackgroundColor; <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" width=11> <BR>   <BR>  } <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>  objbeforeItembackgroundColor = obj.style.backgroundColor; <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  objbeforeItem = obj; <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  obj.style.backgroundColor = "#B9D1F3" <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" width=11> <BR>   <BR>  } <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" width=11> <BR>  // <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" width=11> <BR>   <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" width=11> <BR>   <BR>  // 多选的全选与取消 <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" width=11> <BR>  function checkJs(boolvalue) <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" width=11> <BR>   <BR>  ...{ <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  if(document.all.checkboxname.length>1) <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" width=11> <BR>   <BR>  ...{ <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  for(var i=0i<DOCUMENT.ALL.CHECKBOXNAME.LENGTH;I++) <br>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" width=11> <BR>   <BR>  ...{ <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  document.all.checkboxname[i].checked = boolvalue; <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" width=11> <BR>   <BR>  } <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" width=11> <BR>  } <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>  else <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>  document.all.checkboxname.checked = boolvalue; <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" width=11> <BR>   <BR>  } <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" width=11> <BR>  // <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" width=11> <BR>   <BR>  // 只有全部选中时“全选”选中 <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" width=11> <BR>  function SingleCheckJs() <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" width=11> <BR>   <BR>  ...{ <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  var flag1=false <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>  var flag2=false <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  if (document.form1.checkboxname.length) <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" width=11> <BR>   <BR>  ...{ <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  for (var i=0i<DOCUMENT.FORM1.CHECKBOXNAME.LENGTH;I++) <br>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" width=11> <BR>   <BR>  ...{ <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  if(document.form1.checkboxname[i].checked) <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  flag1 = true <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>  else <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>  flag2 = true <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" width=11> <BR>  } <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" width=11> <BR>  } <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>  else <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" width=11> <BR>  ...{ <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  if(document.form1.checkboxname.checked) <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  flag1 = true <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>  else <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>  flag2 = true <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" width=11> <BR>  } <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  if(flag1==true&&flag2==false) <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  document.getElementById("chk").checked = true <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>  else <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>  document.getElementById("chk").checked = false <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" width=11> <BR>  } <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif" width=11> <BR>   <BR>  </script>  
  <script type="text/javascript" language="javascript" src="Selecttime/calendar.js"></script>
  
  
  
  
  
  
  
  

  
   合作商查询
  
  

合作商名称
  
  
  <textbox id="TStfName" runat="server" width="144px" borderstyle="Groove"></textbox>
添加时间
  
  <textbox id="StartTime" onfocus="setday(this)" runat="server" width="159px"></textbox> 到
  
  
  <textbox id="EndTime" onfocus="setday(this)" runat="server" width="160px"></textbox>

  
  

  
  
  
  
  
  
  
  
  
  


  
  <gridview id="GridView1" runat="server" width="100%" forecolor="#333333" cellpadding="4">&lt;  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  AutoGenerateColumns="False" AllowPaging="True" BorderColor="Silver" <br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  BorderStyle="Solid" BorderWidth="1px" OnRowDataBound="GridView1_RowDataBound" <br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  ShowFooter="false" EmptyDataText="没有数据记录!!" AllowSorting="True" OnSorting="GridView1_Sorting"&gt; <br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  <columns></columns><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  <boundfield headertext="编号" datafield="id" visible="False"></boundfield><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  <templatefield images.csdn.net="" syntaxhighlighting="" width="11" outliningindicators="" headertext="&lt;INPUT id=chk onclick=checkJs(this.checked); type=checkbox name=chk &gt;全选?&gt; &lt;BR&gt;  &lt;IMG height=16 src="><br>  <itemtemplate></itemtemplate><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  <input id="checkboxname" onclick="SingleCheckJs();" type="checkbox" name="checkboxname" value='&lt;%# DataBinder.Eval(Container.DataItem, "StfId")%&gt;'><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>   <br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  </templatefield><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>   <br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  <templatefield headertext="序号"><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  <itemtemplate></itemtemplate><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  <!--(Container.DataItemIndex+1).ToString(--> <br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>   <br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  </templatefield><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  <templatefield headertext="充值"><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  <itemtemplate></itemtemplate><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  <!--etClientVisitInfoShowCmpMoney(DataBinder.Eval(Container.DataItem,"StfId"),DataBinder.Eval(Container.DataItem,"StfName")--> <br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>   <br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  </templatefield><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>   <br>  <boundfield headertext="公司名称" datafield="StfCmpName" sortexpression="StfCmpName"></boundfield><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  <boundfield headertext="登陆名" datafield="StfName" sortexpression="StfName"></boundfield><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  <boundfield headertext="帐户金额" datafield="StfCmpMoney" sortexpression="StfCmpMoney"></boundfield><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  <boundfield headertext="帐户Q币" datafield="StfQbmoney" sortexpression="StfQbmoney"></boundfield><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  <boundfield headertext="合作日期" datafield="StfRegisterTime" sortexpression="StfRegisterTime" htmlencode="False"></boundfield><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  <templatefield headertext="操作"><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  <itemtemplate></itemtemplate><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  <!--etClientVisitInfoShowAnchorStr(DataBinder.Eval(Container.DataItem,"StfId"),DataBinder.Eval(Container.DataItem,"StfName")--> <br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>   <br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  </templatefield><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>   <br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  <rowstyle forecolor="#333333" backcolor="#F7F6F3"></rowstyle><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  <editrowstyle backcolor="#999999"></editrowstyle><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  <selectedrowstyle forecolor="#333333" backcolor="#E2DED6" font-bold="True"></selectedrowstyle><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>   <pagerstyle forecolor="White" backcolor="#284775" horizontalalign="Center"></pagerstyle><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  <alternatingrowstyle forecolor="#284775" backcolor="White"></alternatingrowstyle><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>   <pagersettings visible="False"></pagersettings><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>   <headerstyle font-bold="False" font-italic="False"></headerstyle><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  </gridview>
  
  

  
  <linkbutton id="btnFirst" onclick="PagerButtonClick" commandargument="first">&lt;  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  runat="server"&gt;首 页</linkbutton><linkbutton id="btnPrev" onclick="PagerButtonClick" runat="server" commandargument="prev">上一页</linkbutton>
  
  <linkbutton id="btnNext" onclick="PagerButtonClick" runat="server" commandargument="next">下一页</linkbutton>
  
  <linkbutton id="btnLast" onclick="PagerButtonClick" runat="server" commandargument="last">尾 页</linkbutton>
  
  
  
  
  
  
  
  跳转到第<dropdownlist id="ddlCurrentPage" runat="server" autopostback="True" onselectedindexchanged="DropDownList1_SelectedIndexChanged"><br>  <img height="16" alt="" width="11" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"><br>  </dropdownlist>页

  
   操作:
  
  
  
  
  

  
  
  
  
  
  
  
  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;
  
  
  
  public partial class StfCmpManager : System.Web.UI.Page
  
  
  
  ...{
  
  
  protected void Page_Load(object sender, System.EventArgs e)
  
  
  
  
  ...{
  
  
  
  
  
  string StfRight = ""
  
  // 在此处放置用户代码以初始化页面
  
  if (Session["UserId"] == null)
  
  
  
  
  ...{
  
  
  Response.Write("<script language="javascript">alert('工作超时,请重新登录。');top.window.location='default.aspx';</script>");
  
  
  return
  
  }
  
  else
  
  
  
  ...{
  
  
  StfRight = Session["UserRight"].ToString().Trim();
  
  
  
  
  if (!this.IsPostBack)
  
  
  
  
  ...{
  
  
  
  
  
  if (StfRight != "7" && StfRight != "8")
  
  
  
  
  ...{
  
  
  Response.Write("<script language="javascript">alert('你没有权限察看此页。');top.window.location='default.aspx';</script>");
  
  
  return
  
  }
  
  
  
  GridViewBind("");
  
  
  }
  
  }
  
  
  
  }
  
  private void GridViewBind(string Sqlsort)
  
  
  
  
  ...{
  
  
  string where = string.Empty;
  
  
  where = "and a.StfRight='6' and a.StfId=b.Stfid"
  
  if (TStfName.Text.Trim() != "")
  
  
  
  
  ...{
  
  
  where += " and a.StfCmpName like '%" + TStfName.Text.Trim() + "%'"
  
  }
  
  
  
  
  
  if (StartTime.Text.Trim() != "")
  
  
  
  
  ...{
  
  
  where += " and a.StfRegistertime >= '" + StartTime.Text + "'"
  
  }
  
  if (EndTime.Text.Trim() != "")
  
  
  
  
  ...{
  
  
  where += " and a.StfRegistertime <= '" + EndTime.Text + "'"
  
  }
  
  
  
  if (where != string.Empty)
  
  
  
  
  ...{
  
  
  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();
  
  
  
  
  try
  
  
  
  ...{
  
  
  SqlConnection conn = new SqlConnection(connStr);
  
  
  if (conn.State.ToString() == "Closed") conn.Open();
  
  
  
  
  SqlDataAdapter da = new SqlDataAdapter(SqlStr, conn);
  
  
  da.Fill(ds, "TStafferInfo");
  
  
  if (conn.State.ToString() == "Open") conn.Close();
  
  
  
  
  GridView1.DataSource = ds.Tables[0].DefaultView;
  
  
  GridView1.DataBind();
  
  
  
  
  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)
  
  
  
  
  ...{
  
  
  btnFirst.Visible = false
  
  btnPrev.Visible = false
  
  btnNext.Visible = false
  
  btnLast.Visible = false
  
  
  
  LblCurrentIndex.Visible = false
  
  LblPageCount.Visible = false
  
  LblRecordCount.Visible = false
  
  }
  
  else if (GridView1.PageCount == 1)
  
  
  
  
  ...{
  
  
  btnFirst.Visible = false
  
  btnPrev.Visible = false
  
  btnNext.Visible = false
  
  btnLast.Visible = false
  
  }
  
  
  
  // 计算生成分页页码,分别为:"首 页" "上一页" "下一页" "尾 页"
  
  btnFirst.CommandName = "1"
  
  btnPrev.CommandName = (GridView1.PageIndex == 0 ? "1" : GridView1.PageIndex.ToString());
  
  
  
  
  btnNext.CommandName = (GridView1.PageCount == 1 ? GridView1.PageCount.ToString() : (GridView1.PageIndex + 2).ToString());
  
  
  btnLast.CommandName = GridView1.PageCount.ToString();
  
  
  //
  
  
  
  this.ddlCurrentPage.Items.Clear();
  
  
  for (int i = 1 i <= this.GridView1.PageCount; i++)
  
  
  
  
  ...{
  
  
  this.ddlCurrentPage.Items.Add(i.ToString());
  
  
  }
  
  this.ddlCurrentPage.SelectedIndex = this.GridView1.PageIndex;
  
  
  
  
  
  
  }
  
  catch (Exception ex)
  
  
  
  
  ...{
  
  
  Response.Write("数据库错误,错误原因:" + ex.Message);
  
  
  Response.End();
  
  
  }
  
  }
  
  protected void PagerButtonClick(object sender, EventArgs e)
  
  
  
  
  ...{
  
  
  GridView1.PageIndex = Convert.ToInt32(((LinkButton)sender).CommandName) - 1
  
  GridViewBind("");
  
  
  }
  
  
  
  protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  
  
  
  
  ...{
  
  
  e.Row.Attributes["onmouseover"] = "ItemOver(this)"
  
  }
  
  
  
  
  
  protected void Button1_Click(object sender, EventArgs e)
  
  
  
  
  ...{
  
  
  Response.Write(Request.Form.Get("RadioName"));
  
  
  }
  
  protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
  
  
  
  
  ...{
  
  
  string sql = ""
  
  
  
  if (ViewState["DataConnectionString"] == null || ViewState["DataConnectionString"].ToString().CompareTo("") == 0)
  
  
  
  
  ...{
  
  
  ViewState["DataConnectionString"] = " desc"
  
  }
  
  else
  
  ViewState["DataConnectionString"] = ""
  
  
  
  sql = " order by " + e.SortExpression + ViewState["DataConnectionString"];
  
  
  GridViewBind(sql);
  
  
  
  
  //DataFormatString="{0:yyyy年MM月dd日 hh时mm分ss秒}"
  
  }
  
  
  
  
  protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
  
  
  
  
  ...{
  
  
  this.GridView1.PageIndex = this.ddlCurrentPage.SelectedIndex;
  
  
  GridViewBind("");
  
  
  }
  
  
  
  private bool CheckAddClientInfoForm()
  
  
  
  
  ...{
  
  
  int Tag = 0
  
  
  
  
  
  
  
  if (Tag == 1)
  
  
  
  
  ...{
  
  
  
  
  Response.Write("<script script>?);>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  return false <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif" width=11> <BR>  } <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>  if (Tag == 2) <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif" width=11> <BR>   <BR>  ...{ <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  <IMG height=16 src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" width=11> <BR>   <BR>  Response.Write("<script>alert('两次输入密码不同')</script>");
  
  
  return false
  
  }
  
  else
  
  
  
  ...{
  
  
  return true
  
  }
  
  }
  
  
  
  public string GetClientVisitInfoShowAnchorStr(object StfId, object StfName)
  
  
  
  
  ...{
  
  
  string AnchorStr = "
修改
"
  
  return AnchorStr;
  
  
  }
  
  public string GetClientVisitInfoShowCmpMoney(object StfId, object StfName)
  
  
  
  
  ...{
  
  
  string AnchorStr = "
充值
"
  
  return AnchorStr;
  
  
  }
  
  protected void Button3_Click(object sender, EventArgs e)
  
  
  
  
  ...{
  
  
  string str = ""
  
  string[] ckb = null
  
  
  
  str = Request.Form.Get("checkboxname");
  
  
  
  
  ckb = str.Split(new char[] ...{ ',' });
  
  
  for (int i = 0 i < ckb.Length; i++)
  
  
  
  
  ...{ //帐户和信息同时删除
  
  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);
  
  
  
  
  Conn.Open();
  
  
  SqlTransaction Trans = Conn.BeginTransaction();
  
  
  try
  
  
  
  ...{
  
  
  Cmd.Transaction = Trans;
  
  
  Cmd_d.Transaction = Trans;
  
  
  Cmd.ExecuteNonQuery();
  
  
  Cmd_d.ExecuteNonQuery();
  
  
  Trans.Commit();
  
  
  
  
  }
  
  catch (Exception Err)
  
  
  
  
  ...{
  
  
  Trans.Rollback();
  
  
  Response.Write(Err.Message);
  
  
  }
  
  
  
  }
  
  Response.Write("?);>  
  
  GridViewBind("");
  
  
  }
  
  
  
  protected void SelectClient_Click(object sender, EventArgs e)
  
  
  
  
  ...{
  
  
  GridViewBind("");
  
  
  }
  
  
  
  
  }
  
  
  Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1511765
  
  Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1520093

本文转自
http://blog.csdn.net/heker2007/archive/2007/03/04/1520093.aspx
分享到:
评论

相关推荐

    ASP.NET GridView自定义分页支持拖拽控件合集

    基于ASP.NET的自定义分页显示及可拖动改变列宽代码 支持通过Url进行分页,支持Url分页方式下的Url重写(UrlRewrite)功能,支持使用用户自定义图片做为导航元素,功能强大灵活、使用方便、可定制性强,增强的 Visual...

    C#自定义分页控件

    三、AspNetPager分页控件本身并不显示任何数据,而只显示分页导航元素,数据在页面上的显示方式与该控件无关,所以需要手写数据连接方法来配合, 四、结合TOP 。。。NOT IN 的通用存储过程分页方法使用AspNetPager...

    能用漂亮分页控件及Demo源码

    Url重写技术可以使显示给用户的Url不同于实际的Url,Url重写技术被广泛应用于搜索引擎优化(SEO)、网站重组后重定向页面路径以及提供用户友好的Url等方面, AspNetPager支持Url重写技术使您可以自定义分页导航的Url...

    .NET 通用分页控件

    AspNetPager针对ASP.NET分页控件的不足,提出了与众不同的解决asp.net中分页问题的方案,即将分页导航功能与数据显示功能完全独立开来,由用户自己控制数据的获取及显示方式,因此可以被灵活地应用于任何需要实现...

    AspNetPager7.2分页控件及源码

    Url重写技术可以使显示给用户的Url不同于实际的Url,Url重写技术被广泛应用于搜索引擎优化(SEO)、网站重组后重定向页面路径以及提供用户友好的Url等方面, AspNetPager支持Url重写技术使您可以自定义分页导航的Url...

    九头鸭.net分页控件 v1.1.rar

    Url重写技术可以使显示给用户的Url不同于实际的Url,Url重写技术被广泛应用于搜索引擎优化(SEO)、网站重组后重定向页面路径以及提供用户友好的Url等方面, DataPage支持Url重写技术使您可以自定义分页导航的Url...

    九头鸭分页控件 Url分页方式

    Url重写技术可以使显示给用户的Url不同于实际的Url,Url重写技术被广泛应用于搜索引擎优化(SEO)、网站重组后重定向页面路径以及提供用户友好的Url等方面, DataPage支持Url重写技术使您可以自定义分页导航的Url...

    ASP.NET 各种分页技巧

    Url重写技术可以使显示给用户的Url不同于实际的Url,Url重写技术被广泛应用于搜索引擎优化(SEO)、网站重组后重定向页面路径以及提供用户友好的Url等方面, AspNetPager支持Url重写技术使您可以自定义分页导航的Url...

    AspNetPagerv7.4.1分页控件及Demo源码2012919

    Url重写技术可以使显示给用户的Url不同于实际的Url,Url重写技术被广泛应用于搜索引擎优化(SEO)、网站重组后重定向页面路径以及提供用户友好的Url等方面, AspNetPager支持Url重写技术使您可以自定义分页导航的Url...

    九头鸭.net分页控件DataPage.rar

    Url重写技术可以使显示给用户的Url不同于实际的Url,Url重写技术被广泛应用于搜索引擎优化(SEO)、网站重组后重定向页面路径以及提供用户友好的Url等方面, DataPage支持Url重写技术使您可以自定义分页导航的Url...

    AspNetPager7.2分页控件及Demo源码

    Url重写技术可以使显示给用户的Url不同于实际的Url,Url重写技术被广泛应用于搜索引擎优化(SEO)、网站重组后重定向页面路径以及提供用户友好的Url等方面, AspNetPager支持Url重写技术使您可以自定义分页导航的Url...

    AspNetPager7.2 分页控件及Demo源码

    AspNetPager针对ASP.NET分页控件的不足,提出了与众不同的解决asp.net中分页问题的方案,即将分页导航功能与数据显示功能完全独立开来,由用户自己控制数据的获取及显示方式,因此可以被灵活地应用于任何需要实现...

    九头鸭分页控件源码

    Url重写技术可以使显示给用户的Url不同于实际的Url,Url重写技术被广泛应用于搜索引擎优化(SEO)、网站重组后重定向页面路径以及提供用户友好的Url等方面, DataPage支持Url重写技术使您可以自定义分页导航的Url...

    Asp.net分页控件AspNetPager7.2

    AspNetPager针对ASP.NET分页控件的不足,提出了与众不同的解决asp.net中分页问题的方案,即将分页导航功能与数据显示功能完全独立开来,由用户自己控制数据的获取及显示方式,因此可以被灵活地应用于任何需要实现...

    分页AspNetPager

    三、AspNetPager分页控件本身并不显示任何数据,而只显示分页导航元素,数据在页面上的显示方式与该控件无关,所以需要手写数据连接方法来配合, 四、结合TOP 。。。NOT IN 的通用存储过程分页方法使用AspNetPager...

    分页控件AspNetPager7.2c#源码

    AspNetPager针对ASP.NET分页控件的不足,提出了与众不同的解决asp.net中分页问题的方案,即将分页导航功能与数据显示功能完全独立开来,由用户自己控制数据的获取及显示方式,因此可以被灵活地应用于任何需要实现...

    AspNetPager 分页控件

    AspNetPager针对ASP.NET分页控件的不足,提出了与众不同的解决asp.net中分页问题的方案,即将分页导航功能与数据显示功能完全独立开来,由用户自己控制数据的获取及显示方式,因此可以被灵活地应用于任何需要实现...

Global site tag (gtag.js) - Google Analytics