Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How does this code step

Reply
Thread Tools

How does this code step

 
 
rn5a@rediffmail.com
Guest
Posts: n/a
 
      11-05-2006
A custom server control containing a Button inherits from the
WebControl class. I want to give users the option to change the
BackColor of the Button. If this is the code in the ASPX page that uses
the custom server control (whose class name is 'MyCls') which has been
compiled into 'MyDLL.dll' using VBC

<%@ Register Assembly="MyDLL" Namespace="MyNS" TagPrefix="cc1" %>
<form runat="server">
<cc1:MyCls ID="cccls" BackColor="red" runat="server"/>
</form>

then this does not change the BackColor of the Button control. To
change the BackColor of the Button, the BackColor property of the
Button control has to be overridden like this:

Namespace MyNS
Public Class MyCls : Inherits WebControl
Private strBackColor As System.Drawing.Color

Public Overrides Property BackColor() As System.Drawing.Color
Get
BackColor = strBackColor
End Get
Set(ByVal value As System.Drawing.Color)
strBackColor = value
End Set
End Property

Protected Overrides Sub CreateChildControls()
MyBase.CreateChildControls()
Dim btn1 As Button

btn1 = New Button
btn1.ID = "btn1"
btn1.BackColor = strBackColor
Me.Controls.Add(btn1)

ChildControlsCreated = True
End Sub
End Class
End Namespace

The ASPX code shown at the beginning will now change the BackColor of
the Button to red.

What I would like to know is when the compiler encounters
BackColor="red" in the ASPX code, how does the code flow after that? In
other words, which line first gets executed in the VB class file &
subsequently how does the code step from one line to the other in the
VB class file?

I don't have Visual Web Developer 2005 installed in my m/c which is why
I am asking this question.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
wanted: framework for creating nice step by step graphical visualisationsof running Python code Claudio Grondi Python 2 07-02-2006 11:55 PM
Step By Step Instructions Glenallan Wireless Networking 15 12-29-2004 12:13 AM
can somebody guide me through this step by step? Taquin Noel Wireless Networking 5 12-26-2004 01:31 AM
step by step loading a design into flash with nios excalibur jaap de verwant slachter VHDL 0 07-01-2003 01:02 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57