__aspnetForm

  • Thread starter Fredrik Elestedt
  • Start date
F

Fredrik Elestedt

Hi,

I'm having problems with renaming a form when using templates.
The template type I'm using can be found here:
http://www.charon.co.uk/content.aspx?CategoryID=28&ArticleID=42
http://www.charon.co.uk/content.aspx?CategoryID=28&ArticleID=43

To summarize the articles...
I'm overriding the AddParsedSubObject() method to load a template
usercontrol, code as follows:

protected override void AddParsedSubObject(System.Object Control) {
if (pageTemplate == null)
LoadTemplate();
}

protected void LoadTemplate() {
pageTemplate =
(page_template)Page.LoadControl("/templates/page_template.ascx");
}

And in OnInit i call
base.AddParsedSubObject(pageTemplate);

This means that page_template.ascx will be displayed instead of the current
page unless I add more controls to the page (which is done but I don't see
that that is relevant in this case).
My problem is that whatever I set the ID tag in the template to (or any
other page for that matter), it always renders to __aspnetForm

Any ideas on a solusion is appriciated.

// Fredrik
 
G

Guest

Fredrik,

I'm going to assume that you have your form tags inside of your user control
(template file). Remove those, as this will force renaming and continue to
cause you pain in various aspects of the control. Also notice that IIS on XP
Pro will rename your form differently than IIS on W2K Server or W2K3 Server.
Moving the form tag into the containing page will resolve your issue of
renaming.

Thanks,
Ian Suttle
http://www.IanSuttle.com
 
F

Fredrik Elestedt

Ian,

Thanks for the reply.

I do like the idea of having the server form tag in the template file -
since I use it on all pages. But if this is the only "good" solution I will
take it. The downside is that the template will not be able to contain
controls which want to do postbacks - not that it will bother me in this
implementation, but perhaps some othertime...

Currently running on W2K3 - .NET 1.1 SP1

// Fredrik
 
G

Guest

Fredrik,

When you take the form tags out of the user control, place them in the page
that has the user control in it:

<form runat="server">
<uc1:myControl runat="server" id="myControl1" />
</form>

You will still be able to work with postbacks using this method.

Thanks,
Ian Suttle
http://www.IanSuttle.com
 
G

Guest

Hello,

I'm also having a similar problem because all my classes are control based.

Basically, my .aspx files are "hosts" to my main code which is in the .ascx
files/classes. I tried moving the <form...> tags to the .aspx files and put
the include between them, the project won't compile because it doesn't "see"
my server-side controls in the .ascx file as within the <form...> tags even
though technically they are.

Is there no way to get around this? It's a huge overwork for me to move the
code to the .aspx files because my classes derive from multiple levels using
the controls.

Any ideas would be greatly appreciated.
 
G

Guest

Please disregard my last message. Putting the <form...> in the .aspx DID
work. I messed up my code in my haste. Thank you very much for pointing me
in the right direction.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top