码迷,mamicode.com
首页 > 其他好文 > 详细

GW知识点

时间:2015-04-08 09:03:21      阅读:88      评论:0      收藏:0      [点我收藏+]

标签:

1、取值:

        protected void Button1_Click(object sender, EventArgs e)
        {
            string str = "";
            foreach (GridViewRow row in this.GridView1.Rows)
            {
               str += ((Label)row.FindControl("Label2")).Text + ",";
               str+=  row.Cells[0].Text.ToString();
            }
        }

 

 

2、

<script runat="server">
void AuthorsGridView_SelectedIndexChanged(Object sender, EventArgs e)  {
    String lastName = selectRow.Cells[1].Text;   // 针对BoundField字段
    DataBoundLiteralControl firstNameLiteral = (DataBoundLiteralControl)selectRow.Cells[2].Controls[0];  //针对TemplateField字段
    String firstName = firstNameLiteral.Text;
}
</script>
<asp:gridview id="AuthorsGridView" datasourceid="AuthorsSqlDataSource"
        autogeneratecolumns="false" autogenerateselectbutton="true"
        onselectedindexchanged="AuthorsGridView_SelectedIndexChanged"  runat="server">
    <columns>
      <asp:boundfield datafield="au_lname" headertext="Last Name"/>
      <asp:templatefield headertext="FirstName">
          <itemtemplate>  <%#Eval("au_fname")%> </itemtemplate>
      </asp:templatefield>
    </columns>
</asp:gridview>

 

3、

GW知识点

标签:

原文地址:http://www.cnblogs.com/chenmfly/p/4401421.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!