在UpdatePanel中更新数据列表 [英] Update Datalist in UpdatePanel
问题描述
我在同一页面中有两个updatepanel.一个是数据列表,另一个是模式弹出窗口.在模式弹出窗口中,我有一个保存"按钮,用于更新数据列表的数据.实际上,保存"按钮可以正常工作并且可以更新数据,但是要查看数据列表中的更新数据,我必须进行回发,而我希望保存"按钮发生异步回发,并且在保存"按钮单击后,数据列表可以向我显示更新的数据.
I've two updatepanel in the same page. In one, there is a datalist while in other there is a modal popup. In modal popup I have a Save button that update datalist's data. In effect Save button work correctly and data are updated but to see updated data in datalist I must do a postback while I would that Save button occur an asyncpostback and datalist show me updated data after Save Button' Click.
我是在modalpopup的updatepanel中这样做的:
I do this in updatepanel of modalpopup:
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
</Triggers>
P.S对不起,我的英语!
P.S Sorry for my English!
推荐答案
对要更新的UpdatePanel(包含DataList)执行相同的操作:
Do the same thing for the UpdatePanel you want to update (that contains the DataList):
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" />
</Triggers>
由于UpdatePanel的子级不会触发回发,因此它不知道刷新,而是明确告知单击 btnSave
时,应该这样做可以解决您的问题.
Since a child of the UpdatePanel isn't triggering the postback, it doesn't know to refresh, telling it explicitly that when btnSave
is clicked it should do so should solve your issue.
这篇关于在UpdatePanel中更新数据列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!