Asp – Masterpage with Asp.net Ajax problem

asp.netasp.net-ajax

I placed the scritmanager to masterpage. "scriptmanager1"

There is an updatepanel in the masterpage shows total. "updatepanel1"

In the contentpage I have nested listviews. the "listview2" inside the "listview1" has itemtemplate with a linkbutton called "addtoTotal"

I want to update the updatepanel1 inside the masterpage when user clicks to addtoTotal button.

updatepanel1's update mode is conditional.

How can I do this.

Firstly I could not findcontrol addtoTotal linkbutton.

Second how can I register this button to update updatepanel1

I want to triger the conditional updatepanel from the contentpage.

I tried to do something like this

protected void Page_Load(object sender, EventArgs e) { ScriptManager1.RegisterAsyncPostBackControl(myControl);

}

I could not. Because I don't know where to write this RegisterAsyncPostBackControl code. I could not findcontrol the linkbutton. I am not sure about the way I am trying to solve this is right way.

Best Answer

You can put a subroutine on your master page that updates the panel and you can call it from the content page like so.

  Public Partial Class _Default1
        Inherits System.Web.UI.MasterPage

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        End Sub
        Public Sub updatedpage()
             updatepanel1.update()
        End Sub
    End Class


    Public Partial Class _Default5
        Inherits System.Web.UI.Page
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Not IsPostBack Then
                LoadData()
            End If
            CType(Me.Master, _Default1).updatedpage()
        End Sub
    End Class
Related Topic