If Visual Studio 2003 look in your aspx code behind (whatever.aspx.vb) for
in HTML not in DESIGN.
Locate for your <form> tag, once you see it does it have a ID attribute. If
not add one. If you name it as follows:
I just tried it to an existing application I have and it does work.
"Nathan Sokalski" <njsokalski@hotmail.com> wrote in message
news:%23X5nsdBWFHA.2424@TK2MSFTNGP10.phx.gbl...
> That sounds like it would work when I already have a named form, but I
> just want to add a button to the same form as the buttons that are
> hard-coded in the design. Because that form is not created until runtime,
> I have no way to know what it will be named (it has been given the name
> "Form1" when I "View Source" from my browser, but how do I know that will
> not be changed?). Is their a way to refer to this main form without using
> a name? Thanks.
> --
> Nathan Sokalski
> njsokalski@hotmail.com
>
http://www.nathansokalski.com/ >
> "gabe garza" <gbgarza@yahoo.com> wrote in message
> news:BCahe.16497$J12.2805@newssvr14.news.prodigy.com...
>> You Add() to an instance of System.Web.UI.HtmlControls.HtmlForm for
>> BUTTONS.
>> When you use "Me" that's the PAGE not a FORM.
>>
>> If you have a FORM on your PAGE called:
>> Protected WithEvents Form1 As System.Web.UI.HtmlControls.HtmlForm
>>
>> Then you'd add BUTTON controls using:
>> Dim extrabutton As Button = New Button
>> extrabutton.Text = "Generated Button"
>> Form1.Controls.Add(extrabutton)
>>
>>
>> "Nathan Sokalski" <njsokalski@hotmail.com> wrote in message
>> news:OOrSAWAWFHA.2196@TK2MSFTNGP09.phx.gbl...
>>>I am trying to dynamically add controls to my page, but am having trouble
>>>with controls such as buttons. I have been able to add simple controls
>>>such as Label controls, because they can be placed anywhere. I have
>>>managed to add Labels using the following code:
>>>
>>> Dim extralabel As Label = New Label
>>>
>>> extralabel.Text = "Generated Label"
>>>
>>> Me.Controls.Add(extralabel)
>>>
>>>
>>> This places the label at the very end of the generated code inside SPAN
>>> tags. However, when I try something similar with a Button control using
>>> the following code:
>>>
>>> Dim extrabutton As Button = New Button
>>>
>>> extrabutton.Text = "Generated Button"
>>>
>>> Me.Controls.Add(extrabutton)
>>>
>>> I recieve an error telling me that a Button control must be between FORM
>>> tags (which makes sense, since a Button control generates an INPUT tag).
>>> I am having trouble figuring out how to add the Button control so that
>>> it is between the form tags. Does anyone know how to do this? A simple
>>> example would be nice. Any help would be appreciated. Thanks.
>>> --
>>> Nathan Sokalski
>>> njsokalski@hotmail.com
>>>
http://www.nathansokalski.com/ >>>
>>
>>
>
>