473,320 Members | 2,094 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,320 software developers and data experts.

automatic insertion of controls on codebehind


I create a new webform (I always use codebehind), and I insert some server-side controls into the form (the ASPX)

Later, I switch to codeview, and I notice that some (sometimes all) of the controls I created have been automatically defined for me in the
#Region " Web Form Designer Generated Code "
section

Later, when I add more controls this no longer happens.
First, I'm wondering which of my actions causes it to no longer do this;

and

is there a command I can issue to force it to "review" the ASPX page and re-synchronize the codebehind form?

Nov 17 '05 #1
4 2393
Actually, I type all my controls in HTML View because I don't like to work with the form designer. Yet in spite of that, VS often manages to "see" them and place them into the codebehind.

"Steve C. Orr, MCSD" <St***@Orr.net> wrote in message news:OQ**************@TK2MSFTNGP11.phx.gbl...
If you drag the control from the toolbox then it should always put the declaration in the code behind for you, assuming such an action is valid for that control. For instance, if you drag an HTML control instead of a webform and you don't mark it as a server control then the definition will not be in the code behind because it's not valid to be there.
Also, if you type in the control definition into the HTML view of your page (instead of dragging it from the toolbar onto the designer view of your form) then I wouldn't expect VS.NET to automatically put the definition into the code behind for you.

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
"Boban Dragojlovic" <news@_N_O_S_P_AM_dragojlovic.org> wrote in message news:g6******************@newssvr14.news.prodigy.c om...

I create a new webform (I always use codebehind), and I insert some server-side controls into the form (the ASPX)

Later, I switch to codeview, and I notice that some (sometimes all) of the controls I created have been automatically defined for me in the
#Region " Web Form Designer Generated Code "
section

Later, when I add more controls this no longer happens.
First, I'm wondering which of my actions causes it to no longer do this;

and

is there a command I can issue to force it to "review" the ASPX page and re-synchronize the codebehind form?

Nov 17 '05 #2
Boban,

I've noticed similar happenings. I have an untested theory. Could you sometimes be switching directly from the html view to the codebehind? And other times switching from the html view to the design view and THEN to the codebehind?

My theory is that if you switch from html view to design view the page gets processed and your objects are added to the codebehind.

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Boban Dragojlovic" <news@_N_O_S_P_AM_dragojlovic.org> wrote in message news:4B*****************@newssvr14.news.prodigy.co m...
Actually, I type all my controls in HTML View because I don't like to work with the form designer. Yet in spite of that, VS often manages to "see" them and place them into the codebehind.

"Steve C. Orr, MCSD" <St***@Orr.net> wrote in message news:OQ**************@TK2MSFTNGP11.phx.gbl...
If you drag the control from the toolbox then it should always put the declaration in the code behind for you, assuming such an action is valid for that control. For instance, if you drag an HTML control instead of a webform and you don't mark it as a server control then the definition will not be in the code behind because it's not valid to be there.
Also, if you type in the control definition into the HTML view of your page (instead of dragging it from the toolbar onto the designer view of your form) then I wouldn't expect VS.NET to automatically put the definition into the code behind for you.

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
"Boban Dragojlovic" <news@_N_O_S_P_AM_dragojlovic.org> wrote in message news:g6******************@newssvr14.news.prodigy.c om...

I create a new webform (I always use codebehind), and I insert some server-side controls into the form (the ASPX)

Later, I switch to codeview, and I notice that some (sometimes all) of the controls I created have been automatically defined for me in the
#Region " Web Form Designer Generated Code "
section

Later, when I add more controls this no longer happens.
First, I'm wondering which of my actions causes it to no longer do this;

and

is there a command I can issue to force it to "review" the ASPX page and re-synchronize the codebehind form?

Nov 17 '05 #3
I would agree with this theory as the HTML code gets "tidied up" when
switching to design and back to HTML (tables and other elements get
indented, etc).

"S. Justin Gengo" <sj*****@aboutfortunate.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Boban,

I've noticed similar happenings. I have an untested theory. Could you
sometimes be switching directly from the html view to the codebehind? And
other times switching from the html view to the design view and THEN to the
codebehind?

My theory is that if you switch from html view to design view the page gets
processed and your objects are added to the codebehind.

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Boban Dragojlovic" <news@_N_O_S_P_AM_dragojlovic.org> wrote in message
news:4B*****************@newssvr14.news.prodigy.co m...
Actually, I type all my controls in HTML View because I don't like to work
with the form designer. Yet in spite of that, VS often manages to "see"
them and place them into the codebehind.

