2012-05-22 145 views
0

下午所有,ASP.Net刷新GridView

我正在使用visual studio 2010.我有一个用于记录会议纪要的网页。该页面有一个部分,用户可以使用该部分向网站添加“操作”。我可以让用户成功添加一个动作到页面。

我的问题是我也有一个网页的网格视图,并希望这个刷新后,用户已经添加了新的'行动'的页面。以便用户可以看到它已被提交。

Im新的ish到.net环境和VB和im不知道100%如何完成这个任务。

我从我的.aspx页面下面的代码....

Submitted Actions: 
    <hr /> 
     <!-- DataSource for submitted Actions --> 

     <asp:SqlDataSource ID="OutstandingActionsDS" runat="server" 
      ConnectionString="<%$ ConnectionStrings:SMCConnectionString %>" 
      SelectCommand="Populate_grdOutstandingActions" 
      SelectCommandType="StoredProcedure"></asp:SqlDataSource> 

     <!-- Gridview that holds submitted Actions --> 

     <asp:GridView ID="GridView1" runat="server" DataSourceID="OutstandingActionsDS"> 
     </asp:GridView> 
    <br /> 
    <br /> 
     New Actions to Record: 
    <hr /> 

      <!-- Add new Action --> 
      <asp:Panel ID="pnlHeaderAction" runat="server" CssClass="pnl" Width="740px"> 

       <div style="float:left;"> 
        &nbsp;Record New Actions 
       </div> 
       <div style="float:right;"> 
        <asp:Label ID="lblShowHideAction" runat="server" ></asp:Label> 
       </div> 
       <div style="clear:both"></div> 
      </asp:Panel> 
      <asp:Panel ID="pnlInfoAction" runat="server" CssClass="pnlBody"> 
       <table> 
    <tr> 
      <td style="width:498px; height: 15px;"><h5>Actions:</h5></td> 
      <td style="width:130px; height: 15px;"><h5>Owner:</h5></td> 
      <td style="height: 15px;"><h5>&nbsp;Target Date:</h5></td> 
    </tr> 
    </table> 
    <table style="width: 99%"> 
     <tr> 
      <td style="width: 495px"> 
      <asp:TextBox ID="txtAction" runat="server" TextMode="MultiLine" 
           Width="493px" Height="50px" style="font-family:Verdana"></asp:TextBox> 
      </td> 
      <td style="width: 132px" valign="top"> 
       <asp:TextBox ID="txtOwner" runat="server" Height="50px" 
           width="128px" style="font-family:Verdana"></asp:TextBox> 
      </td> 
      <td valign="top"> 
       <asp:TextBox ID="txtTargetDate" runat="server" width="89px" style="font-family:Verdana"></asp:TextBox> 
      </td> 
      </tr> 
     </table> 
     <br /> 
      <div style="text-align: right;"> 
         <asp:Button ID="btnAddAction" runat="server" Text="Add New Action" CssClass="button" /> 
       </div> 
      </asp:Panel> 

这里是我的VB页面代码...

​​

这似乎是一个简单的请求,但我似乎无法找到任何指示我如何基于用户将操作添加到系统来刷新网格的任何内容。

非常感谢您提供的任何帮助。

问候

贝蒂

回答

2

你就必须把数据绑定到GridView1。我认为是这样的: me.GridView1.databind(); 在你的方法btnAddAction_Click的底部。

我希望我一直有帮助。

+0

午后Ferchoj。非常感谢您的帮助。这是一种享受。 – Betty