UserControls and Form-Tag

A

Alexander Widera

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
 
U

U.Heidenreich

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.
 

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

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top