【问题标题】:Save data from gridview with checkbox event使用复选框事件保存来自gridview的数据
【发布时间】:2014-06-23 16:20:59
【问题描述】:

我的 Web 应用程序中有一个带有列复选框的网格视图。 我的问题是我无法使用按钮操作来保存该列中的更改,因为回发时清除了我的 gridview 中的数据。

那么我怎样才能在网格中保存我的更改?

也许是在找零钱?

这是我的网格视图:

<asp:GridView ID="grd" runat="server" EnableModelValidation="True"  AutoGenerateColumns="True" >                                             

我这样填写:

dt = obj.SelectByCustom(obj) 'this is my class
grd.DataSource = dt  
grd.DataBind()

请帮忙。

【问题讨论】:

  • 可以给我asp:GridView的完整代码吗?
  • 那是完整的代码。 DataBinding 自动填满网格。所以我不定义列。

标签: asp.net vb.net gridview checkbox


【解决方案1】:

我找到了问题的答案。

我使用了一个 UpdatePanel,将我的 gridview 放在里面。

<asp:UpdatePanel ID="UP01" runat="server" UpdateMode="Conditional">
               <ContentTemplate>
                   <asp:GridView ID="grd" runat="server" AutoGenerateColumns="True" EnableModelValidation="True">
                   </asp:GridView>                       
               </ContentTemplate>

               <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="BtnSave" EventName="Click" />                      
               </Triggers>

             </asp:UpdatePanel>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-01-26
    • 1970-01-01
    • 1970-01-01
    • 2010-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多