在grid中如何获取模板列中的textbox的值

Mar 8, 2011 at 2:19 AM

如题

Apr 25, 2011 at 7:01 AM

前台grid:

              <ext:TemplateField Width ="40px" HeaderText="">
              <ItemTemplate>
                  <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
              </ItemTemplate>
              </ext:TemplateField>

 

后台取值: 

       protected void Button1_Click(object sender, EventArgs e)
        {
            string s = "";
            for (int i = 0; i <= Grid1.Rows.Count - 1; i++)
            {
                s = s + Request.Form["Grid1_" + i.ToString() + "$TextBox2"] + "_";
            }
            ExtAspNet.Alert.Show(s);
        }