开发者

How to bind gridview after Page_Load?

开发者 https://www.devze.com 2022-12-10 19:40 出处:网络
I want to bind a gridview after the page has finished load开发者_JAVA技巧ing (after Page_Load), so not on the Page_Load event handler, but after that.Protected Sub Page_LoadComplete(ByVal sender As Ob

I want to bind a gridview after the page has finished load开发者_JAVA技巧ing (after Page_Load), so not on the Page_Load event handler, but after that.


         Protected Sub Page_LoadComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadComplete
            If Not IsPostBack Then
                Me.DataBind()
            End If
        End Sub

        Public Overrides Sub DataBind()

           Me.Grid.Datasource = Somedata          

           MyBase.DataBind()    

        End Sub

Is that what you mean?


I'm not quite sure what you mean. The Gridview is bound to a datasource on the server side. You can bind the source at any point between Page_Init and the end of Page_Load, if I recall correctly.

jQuery on the other hand runs on the client side and therefore binding a datasource to the Gridview at this point is not possible.

0

精彩评论

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