注册中继器中的异步回发控件 [英] Registering Asynchronous Post-back Control that is in repeater
本文介绍了注册中继器中的异步回发控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图通过处理转发器的DataItemBound来注册转发器中的文本框以进行异步回发:
I have tried to register textboxes that are in a repeater to do asynchronous post-back by handling DataItemBound for the repeater:
Protected Sub rptExtraFees_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptExtraFees.ItemDataBound
If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Then
Dim txtExtraFeesValue As TextBox = e.Item.FindControl("txtExtraFeesValue")
Dim trigger As New AsyncPostBackTrigger
trigger.ControlID = txtExtraFeesValue.UniqueID
trigger.EventName = "TextChanged"
pnlTotalFees.Triggers.Add(trigger)
Dim ScriptManager1 As ScriptManager = Master.FindControl("ScriptManager1")
ScriptManager1.RegisterAsyncPostBackControl(txtExtraFeesValue)
End If
End Sub
但是文本框仍然导致完整的页面回发.我该怎么办?
But the textboxes are still causing complete page post-back. What shall I do?
推荐答案
我应该在Page.Load
事件中调用registerAsyncPostBackControl
.就像:
I should have calledregisterAsyncPostBackControl
inPage.Load
event. just like:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim ScriptManager1 As ScriptManager = Master.FindControl("ScriptManager1")
For Each item As RepeaterItem In rptExtraFees.Items
If item.ItemType = ListItemType.AlternatingItem Or item.ItemType = ListItemType.Item Then
Dim txtExtraFeesValue As TextBox = item.FindControl("txtExtraFeesValue")
ScriptManager1.RegisterAsyncPostBackControl(txtExtraFeesValue)
End If
Next
End Sub
这篇关于注册中继器中的异步回发控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文