Professional Web Applications Themes

automatic insertion of controls on codebehind - ASP.NET General

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

  1. #1

    Default 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?



    Boban Dragojlovic Guest

  2. #2

    Default Re: automatic insertion of controls on codebehind

    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" <SteveOrr.net> wrote in message news:OQ9BI3WUDHA.1624TK2MSFTNGP11.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
    [url]http://Steve.Orr.net[/url]


    "Boban Dragojlovic" <news_N_O_S_P_AM_dragojlovic.org> wrote in message news:g6ETa.47$uP7.7666802newssvr14.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?



    Boban Dragojlovic Guest

  3. #3

    Default Re: automatic insertion of controls on codebehind

    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:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche
    "Boban Dragojlovic" <news_N_O_S_P_AM_dragojlovic.org> wrote in message news:4BETa.51$sg.9096303newssvr14.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" <SteveOrr.net> wrote in message news:OQ9BI3WUDHA.1624TK2MSFTNGP11.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
    [url]http://Steve.Orr.net[/url]


    "Boban Dragojlovic" <news_N_O_S_P_AM_dragojlovic.org> wrote in message news:g6ETa.47$uP7.7666802newssvr14.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?



    S. Justin Gengo Guest

  4. #4

    Default Re: automatic insertion of controls on codebehind

    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" <sjgengoaboutfortunate.com> wrote in message
    news:%230N2nYYUDHA.2364TK2MSFTNGP09.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:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche
    "Boban Dragojlovic" <news_N_O_S_P_AM_dragojlovic.org> wrote in message
    news:4BETa.51$sg.9096303newssvr14.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" <SteveOrr.net> wrote in message
    news:OQ9BI3WUDHA.1624TK2MSFTNGP11.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.


    news.public.microsoft.com Guest

  5. #5

    Default Re: automatic insertion of controls on codebehind


    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" <sjgengoaboutfortunate.com> wrote in message news:%230N2nYYUDHA.2364TK2MSFTNGP09.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:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche
    "Boban Dragojlovic" <news_N_O_S_P_AM_dragojlovic.org> wrote in message news:4BETa.51$sg.9096303newssvr14.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" <SteveOrr.net> wrote in message news:OQ9BI3WUDHA.1624TK2MSFTNGP11.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
    [url]http://Steve.Orr.net[/url]


    "Boban Dragojlovic" <news_N_O_S_P_AM_dragojlovic.org> wrote in message news:g6ETa.47$uP7.7666802newssvr14.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?



    Boban Dragojlovic Guest

Similar Threads

  1. Ad Insertion
    By reefnet_alex in forum Macromedia Flash Flashcom
    Replies: 2
    Last Post: September 19th, 03:12 PM
  2. automatic insertion of title atribute taken from links and or images extension
    By zero in forum Macromedia Exchange Dreamweaver Extensions
    Replies: 0
    Last Post: October 21st, 06:00 PM
  3. Need help for Record Insertion
    By steinp in forum Dreamweaver AppDev
    Replies: 0
    Last Post: April 17th, 08:14 AM
  4. User Controls and CodeBehind
    By Marc Hoeppner in forum ASP.NET General
    Replies: 1
    Last Post: July 17th, 01:17 AM
  5. Refrencing user controls in codebehind
    By Victor Garcia Aprea [MVP] in forum ASP.NET Building Controls
    Replies: 2
    Last Post: July 16th, 12:33 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139