472,980 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,980 software developers and data experts.

Loading Dynamic User Control Error: "The control must be placed inside a form tag with runat=server" Help Please Second time posting.

Hi,

I have a panel that I load user Control in no problem. The problem
arrises when I do a post back on one of these user controls. I have
button it does a click event. In this click event I will do some
database updates, then I will use reflection to call a method in the
parent (this.page) to load the new user control. Its at this point
after it loads the new user control that it throws the error "The
control must be placed inside a form tag with runat=server".
Now, my methods that managers the user control works. I am able to
click on the parent page menu and load other user controls no problem.
This only occurs when I'm trying to load a new user control in place of
the current user control from the current child user control.

So something like this:

Parent page has method:

public void PostBackLoadUserControl(string Description, string
fileName)
{
LoadUserControl(fileName);

}

Current user control click event does this:

protected void Button1_Click(object sender, EventArgs e)
{
//Session.Add("LoadUC", new string[] { "Test Control 4",
"test4.ascx" });

MethodInfo mi =
this.Page.GetType().GetMethod("PostBackLoadUserCon trol",
BindingFlags.Public | BindingFlags.Instance);
if (mi != null)
mi.Invoke(this.Page, new Object[] { "Test Control",
"test.ascx"});

}

The mi.Invoke works and after it loads in the new user control it comes
back to the Button1_Click event and leaves ok. After that the page
tries to load with the new user control and throws the error "The
control must be placed inside a form tag with runat=server".
This control will be inside a form tag when its loaded because it is
loaded into a panel that is inside a form tag. I'm not sure why this
only happens when trying to do it from a child user control.

Thank,

David

Aug 31 '06 #1
0 3350

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: whoopdaddy | last post by:
We are streaming a PDF file out of an ASPX page in IIS 5 using Response.WriteFile so the user does not need permissions to the directory where the files are stored. This works great when the user is...
0
by: Hawksey | last post by:
Hello, Has anyone else experienced a similar problem. We get an intermittent error trying to send mail using smtpmail. Our SmtpMail.SmtpServer is a different server to our web application...
3
by: Scott McDermott | last post by:
I have an application that is making an HTTP request with HttpWebRequest.GetRequest. Unless I set 'httpWebRequest useUnsafeHeaderParsing="true"' in the web.config, I get a 'The server committed a...
0
by: jdbss | last post by:
How do you access the DOM or HTML controls which are not "runat=server" for a page from server side code? For example, a I want to access each row of a table from the server as well as from the...
0
by: Glenn | last post by:
Hi All: I have written an Users Registration system that is working just fine when I point to an Active Directory running within a local VMWare instance. It's a very basic AD schema. But, when...
1
by: alien_attack | last post by:
I have the a repeater which is databound to an XmlDatasource. Inside the repeater is a Label as follows: <asp:Label ID="lbl" runat="server" Text='<%# XPath("Asset_Metadata/@Value")%>' /> ...
2
by: Wimpie van Lingen | last post by:
Hey I have some more questions with regards to Remoting in .NET 2. I'm using TCP with the Binary formatter. My solution consists of 4 projects: - Class Library containing the server classes...
3
by: cmk817 | last post by:
Hi All, I'm just starting out (sort of)... and i can't even get connected to a database. We have an intranet server running CF... I'm trying to connect using dreamweaver... something funky is...
1
by: LiveCycle | last post by:
Hi, I've got a longstanding project that's been working fine for about a year. I was working on one of the pages, a simple download page. After making a little tweak on the page, I tried to...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.