Click here to Skip to main content
15,909,332 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I have tried to register textboxes that are in a repeater to do asynchronous post-back by handling DataItemBound for the repeater:
VB
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?
Posted
Updated 3-Jan-11 22:13pm
v2

1 solution

I should have called registerAsyncPostBackControl in Page.Load event. just like:

VB
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
 
Share this answer
 
Comments
Dalek Dave 4-Jan-11 6:33am    
Good Call.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900