Update a user control after Button_Click event

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Winshent

    Update a user control after Button_Click event

    How do you update a user control after a button click event.

    I have a simple shopping basket user control. If a customer updates
    their basket, then user control should reflect the number of items and
    value of the basket.

    My code for the basket control is as follows:

    '############## ############### ############### #######
    Namespace Web.controls.Us er

    Public Class Header
    Inherits System.Web.UI.U serControl

    Protected WithEvents lblBasket As System.Web.UI.W ebControls.Labe l

    Private Sub Page_Load
    SetControls()
    End Sub

    Public Sub SetControls()
    'code to output the basket info to lblBasket
    End Sub

    End Class

    End Namespace
    '############## ############### ############### #######

    Surely this must be an easy task?

    Thanks, Vincent

  • Cowboy (Gregory A. Beamer) - MVP

    #2
    RE: Update a user control after Button_Click event

    Create the user control as a black box, meaning any events it handles get
    bubbled up and all communication to the control is through properties and/or
    methods. You can then do something like:

    MyControl.Refre sh()

    Assuming a refresh method is implemented on the control.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    *************** ************
    Think Outside the Box!
    *************** ************


    "Winshent" wrote:
    [color=blue]
    > How do you update a user control after a button click event.
    >
    > I have a simple shopping basket user control. If a customer updates
    > their basket, then user control should reflect the number of items and
    > value of the basket.
    >
    > My code for the basket control is as follows:
    >
    > '############## ############### ############### #######
    > Namespace Web.controls.Us er
    >
    > Public Class Header
    > Inherits System.Web.UI.U serControl
    >
    > Protected WithEvents lblBasket As System.Web.UI.W ebControls.Labe l
    >
    > Private Sub Page_Load
    > SetControls()
    > End Sub
    >
    > Public Sub SetControls()
    > 'code to output the basket info to lblBasket
    > End Sub
    >
    > End Class
    >
    > End Namespace
    > '############## ############### ############### #######
    >
    > Surely this must be an easy task?
    >
    > Thanks, Vincent
    >
    >[/color]

    Comment

    Working...