Click here to Skip to main content
15,913,939 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Referencing User Control Attributes in Page Code Behind Pin
janetb992-Dec-11 5:05
janetb992-Dec-11 5:05 
GeneralRe: Referencing User Control Attributes in Page Code Behind Pin
jkirkerx2-Dec-11 7:13
professionaljkirkerx2-Dec-11 7:13 
I wasn't able to see your user control.

With user controls, like server controls, you don't use the code behind pages on the webform to interact with them. Instead, you write more code in your user control.

So just register the control in the webform like you did. Then if you want to do something in page.load, you add an override to your user control.

Public Class MyControl
Private lbl_Website_Name As Label

Protected overrides Sub OnInit(ByVal e as System.EventArgs)
controls.clear

//Dim lbl_Website_Name As Label 
lbl_WebsiteName = New Label
With lbl_Website_Name
End With
Controls.Add(lbl_Website_name)


End Sub
Protected overrides Sub OnLoad(ByVal e As System.EventArgs)

Do you stuff.
lbl_Website_Name.txt = sWebsiteName

End Sub


This will append to the current page.load on the web form, and operate identical to page load.

You can call the control by the name assigned,
GeneralRe: Referencing User Control Attributes in Page Code Behind Pin
janetb992-Dec-11 7:57
janetb992-Dec-11 7:57 
GeneralRe: Referencing User Control Attributes in Page Code Behind Pin
jkirkerx2-Dec-11 7:32
professionaljkirkerx2-Dec-11 7:32 
GeneralRe: Referencing User Control Attributes in Page Code Behind Pin
janetb992-Dec-11 7:53
janetb992-Dec-11 7:53 
GeneralRe: Referencing User Control Attributes in Page Code Behind Pin
jkirkerx2-Dec-11 8:49
professionaljkirkerx2-Dec-11 8:49 
AnswerRe: Referencing User Control Attributes in Page Code Behind Pin
RichardGrimmer5-Dec-11 5:37
RichardGrimmer5-Dec-11 5:37 
GeneralRe: Referencing User Control Attributes in Page Code Behind Pin
janetb996-Dec-11 8:40
janetb996-Dec-11 8:40 
GeneralRe: Referencing User Control Attributes in Page Code Behind Pin
janetb996-Dec-11 9:06
janetb996-Dec-11 9:06 
Questionconvert detailsview control to formview control Pin
classy_dog1-Dec-11 8:43
classy_dog1-Dec-11 8:43 
QuestionHow to Create a Dynamic Questionnaire Pin
Vimalsoft(Pty) Ltd1-Dec-11 3:49
professionalVimalsoft(Pty) Ltd1-Dec-11 3:49 
QuestionThe header and footer contents in master page are refreshing - Need help Pin
Member 322226430-Nov-11 19:21
Member 322226430-Nov-11 19:21 
AnswerRe: The header and footer contents in master page are refreshing - Need help Pin
uspatel30-Nov-11 23:10
professionaluspatel30-Nov-11 23:10 
AnswerRe: The header and footer contents in master page are refreshing - Need help Pin
jkirkerx1-Dec-11 11:29
professionaljkirkerx1-Dec-11 11:29 
GeneralRe: The header and footer contents in master page are refreshing - Need help Pin
Member 32222641-Dec-11 23:38
Member 32222641-Dec-11 23:38 
GeneralRe: The header and footer contents in master page are refreshing - Need help Pin
jkirkerx2-Dec-11 6:23
professionaljkirkerx2-Dec-11 6:23 
GeneralRe: The header and footer contents in master page are refreshing - Need help Pin
Member 32222645-Dec-11 19:06
Member 32222645-Dec-11 19:06 
QuestionWCF message edit error Pin
arnold0930-Nov-11 19:19
arnold0930-Nov-11 19:19 
AnswerRe: WCF message edit error Pin
jkirkerx1-Dec-11 11:49
professionaljkirkerx1-Dec-11 11:49 
GeneralRe: WCF message edit error Pin
arnold092-Dec-11 0:45
arnold092-Dec-11 0:45 
GeneralRe: WCF message edit error Pin
jkirkerx2-Dec-11 6:36
professionaljkirkerx2-Dec-11 6:36 
GeneralRe: WCF message edit error Pin
arnold095-Dec-11 18:55
arnold095-Dec-11 18:55 
GeneralRe: WCF message edit error Pin
jkirkerx6-Dec-11 6:45
professionaljkirkerx6-Dec-11 6:45 
Questionloginstatus control-sessions Pin
MalarGayu30-Nov-11 14:57
MalarGayu30-Nov-11 14:57 
AnswerRe: loginstatus control-sessions Pin
Member 322226430-Nov-11 19:48
Member 322226430-Nov-11 19:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.