Asp.net Net刷新网格视图
下午好, 我正在使用VisualStudio2010。我有一个网页,用来记录会议记录。该页面有一个部分,用户可以使用该部分向站点添加“操作”。我可以让用户成功地向页面添加操作 我遇到的问题是,我在网页上也有一个网格视图,希望在用户将新的“操作”添加到页面后刷新该视图。以便用户可以看到其已提交 我对.net环境和VB还不熟悉,我不确定如何100%完成这项任务 我的.aspx页面中有以下代码Asp.net Net刷新网格视图,asp.net,visual-studio-2010,visual-studio,asp.net-controls,Asp.net,Visual Studio 2010,Visual Studio,Asp.net Controls,下午好, 我正在使用VisualStudio2010。我有一个网页,用来记录会议记录。该页面有一个部分,用户可以使用该部分向站点添加“操作”。我可以让用户成功地向页面添加操作 我遇到的问题是,我在网页上也有一个网格视图,希望在用户将新的“操作”添加到页面后刷新该视图。以便用户可以看到其已提交 我对.net环境和VB还不熟悉,我不确定如何100%完成这项任务 我的.aspx页面中有以下代码 Submitted Actions: <hr /> <!-
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;">
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> 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>
这看起来像是一个简单的请求,但我似乎找不到任何东西显示如何根据用户向系统添加操作来刷新网格
非常感谢您提供的任何帮助
问候
Betty您只需将数据绑定到GridView1。我认为是这样的: me.GridView1.databind(); 在方法的底部,单击
希望我能帮上忙。下午好,费乔。非常感谢你的帮助。那是一种享受。
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