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 + "')");
            }
        }
    
  • 相关阅读:
    家庭记账本(七+每周总结)
    家庭记账本(六)
    家庭记账本(五)
    家庭记账本(四)
    家庭记账本(三)
    家庭记账本(二)
    家庭记账本(一)
    2021.2.14(每周总结)
    2021.2.13
    文件上传时报错in a frame because it set 'X-Frame-Options' to 'deny'.
  • 原文地址:https://www.cnblogs.com/buyixiaohan/p/1932714.html
Copyright © 2011-2022 走看看