zoukankan      html  css  js  c++  java
  • C#如何在事件中获得GridView里面TextBox的值

      GridView设置如下:

    <asp:GridView ID="GridViewlb" runat="server" AutoGenerateColumns="False" CssClass="tabblue" ShowCellToolTip=" True"
      EmptyDataText="暂时没有记录!" Width="100%" Height="100%" AllowPaging="True" OnPageIndexChanging="GridViewlb_PageIndexChanging"
      DataKeyNames="id" PageSize="26" OnRowCreated="GridViewlb_RowCreated" OnRowDataBound="GridViewlb_RowDataBound"
      AllowSorting="True">

      <Columns >
        <asp:BoundField DataField="id" HeaderText="编号" />
        <asp:BoundField DataField="type" HeaderText="类型" />
        <asp:BoundField DataField="item" HeaderText="项目" ></asp:BoundField>
        <asp:BoundField DataField="detail" HeaderText="内容" >
          <ItemStyle Width="100px" />
          <ItemStyle Width="120px" />
        </asp:BoundField>
        <asp:BoundField DataField="basescore" HeaderText="基本分" />
        <asp:BoundField DataField="stdevaluation" HeaderText="评分标准" />
        <asp:TemplateField HeaderText="打分" >
          <ItemTemplate>
            <asp:TextBox id="textbox1" runat="server" Text="" Width="80%" Height="24px"></asp:TextBox>
          </ItemTemplate>
        <ItemStyle Width="50px" />
        </asp:TemplateField>
      </Columns>

    </asp:GridView>

      获得GridView中TextBox的值:

      显然这里是模板列,可以利用:

    string str = ((TextBox)(this.GridView1.Rows[行号].Cells[6].FindControl("textBox1"))).Text.Trim();

      如果不是模板列,可以利用

    string str = this.GridView1.Rows[行号].Cells[6].Text.Trim();

      

  • 相关阅读:
    Documentation | AnsibleWorks
    Salt Stack 官方文档翻译
    OSNIT_百度百科
    内心觉得自己会是一个还比较厉害的产品经理,对于新产品的整合上
    知方可补不足~UPDLOCK更新锁的使用
    MongoDB学习笔记~环境搭建
    压力测试~一套完整的压力测试项目文档
    压力测试~测试工具的使用
    不说技术~关于创业一点想法
    HTML5 Canvas 填充与描边(Fill And Stroke)
  • 原文地址:https://www.cnblogs.com/danshui/p/3152297.html
Copyright © 2011-2022 走看看