gridview中的更新面板 [英] update panel in gridview
本文介绍了gridview中的更新面板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用更新面板在点击按钮时显示gridview中的最新记录,而无需刷新页面..代码为:
I have used an update panel to show latest records in gridview on click of button without the need to refresh the page.. the code is:
<asp:Button ID="Button1" runat="server" Text="Show"/>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="ObjectDataSource1">
<Columns>
<asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetAll"
TypeName="NameSelected"
onobjectcreating="ObjectDataSource1_ObjectCreating">
</asp:ObjectDataSource>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
问题是:点击按钮,网格没有更新..任何帮助???
the problem is: on click of button, the grid is not updated.. Any help???
推荐答案
你的按钮上没有运行任何event_handler所以只有page_load和页面生命周期事件将更好地更新page_load中的数据
on your button you are not running any event_handler so only page_load and page life cycle events will occurs better to update data in page_load
这篇关于gridview中的更新面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文