Addin Controls to Footer

Discussion in 'ASP .Net' started by Jim Heavey, Dec 1, 2003.

  1. Jim Heavey

    Jim Heavey Guest

    Hello, I am trying to add a control to a footer in code, but I get the
    following error" "Exception Details: System.Web.HttpException: Control
    'txtAddMovieTitle' of type 'TextBox' must be placed inside a form tag with
    runat=server."

    The code that I am using is as follows:

    '* add the Movie Title entry box
    Dim txtbox1 As New TextBox()
    txtbox1.ID = "txtAddMovieTitle"
    txtbox1.Width = New Unit(180)
    txtbox1.Font.Size = New FontUnit(FontSize.Small)
    e.Item.Cells(2).Controls.Add(txtbox1)
    The error message seems to suggest that it is expecting to have a
    "Runat="Server", but That property is not avaialble for me to set in code.

    Any ideas as to what the problem is an how to correct?
    Jim Heavey, Dec 1, 2003
    #1
    1. Advertising

  2. Jim Heavey wrote:
    > Hello, I am trying to add a control to a footer in code, but I get the
    > following error" "Exception Details: System.Web.HttpException: Control
    > 'txtAddMovieTitle' of type 'TextBox' must be placed inside a form tag with
    > runat=server."
    >
    > The code that I am using is as follows:
    >
    > '* add the Movie Title entry box
    > Dim txtbox1 As New TextBox()
    > txtbox1.ID = "txtAddMovieTitle"
    > txtbox1.Width = New Unit(180)
    > txtbox1.Font.Size = New FontUnit(FontSize.Small)
    > e.Item.Cells(2).Controls.Add(txtbox1)
    > The error message seems to suggest that it is expecting to have a
    > "Runat="Server", but That property is not avaialble for me to set in code.
    >
    > Any ideas as to what the problem is an how to correct?
    >
    >
    >


    Actually, it means you have to add it to a FORM which has runat="server"
    set. Do you have a FORM surrounding your repeating control?

    --
    Craig Deelsnyder
    Microsoft MVP - ASP/ASP.NET
    Craig Deelsnyder, Dec 1, 2003
    #2
    1. Advertising

  3. Jim Heavey

    Jim Heavey Guest

    The form which the DataGrid that I am adding the control to is within a
    form and that form is in the aspx file as follows: " <form
    id="Form1" method="post" runat="server">".

    I originally had these controls specified in the "aspx" file, but now I
    find a need to specify them in code.

    So if the form is "runat=Server" and the datagrid is "runat=Server", what
    could the problem be?
    Jim Heavey, Dec 1, 2003
    #3
  4. Jim Heavey wrote:

    > The form which the DataGrid that I am adding the control to is within a
    > form and that form is in the aspx file as follows: " <form
    > id="Form1" method="post" runat="server">".
    >
    > I originally had these controls specified in the "aspx" file, but now I
    > find a need to specify them in code.
    >
    > So if the form is "runat=Server" and the datagrid is "runat=Server", what
    > could the problem be?
    >


    Wait, are you saying that you have more than one form? If so, you can't
    do this with ASP.NET, only one form per page, with id= and runat=server
    on it, surrounding the server controls you're working with.

    --
    Craig Deelsnyder
    Microsoft MVP - ASP/ASP.NET
    Craig Deelsnyder, Dec 1, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jim Butler
    Replies:
    1
    Views:
    577
    seeni
    Nov 14, 2003
  2. Roman S. Golubin

    Re: Addin - context menu - target project name

    Roman S. Golubin, Nov 14, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    763
    seeni
    Nov 14, 2003
  3. w r via .NET 247

    Registering Excel addin

    w r via .NET 247, May 22, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    695
    w r via .NET 247
    May 22, 2004
  4. Jim Heavey

    Addin A Row To Datagrid Header

    Jim Heavey, Nov 18, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    390
    Jim Heavey
    Nov 20, 2003
  5. Henrik
    Replies:
    1
    Views:
    416
    Ken Cox [Microsoft MVP]
    Jul 6, 2006
Loading...

Share This Page