首页 > 其他 > 详细

GW知识点

时间:2015-04-08 09:03:15      阅读:209      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!