title: ASP.Net Refresh GridView
body: <p>Afternoon All,</p>
  
  <p>I am using a visual studio 2010.  I have a web page which is used to record minutes of meetings.  The page has a section that the user can use to add 'Actions' to the site.  I can get a user to successfully add an action to the page.</p>
  
  <p>The issue that i have is i also have a grid view on the webpage and would like this to refresh once the user has added the new 'Action' to the page.  So that the user can see that its been submitted.</p>
  
  <p>Im new ish to the .net environment and VB and im not sure 100% how to complete this task.</p>
  
  <p>I have the following code from my .aspx page....</p>
  
  <pre><code>    Submitted Actions:
      &lt;hr /&gt;
          &lt;!-- DataSource for submitted Actions --&gt;
  
          &lt;asp:SqlDataSource ID="OutstandingActionsDS" runat="server" 
              ConnectionString="&lt;%$ ConnectionStrings:SMCConnectionString %&gt;" 
              SelectCommand="Populate_grdOutstandingActions" 
              SelectCommandType="StoredProcedure"&gt;&lt;/asp:SqlDataSource&gt;
  
          &lt;!-- Gridview that holds submitted Actions --&gt;
  
          &lt;asp:GridView ID="GridView1" runat="server" DataSourceID="OutstandingActionsDS"&gt;
          &lt;/asp:GridView&gt;
      &lt;br /&gt;
      &lt;br /&gt;
          New Actions to Record:
      &lt;hr /&gt;
  
              &lt;!-- Add new Action --&gt;
              &lt;asp:Panel ID="pnlHeaderAction" runat="server" CssClass="pnl" Width="740px"&gt;
  
                  &lt;div style="float:left;"&gt;
                      &amp;nbsp;Record New Actions
                  &lt;/div&gt;
                  &lt;div style="float:right;"&gt;
                      &lt;asp:Label ID="lblShowHideAction" runat="server" &gt;&lt;/asp:Label&gt;
                  &lt;/div&gt;
                  &lt;div style="clear:both"&gt;&lt;/div&gt;
              &lt;/asp:Panel&gt;
              &lt;asp:Panel ID="pnlInfoAction" runat="server" CssClass="pnlBody"&gt;
                 &lt;table&gt; 
      &lt;tr&gt;
             &lt;td  style="width:498px; height: 15px;"&gt;&lt;h5&gt;Actions:&lt;/h5&gt;&lt;/td&gt;
            &lt;td style="width:130px; height: 15px;"&gt;&lt;h5&gt;Owner:&lt;/h5&gt;&lt;/td&gt;
            &lt;td style="height: 15px;"&gt;&lt;h5&gt;&amp;nbsp;Target Date:&lt;/h5&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;/table&gt;
      &lt;table style="width: 99%"&gt;
         &lt;tr&gt;
            &lt;td style="width: 495px"&gt;
               &lt;asp:TextBox ID="txtAction" runat="server" TextMode="MultiLine" 
                                  Width="493px" Height="50px" style="font-family:Verdana"&gt;&lt;/asp:TextBox&gt;
             &lt;/td&gt;
             &lt;td style="width: 132px" valign="top"&gt;
                &lt;asp:TextBox ID="txtOwner" runat="server"  Height="50px" 
                                  width="128px" style="font-family:Verdana"&gt;&lt;/asp:TextBox&gt;
             &lt;/td&gt;
              &lt;td valign="top"&gt;
                &lt;asp:TextBox ID="txtTargetDate" runat="server" width="89px" style="font-family:Verdana"&gt;&lt;/asp:TextBox&gt;
              &lt;/td&gt;
            &lt;/tr&gt;
           &lt;/table&gt;
          &lt;br /&gt;
               &lt;div style="text-align: right;"&gt;
                           &lt;asp:Button ID="btnAddAction" runat="server" Text="Add New Action" CssClass="button" /&gt;
                &lt;/div&gt;
              &lt;/asp:Panel&gt;
  </code></pre>
  
  <p>Here is my code for the VB page...</p>
  
  <pre><code>      Protected Sub btnAddAction_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddAction.Click
  
      Dim oActionClass As New ActionClass
  
      With oActionClass
          .Action = txtAction.Text
          .Owner = txtOwner.Text
          .TargetDate = New SmartDate(Convert.ToDateTime(txtTargetDate.Text))
  
            oActionClass.ActionID = ActionClassDAL.AddActionClass(oActionClass)
          ClearActions()
      End With
  
      End Sub
  
      Private Sub ClearActions()
         txtAction.Text = ""
         txtOwner.Text = ""
         txtTargetDate.Text = ""
  
      End Sub
  </code></pre>
  
  <p>This seems like a simple request but i cant seem to find anything that shows me how to refresh the grid based on the user adding the action to the system.</p>
  
  <p>Many thanks in advance for any help offered.</p>
  
  <p>Regards</p>
  
  <p>Betty</p>