【问题标题】:How to bind gridview templatefield footer textbox to insert parameter?如何绑定 gridview 模板字段页脚文本框以插入参数?
【发布时间】:2012-05-14 19:15:31
【问题描述】:

我有这个 gridview 启用了页脚行来插入新行。但是我不知道如何将文本框与 sqldatasource 中的插入参数绑定。请帮忙?

            <asp:TemplateField HeaderText="Region Name" SortExpression="regionName">
                <FooterTemplate>
                      <asp:TextBox ID="tbInsert" runat="server" Text="" ></asp:TextBox>
                </FooterTemplate>
            </asp:TemplateField>

【问题讨论】:

    标签: c# asp.net gridview


    【解决方案1】:

    知道了,在后面的代码中做到了:

            if (e.CommandName == "Insert")
            {
                TextBox tbInsert = grv_regionManagement.FooterRow.FindControl("tbInsert") as TextBox;
                sds_regions.InsertParameters["regionName"].DefaultValue = tbInsert.Text;
                sds_regions.Insert();
            }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-18
      • 2018-05-22
      • 1970-01-01
      • 1970-01-01
      • 2019-08-26
      • 1970-01-01
      相关资源
      最近更新 更多