473,394 Members | 2,100 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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.User

Public Class Header
Inherits System.Web.UI.UserControl

Protected WithEvents lblBasket As System.Web.UI.WebControls.Label

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

Nov 19 '05 #1
1 1811
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.Refresh()

Assuming a refresh method is implemented on the control.

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

***************************
Think Outside the Box!
***************************
"Winshent" wrote:
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.User

Public Class Header
Inherits System.Web.UI.UserControl

Protected WithEvents lblBasket As System.Web.UI.WebControls.Label

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

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: C K | last post by:
I am having trouble getting the page_load event to fire from within my usercontrol - my code is below, I'm sure I'm missing something simple. Just your basic web user control - I've just began...
3
by: Tim Thomas | last post by:
Hi, I am very new to .NET and am in the process of building my first web application. I will briefly describe what i am trying to achieve: I have a system where suppliers register their...
7
by: Tim T | last post by:
Hi, I have the need to use dynamically loaded user controls in a webform page. I have the controls loading dynamically, and that part works fine. this is the code used in a webform to dynamically...
6
by: Andrea Williams | last post by:
When I step through my code, the ASPX Page_Load happens before the Page_Load in the User Control. This means that the property values are not set to their defaults yet in the User Control and all...
4
by: owingruters | last post by:
Hi all, I've created an User control. It's an extension of a textbox wich has some extra properties so that validation becomes a lot faster. The control wordks great if autopostback is on....
9
by: Michael | last post by:
Hi, I have a large table. Normally, the user will need to see only the data from the past two years, but sometimes, they will need to go back further. I have a form with a datagrid, a...
2
by: glenn | last post by:
Hi folks, I am trying to determine which item in a DropDownList Web control has been selected. I have posted an OnSelectedIndexChanged subroutine in my code with a reference to the subroutine...
1
by: tranky | last post by:
Hi boys.. ....i've a question for you! I've a custom control with a button. Well... I need to create that: <mytagprefix:mytag runat="server" onButtonClick="Button_Click"> And in the code...
7
by: Hrvoje Voda | last post by:
I'm using this code to check click event on usercontrol. But I get an error: User Control:(GridFilter) public delegate void FilterText(string filterText); public event FilterText textFilter;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.