473,327 Members | 1,976 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,327 software developers and data experts.

Error on adding custom control using RenderControl()

Hi,
In my webpage, i am adding my user control using rendercontrol() using the following code:

Dim NumericEditControl As New Control
NumericEditControl = LoadControl("Controls\NumericEdit.ascx")

Dim sb As New StringBuilder()
Dim sw As New StringWriter(sb)
Dim htw As New HtmlTextWriter(sw)

NumericEditControl.RenderControl(htw)
Panel.Controls.Add(ParseControl(sb.ToString()))


Control 'NumericEditTextBox' of type 'TextBox' must be placed inside a form tag with runat=server

The user control will not have any form tag defined in it. The above code is defined in a web page.
Am I missing something? Any help on this is highly appreciable..
Jul 6 '07 #1
5 3160
kenobewan
4,871 Expert 4TB
That numericedittextbox must be placed in a form is this the problem?
Jul 6 '07 #2
That numericedittextbox must be placed in a form is this the problem?
The numericedittextbox is withing the user control and the usercontrol will not have any form tag defined in it.
Jul 6 '07 #3
dip_developer
648 Expert 512MB
Hi,
In my webpage, i am adding my user control using rendercontrol() using the following code:

Dim NumericEditControl As New Control
NumericEditControl = LoadControl("Controls\NumericEdit.ascx")

Dim sb As New StringBuilder()
Dim sw As New StringWriter(sb)
Dim htw As New HtmlTextWriter(sw)

NumericEditControl.RenderControl(htw)
Panel.Controls.Add(ParseControl(sb.ToString()))

Control 'NumericEditTextBox' of type 'TextBox' must be placed inside a form tag with runat=server

The user control will not have any form tag defined in it. The above code is defined in a web page.
Am I missing something? Any help on this is highly appreciable..
not sure but I have a doubt......while adding your control to panel you may try.............
Expand|Select|Wrap|Line Numbers
  1.  Page.FindControl("Form1").FindControl("Panel").Controls.Add(ParseControl(sb.ToString()))
Jul 6 '07 #4
not sure but I have a doubt......while adding your control to panel you may try.............
Expand|Select|Wrap|Line Numbers
  1.  Page.FindControl("Form1").FindControl("Panel").Controls.Add(ParseControl(sb.ToString()))
I have tried that also, but the ParseControl is creating error.
Jul 6 '07 #5
dip_developer
648 Expert 512MB
I have tried that also, but the ParseControl is creating error.
then some R & D is needed.....lets think.....
Jul 6 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: TD | last post by:
This is the code under a command button - Dim ctl As Control For Each ctl In Me.Controls If ctl.BackColor <> RGB(255, 255, 255) Then ctl.BackColor = RGB(255, 255, 255) End If Next ctl
2
by: Tom Bray | last post by:
Ok I am baffled I can not figure out this problem. I am getting the following error: Portal Error - A DropDownList cannot have multiple items selected. Error information Name Value Message...
6
by: blash | last post by:
Can someone help me? I really don't have a clue. My company staff told me they often got such error: "Object reference not set to an instance of an object." when they are in search result page...
5
by: Nathan Sokalski | last post by:
When running a page I am working on, I recieve the following error: Cannot use a leading .. to exit above the top directory. I suspect this has something to do with the problem I posted in a...
0
by: Ross M | last post by:
Dear Microsoft, I m getting this error message, on every SECOND attempt to access a web service on a foreign PC. I am using .net framework 2 beta 2 with Visual Web developer 2. Below is the...
2
by: Pipo | last post by:
Nobody knows how to get the values provided in the client can be read in the user-control? If have made a Web Custom Control with 2 textboxes and 1 dropdownlist. The user fills in my control (the...
7
by: Jonas | last post by:
Hi. I'm trying to develop a web custom control that uses a programmatically created treeview. My problem is that I get an exception when I try to render the control. With properties do I have to...
3
by: weboweb | last post by:
Hi, I'm new in web parts, I would like to understand a couple of things: Let's say I have a custom control that displays information. That info is fed to the control through an XML string, so...
0
by: apenly | last post by:
Hi all- I'm trying to Render a TreeView in a custom control, but I'm receiving a NullReferenceException at runtime. If I put the TreeView on the page it works fine, but as soon as I try to...
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...
1
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: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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: 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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.