开发者

Can you switch from Async PostBack to Full PostBack in an Update Panel?

Is something like this possible?

Dim iCounter as Integer
Dim iQuantity as Intege开发者_如何学JAVAr = 10

Protected Sub btnFoo_Click Handles btnFoo Yadda

    For i as Integer = iCounter to iQuantity - 1
        //do something with AsyncPostBackTrigger until iCounter = iQuantity - 1
        //then trigger a full postback
    Next

End Sub

I am new to the concept and feel like there must be something really easy that I am missing.


Without going into why, what I eventually did was store the counter in a session variable and exited the sub from the for loop unless the counter was equal to the quantity.

Then everything past the end of the for loop that I needed updated (Labels, DropDownBoxes) I put in their own update panels with UpdateMode set to always.

To modify my pseudo code above:

Dim iCounter as Integer = Session("counter")
Dim iQuantity as Integer = 10

Protected Sub btnFoo_Click Handles btnFoo Yadda

    For i as Integer = iCounter to iQuantity - 1
        //do something with AsyncPostBackTrigger until iCounter = iQuantity - 1
        //then trigger a full postback

        If iCounter <> iQuantity Then
            Exit Sub
        End If
        Session("counter") = iCounter + 1
    Next

    //Everything else I needed to do with page controls wrapped 
    //in their own update panels

End Sub

Maybe not the 'best practice' but it worked for what I needed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