Ask a Question related to ASP.NET General, Design and Development.
-
Sonali.NET[MVP] #1
Re: Error adding a simple textbox to a webform
Me.Page.Controls(1).Controls.Add(x)
HTH
Regards
Sushila
..NET MVP
"Andrés Giraldo" <andres_giraldo@yahoo.com> wrote in message
news:#KVQO3zODHA.3768@tk2msftngp13.phx.gbl...> Hi!
>
> I'm trying to experiment, adding controls to a webform, but I obtain
> always the same error,
>
> My Code looks like this:
>
> -----------------------------------------------------------
>
> Public Class WebForm1
> Inherits System.Web.UI.Page
>
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> Dim x As New System.Web.UI.WebControls.TextBox()
>
> Me.Page.Controls.Add(x)
> End Sub
> End Class
>
> -----------------------------------------------------------
>
> And my aspx like this:
>
> <%@ Page Language="vb" AutoEventWireup="false"
> Codebehind="WebForm1.aspx.vb"
> Inherits="PlantillaHistoriaClinica.WebForm1"%>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML>
> <HEAD>
> <title>WebForm1</title>
> <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
> <meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
> <meta name="vs_defaultClientScript" content="JavaScript">
> <meta name="vs_targetSchema"
> content="http://schemas.microsoft.com/intellisense/ie5">
> </HEAD>
> <body MS_POSITIONING="GridLayout" runat="server">
> <form id="Form1" method="post" runat="server">
> </form>
> </body>
> </HTML>
>
> -----------------------------------------------------------
>
> And the error is this:
>
> The control '_ctl1' of type 'TextBox' must be inside a form label with
> runat=server
>
> I've already have the form, so how can I insert controls inside the
> form???
>
> Thanks!
>
> -----------------------------------------------------------
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
Sonali.NET[MVP] Guest
-
Adding a Textbox to a toolbar for a plug-in
Just like the "Zoom" and "Find" toolbars have, how do I add this object to a custom toolbar? Or get the text from the existing ones? I'm using... -
bind data to a textbox in a template column in WebForm DataGrid
Hi, I am trying to put a textbox in a template column both for displaying and editing. When I add the following line to the HTML code... -
runat="server"....a simple html textbox or a webform server textbox...that is the question.
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the... -
MVP is this a BUG? Adding button element corrupts textbox event!!!
Hi, I posted earlier about my textbox textchanged event no longer firing. I've found the cause but NOT the reason. On a fairly simple aspx form,... -
VERY STRANGE BUG? Adding a textbox control causes other textbox control to fail???
I've had this happen a few times too. I'm still not positive of what exactly causes it but all that's happening is the control that no longer...



Reply With Quote

