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

UserControls and Form-Tag

Hi,

My "page1.aspx" looks like that:

<%@ Page ContentType="text/html" Language="C#" %>
<%@ Register tagprefix="INC" tagname="MyTag1" Src="mytag1.ascx" %>
<html
<head>...</head>
<body>
<form runat="server">
<INC:MyTag1 id="mytag1" runat="server" />
</form>
</body>
</html>
And my "mytag1.ascx" looks like that:

<%@ Control Language="C#" ClassName="MyTag" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Net" %>
<%@ Register tagprefix="INC" tagname="Container" Src="container.ascx" %>
<%@ Register tagprefix="INC" tagname="MyDropDownControl"
Src="mydropdowncontrol.ascx" %>

<script language="c#" runat="server">
public void Page_Load(Object sender, EventArgs e)
{
StringBuilder stringBuilder = new StringBuilder();
StringWriter stringWriter;
HtmlTextWriter htmlTextWriter;
stringWriter = new StringWriter(stringBuilder);
htmlTextWriter = new HtmlTextWriter(stringWriter);

MyDropDownControl myddc = (MyDropDownControl)
LoadControl("mydropdowncontrol.ascx");
myddc.Page_Load(sender, e);
myddc.RenderControl(htmlTextWriter);
mycontainer.Content = stringBuilder.ToString();
DataBind();
}
</script>

<INC:Container id="mycontainer" runat="server" Title="some title"
Content=""
/>

And the file "mydropdowncontrol.ascx" contains only an normal
<asp:DropDownList ..> ... but I get the error, that it has to be between
the
<form runat=server> ... </form> tag.... But it is !!!

Where is the error?
Could somebody tell me an easier way to get the "results" of an
usercontrol
as an parameter for the next usercontrol ... Or is the method I used the
best?

Thanks for help,

Alex

Nov 19 '05 #1
2 2657
Did somebody understand my problem?

"Alexander Widera" <aw**@hrz.tu-chemnitz.de.invalid.de> schrieb im
Newsbeitrag news:%2****************@TK2MSFTNGP14.phx.gbl...
Hi,

My "page1.aspx" looks like that:

<%@ Page ContentType="text/html" Language="C#" %>
<%@ Register tagprefix="INC" tagname="MyTag1" Src="mytag1.ascx" %>
<html
<head>...</head>
<body>
<form runat="server">
<INC:MyTag1 id="mytag1" runat="server" />
</form>
</body>
</html>
And my "mytag1.ascx" looks like that:

<%@ Control Language="C#" ClassName="MyTag" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Net" %>
<%@ Register tagprefix="INC" tagname="Container" Src="container.ascx" %>
<%@ Register tagprefix="INC" tagname="MyDropDownControl"
Src="mydropdowncontrol.ascx" %>

<script language="c#" runat="server">
public void Page_Load(Object sender, EventArgs e)
{
StringBuilder stringBuilder = new StringBuilder();
StringWriter stringWriter;
HtmlTextWriter htmlTextWriter;
stringWriter = new StringWriter(stringBuilder);
htmlTextWriter = new HtmlTextWriter(stringWriter);

MyDropDownControl myddc = (MyDropDownControl)
LoadControl("mydropdowncontrol.ascx");
myddc.Page_Load(sender, e);
myddc.RenderControl(htmlTextWriter);
mycontainer.Content = stringBuilder.ToString();
DataBind();
}
</script>

<INC:Container id="mycontainer" runat="server" Title="some title"
Content=""
/>

And the file "mydropdowncontrol.ascx" contains only an normal
<asp:DropDownList ..> ... but I get the error, that it has to be between
the
<form runat=server> ... </form> tag.... But it is !!!

Where is the error?
Could somebody tell me an easier way to get the "results" of an
usercontrol
as an parameter for the next usercontrol ... Or is the method I used the
best?

Thanks for help,

Alex


Nov 19 '05 #2
Sorry for posting in german. Alexander seems to bee german, I am German
and I can't mail him, because this ***censored*** is abusing one of my
mail addresses.

Mein lieber Herr Widera! Bitte unterlassen Sie umgehend das
mißbräuchliche Nutzen von Adressen meiner Domain invalid.de!
Inzwischen sind zwei Mail-Notifikationen von dotnet eingetroffen,
vorgebich ich hätte in diese Newsgroup gepostet. Spam (den sie höchst
rücksichtsloserweise wohl von Ihrer eigenen Adresse weg- und auf
fremde hinleiten wollen) wird Dank Ihres Mißbrauchs erfahrungsgemäß
folgen.

Abusemeldung an Dotnet als Serverbetreiber und t-ipconnect als Ihr
Einwahlprovider ist raus. Ich behalte mir zudem weiterhin vor, alle
zukünftig unter einer meiner Mailadressen geposteten Beiträge
eigenzucanceln.

Nov 19 '05 #3

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

Similar topics

4
by: Andrea Williams | last post by:
Does anyone know of some in depth documentation regarding how to add user controls programatically? I have a User Control, which has some basic html controls, and depending on the number selected...
4
by: Anders K. Jacobsen [DK] | last post by:
Hi I have some common UserControls i want to share between to sites (on the same mashine but on diffrent virtual paths). right now i have on solution file with aprox 10 projects. 2 of these is...
2
by: N. Demos | last post by:
I have a user control with code behind of which two instances are created/declared in my aspx page. The aspx page has code behind also, as I need to access methods of the usercontrols on page...
1
by: Mian Mahboob | last post by:
Nicholas Paldino in my application a have an Windows form on that i place an Panel Control. in Form load event i ganerate an Form in Panel Control on Runtime then get an design time create...
8
by: Søren Dreijer | last post by:
Hi, I realize this is a very common problem, but even though I've scoured the Internet for resources, I can't seem to solve this issue :| I currently have a very simple application. It...
3
by: hula | last post by:
Hello can someone tell me whats the best way to place user controls on a form? I have to place a dynamic numer of usercontrols inside a form and of course the form needs to show up scrollbars....
7
by: Nathan Sokalski | last post by:
I have a page which I dynamically add several usercontrols (*.ascx files) to using the following code: Public Sub Refresh() For Each section As DataRow In Me.GetSections().Rows...
0
by: thirunavukarasukm | last post by:
Hai... How to Usercontrols with Shortcut Keys... I am creating one windows apllication.. the apllication contain many form.. in one form i am used one usercontrol(parent control)..
0
by: Screaming Eagles 101 | last post by:
Hi, since a while I have a problem with a solution containing 2 projects , let's say a project Main with the interface and a project controls with 4 usercontrols, which I use on the 'Main' form. ...
1
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
(I've been away from web app programming for a while. Most of my experience has been in 1.1. Now I'm using vb/Dot Net 2.0) Please explain a couple of things. First, I have a simple-minded...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.