欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
C# GridView詳解
  • 前臺代碼

Java代碼
 
  1. <!--id用于綁定數據的標識,-->   
  2. <asp:GridView ID="gvLog" runat="server" AutoGenerateColumns="False" CellPadding="3" CellSpacing="1"  
  3.     Width="100%" BackColor="#F3F3F3" BorderWidth="0px" OnRowDeleting="gvLog_RowDeleting" OnRowDataBound="gvLog_RowDataBound">   
  4.     <RowStyle BackColor="White" />   
  5.     <Columns>   
  6.      <!--綁定列-->   
  7.         <asp:BoundField DataField="OperId" >   
  8.             <ItemStyle CssClass="display:none;" />   
  9.         </asp:BoundField>   
  10.         <asp:BoundField HeaderText="No">   
  11.             <ItemStyle Width="30px" HorizontalAlign="Center" />   
  12.         </asp:BoundField>   
  13.         <!--帶鏈接的綁定列,DataNavigateUrlFields表示要傳遞的參數,多個(gè)參數用逗號分割開(kāi)-->   
  14.         <asp:HyperLinkField DataNavigateUrlFields="OperId,operName" DataNavigateUrlFormatString="OperatorEdit.aspx?OperId={0}&operName={1}"  
  15.             DataTextField="OperName" HeaderText="登錄名稱(chēng)" >   
  16.             <ItemStyle Width="100px" />   
  17.         </asp:HyperLinkField>   
  18.         <asp:BoundField HeaderText="真實(shí)名稱(chēng)" DataField="TrueName">   
  19.             <ItemStyle Width="100px" />   
  20.         </asp:BoundField>   
  21.         <asp:BoundField HeaderText="備注" DataField="OperMemo" />   
  22.         <asp:HyperLinkField HeaderText="授權" NavigateUrl="OperatorRole.aspx" Text="角色授權" DataNavigateUrlFields="OperId" DataNavigateUrlFormatString="OperatorRole.aspx?operId={0}">   
  23.             <ItemStyle Width="60px" HorizontalAlign="Center" />   
  24.         </asp:HyperLinkField>   
  25.         <!--事件綁定操作,該例子是刪除時(shí)間-->   
  26.         <asp:CommandField HeaderText="操作" ShowDeleteButton="True">   
  27.             <ItemStyle Width="40px" HorizontalAlign="Center" />   
  28.         </asp:CommandField>   
  29.     </Columns>   
  30.     <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />   
  31.     <!--表格頭部樣式-->   
  32.     <HeaderStyle BackColor="#CCCCCC" Font-Bold="True" ForeColor="#FFFEEE" Height="15px" />   
  33.    <!--隔行變色-->   
  34.     <AlternatingRowStyle BackColor="#F9F9F9" />   
  35. </asp:GridView>  

  • 后臺代碼---綁定gridview

Java代碼
 
  1. DataSet ds = operServices.GetList("");   
  2. DataView dv = new DataView(ds.Tables[0]);   
  3. ///獲取或設置用于篩選在 DataView 中查看哪些行的表達式。   
  4. dv.RowFilter = "isdel=0";   
  5.   
  6. this.gvLog.DataSource = dv;   
  7. this.gvLog.DataBind();  

注1:DataView 使您能夠創(chuàng )建 DataTable 中所存儲的數據的不同視圖,這種功能通常用于數據綁定應用程序。使用 DataView,您可以使用不同排序順序顯示表中的數據,并且可以按行狀態(tài)或基于篩選器表達式來(lái)篩選數據。

注2:如果獲取不到GridView隱藏控件的值,則需要加入以下一段代碼
Java代碼
 
  1. ///該方法名稱(chēng)應該與你綁定的時(shí)間名稱(chēng)一致   
  2. protected void gvLog_RowDataBound(object sender, GridViewRowEventArgs e)   
  3. {   
  4.    if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Header)   
  5.     {   
  6.         ///指定隱藏列,并賦值   
  7.         e.Row.Cells[0].Visible = false;   
  8.         e.Row.Cells[1].Visible = false;   
  9.     }   
  10. }  


注3:如果我們要根據某個(gè)條件去改變表格某個(gè)值的樣式,可以在行綁定時(shí)間方法中加入如下代碼,如:
Java代碼
 
  1. protected void gvLog_RowDataBound(object sender, GridViewRowEventArgs e)   
  2. {   
  3.     if (e.Row.RowIndex != -1)   
  4.     {   
  5.         if (Convert.ToInt16(e.Row.Cells[1].Text.ToString()) == 1)   
  6.         {   
  7.             e.Row.Cells[6].Text = "<font color='red'><b>" + e.Row.Cells[6].Text.ToString() + "</b></font>";   
  8.         }   
  9.     }   
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
ASP.NET查詢(xún)ACCESS數據庫的內容并在DATAVIEW中顯示出來(lái)
后臺判斷GridView某列在前臺顯示信息
GridView 72般絕技
點(diǎn)擊textbox彈出模態(tài)窗口,選擇后返回主頁(yè)面并賦值textbox
GridView點(diǎn)擊行按鈕的時(shí)候固定滾動(dòng)條的實(shí)現方法
GridView
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久