"Steve C. Orr, MCSD" <St***@Orr.net> wrote in message
news:OQ**************@TK2MSFTNGP11.phx.gbl...
If you drag the control from the toolbox then it should always put the
declaration in the code behind for you, assuming such an action is valid for
that control. For instance, if you drag an HTML control instead of a
webform and you don't mark it as a server control then the definition will
not be in the code behind because it's not valid to be there.
Also, if you type in the control definition into the HTML view of your page
(instead of dragging it from the toolbar onto the designer view of your
form) then I wouldn't expect VS.NET to automatically put the definition into
the code behind for you.
Nov 17 '05 #4

Interesting. You may have hit it on the head.

I just added a control in HTML view (as I always do). I then switched to Design view, and back to HTML view. Then I switched back to codeview, and voila - there it was.

Aaaaahhhhh. What a delight. It is SUCH a pain having to manually define them all in codeview.

Thanks, Justin

"S. Justin Gengo" <sj*****@aboutfortunate.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl...
Boban,

I've noticed similar happenings. I have an untested theory. Could you sometimes be switching directly from the html view to the codebehind? And other times switching from the html view to the design view and THEN to the codebehind?

My theory is that if you switch from html view to design view the page gets processed and your objects are added to the codebehind.

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Boban Dragojlovic" <news@_N_O_S_P_AM_dragojlovic.org> wrote in message news:4B*****************@newssvr14.news.prodigy.co m...
Actually, I type all my controls in HTML View because I don't like to work with the form designer. Yet in spite of that, VS often manages to "see" them and place them into the codebehind.

"Steve C. Orr, MCSD" <St***@Orr.net> wrote in message news:OQ**************@TK2MSFTNGP11.phx.gbl...
If you drag the control from the toolbox then it should always put the declaration in the code behind for you, assuming such an action is valid for that control. For instance, if you drag an HTML control instead of a webform and you don't mark it as a server control then the definition will not be in the code behind because it's not valid to be there.
Also, if you type in the control definition into the HTML view of your page (instead of dragging it from the toolbar onto the designer view of your form) then I wouldn't expect VS.NET to automatically put the definition into the code behind for you.

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
"Boban Dragojlovic" <news@_N_O_S_P_AM_dragojlovic.org> wrote in message news:g6******************@newssvr14.news.prodigy.c om...

I create a new webform (I always use codebehind), and I insert some server-side controls into the form (the ASPX)

Later, I switch to codeview, and I notice that some (sometimes all) of the controls I created have been automatically defined for me in the
#Region " Web Form Designer Generated Code "
section

Later, when I add more controls this no longer happens.
First, I'm wondering which of my actions causes it to no longer do this;

and

is there a command I can issue to force it to "review" the ASPX page and re-synchronize the codebehind form?

Nov 17 '05 #5

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

Similar topics

10
by: Alphonse Giambrone | last post by:
I have a web form with 2 user controls on it (UC1 and UC2). Each control has a bound datagrid with textboxes in the footer to add a new row. There are also requiredfieldvalidators in each footer....
13
by: Lloyd Sheen | last post by:
I have now spent 5 hours on google/msdn looking for something useful in the creation of user controls for asp.net. The VS 2003 has very limited support for things such as absolute positioning of...
3
by: David Freeman | last post by:
Hi There! I'm having trouble dynamically adding custom controls. My custom controls does not use code-behind but only <script /> block for programming. So as a result, I don't need to compile my...
0
by: Antoine | last post by:
Forgive me as a beginner in asp.net. I wanted to ask some simple but clear questions, at least I hope they are. Ive seen a control in asp.net that works with codebehind and the good thing about...
2
by: Davids | last post by:
I have an AccessDataSource control and a DataList control and databinding to display the database results. Although there is no Page.DataBind() in my codebehind code it obviously is there...
1
by: Josh | last post by:
I am trying to move some of my more common controls into user controls. However, I seem to have problems maintaining state of databound controls that are contained within user controls. On...
3
by: Mr Newbie | last post by:
I am messing around with Web User Controls at present and (think) I have discovered the following. 1.) The identifier for the control in the code behind must match the ID for the control on the...
3
by: rgparkins | last post by:
Hi This has been asked before but with no resolution so I am putting it out there again in case someone has an answer. 2 user controls with same name List.ascx but different namespace, and I...
0
by: polocar | last post by:
Hi, I have noticed a strange behaviour of CurrencyManager objects in C# (I use Visual Studio 2005 Professional Edition). Suppose that you have a SQL Server database with 2 tables called "Cities"...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.