473,394 Members | 1,778 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.

User Control Variable not getting generated

Hi,

I am having a trivial problem which is not that important but I would
like to know if I am missing something. I have created a user control. When I
drag the user control into one of the web forms, it should generate the
variable in the code -behind like Protected WithEvents uc1 as UserControl1.
But it is not generating that. So Everytime I drag the user control onto one
of the forms I need to manually add that variable. Am I missing something to
generate that code? Please let me know.

Thanks,
Sridhar.
Feb 27 '06 #1
3 1315
Web user controls won't generate that markup when you add them to the page.
You don't need the protected ... stuff for the user control to work. you do
need that, however, if you want to access data from that control using
asp.net.

HTH,
Darren Kopp
http://blog.secudocs.com/

"Sridhar" wrote:
Hi,

I am having a trivial problem which is not that important but I would
like to know if I am missing something. I have created a user control. When I
drag the user control into one of the web forms, it should generate the
variable in the code -behind like Protected WithEvents uc1 as UserControl1.
But it is not generating that. So Everytime I drag the user control onto one
of the forms I need to manually add that variable. Am I missing something to
generate that code? Please let me know.

Thanks,
Sridhar.

Feb 27 '06 #2
Well, I need to access some properties for that control. That is why I am
looking for that control variable in the Web Designer Generated Code. Every
time I need to add them manually which is not the right way of doing.

Thanks,
Sridhar.

"Darren Kopp" wrote:
Web user controls won't generate that markup when you add them to the page.
You don't need the protected ... stuff for the user control to work. you do
need that, however, if you want to access data from that control using
asp.net.

HTH,
Darren Kopp
http://blog.secudocs.com/

"Sridhar" wrote:
Hi,

I am having a trivial problem which is not that important but I would
like to know if I am missing something. I have created a user control. When I
drag the user control into one of the web forms, it should generate the
variable in the code -behind like Protected WithEvents uc1 as UserControl1.
But it is not generating that. So Everytime I drag the user control onto one
of the forms I need to manually add that variable. Am I missing something to
generate that code? Please let me know.

Thanks,
Sridhar.

Feb 27 '06 #3
Yeah, in that case it probably will be annoying. Basically, it doesn't need
to create that code markup because a user control isn't a class variable.
When asp.net is rendering the page, it see's the user control's tag, it
renders the user control and just puts the html in the page.

-Darren Kopp
http://blog.secudocs.com/

"Sridhar" wrote:
Well, I need to access some properties for that control. That is why I am
looking for that control variable in the Web Designer Generated Code. Every
time I need to add them manually which is not the right way of doing.

Thanks,
Sridhar.

"Darren Kopp" wrote:
Web user controls won't generate that markup when you add them to the page.
You don't need the protected ... stuff for the user control to work. you do
need that, however, if you want to access data from that control using
asp.net.

HTH,
Darren Kopp
http://blog.secudocs.com/

"Sridhar" wrote:
Hi,

I am having a trivial problem which is not that important but I would
like to know if I am missing something. I have created a user control. When I
drag the user control into one of the web forms, it should generate the
variable in the code -behind like Protected WithEvents uc1 as UserControl1.
But it is not generating that. So Everytime I drag the user control onto one
of the forms I need to manually add that variable. Am I missing something to
generate that code? Please let me know.

Thanks,
Sridhar.

Feb 28 '06 #4

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

Similar topics

1
by: Rhy Mednick | last post by:
I'm creating a custom control (inherited from UserControl) that is displayed by other controls on the form. I would like for the control to disappear when the user clicks outside my control the...
2
by: paul meaney | last post by:
All, myself and another developer have been staring blankly at a screen for the past 48 hours and are wondering just what stunningly obvious thing we are missing. We are trying to load up 2...
6
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header"...
7
by: moondaddy | last post by:
I have a user control being used instead of a frame page. when the user clicks on a menu item I need to send the ID (integer value) of that menu as a parameter in the postback of the user control...
5
by: Marcel Gelijk | last post by:
Hi, I am trying to create a User Control that is located in a seperate class library. The User Control contains a textbox and a button. The page generates an exception when it tries to access...
12
by: Phil Certain | last post by:
Hi, I'm trying to do something very simple...or at least it should be. I have created a host page (gen.aspx) and a very simple user control (us.ascx). The corresponding code-behind files are...
5
by: Nathan Sokalski | last post by:
I have a user control that contains three variables which are accessed through public properties. They are declared immediately below the "Web Form Designer Generated Code" section. Every time an...
8
by: MattB | last post by:
I have a asp.net 1.1/vb application that has a page with a bunch of dynamically added User Controls. When I add the controls, I set the UserControl.EnableViewState to true. For all my controls...
0
by: Kristian Frost | last post by:
Hi, I'm just getting started with VB.Net, and I'm having trouble getting the routing around of some of the data straight in my mind, which has led me to the following problem. Basically, I'm...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.