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