0

午後の皆さん、

Visual Studio 2010 を使用しています。会議の議事録を記録するために使用する Web ページがあります。このページには、ユーザーが「アクション」をサイトに追加するために使用できるセクションがあります。ユーザーにアクションをページに正常に追加してもらうことができます。

私が抱えている問題は、Web ページにグリッド ビューもあり、ユーザーが新しい「アクション」をページに追加したら、これを更新したいということです。ユーザーが送信されたことを確認できるようにします。

私は .net 環境と VB に不慣れで、このタスクを完了する方法が 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ページの私のコードです...

      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

これは単純な要求のように思えますが、システムにアクションを追加するユーザーに基づいてグリッドを更新する方法を示すものを見つけることができないようです。

提供されたヘルプに事前に感謝します。

よろしく

ベティ

4

1 に答える 1

2

GridView1 にデータバインドを配置するだけです。私は次のようなものだと思います: me.GridView1.databind(); メソッド btnAddAction_Click の下部にあります。

お役に立てば幸いです。

于 2012-05-22T15:05:25.147 に答える