zoukankan      html  css  js  c++  java
  • gridview 点击 行页面跳转

     

    前台代码:

              <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="100%" EmptyDataText=" 无" BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4" OnRowDataBound="GridView1_RowDataBound">
                  <Columns>
                      <asp:TemplateField HeaderText="姓名">
                          <ItemTemplate>
                              <asp:Label ID="Label1" runat="server" Text='<%# Eval("TrueName") %>'></asp:Label>
                              <asp:HiddenField ID="HiddenField1" runat="server" Value='<%# Eval("id") %>' />
                          </ItemTemplate>
                          <ItemStyle Width="50px" />
                      </asp:TemplateField>
                      <asp:BoundField HeaderText="性别" DataField="sex" />
                      <asp:BoundField HeaderText="学历" DataField="Quslification" />
                      <asp:BoundField HeaderText="工作年限" DataField="JobExperience" />
                      <asp:BoundField HeaderText="求职行业" DataField="Industry" />
                      <asp:BoundField DataField="Funtype" HeaderText="求职岗位" />
                      <asp:BoundField HeaderText="求职地区" DataField="JobPlace" />
                      <asp:BoundField HeaderText="目前居住地" DataField="ContactAddress" Visible="False" />
                      <asp:BoundField HeaderText="户口所在地" DataField="Birthplace" Visible="False" />
                  </Columns>
                  <HeaderStyle HorizontalAlign="Left" Width="20px" BackColor="Azure" Font-Bold="True" ForeColor="#FFFFCC" />
                  <RowStyle Width="20px" BackColor="White" ForeColor="#330099" />
                  <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
                  <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
                  <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
              </asp:GridView>
    

    后台代码:

        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#cdebed';"+
                                    "this.style.cursor='hand';");
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
    
                HiddenField hf = (HiddenField)e.Row.Cells[0].FindControl("HiddenField1");
                e.Row.Attributes.Add("onclick", "javascript:window.open('Jobseeker.aspx?id=" + hf.Value + "')");
            }
        }
    
  • 相关阅读:
    史上最全的正则表达式-匹配中英文、字母和数字
    使用Git分支开发新特性或修复Bug与使用Git分支开发新特性或修复Bug
    装了Yaml 然后代码一运行就报错 YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe.
    mac安装yaml
    如何获取android app的package和Activity
    Original error: No Chromedriver found that can automate Chrome '39.0.0'.
    mac chromedriver安装
    keycode相关方法
    python+appium的物理按键代码
    Python测试Websocket接口
  • 原文地址:https://www.cnblogs.com/buyixiaohan/p/1932714.html
Copyright © 2011-2022 走看看