hi leute ich habe wieder ein problem und zwar folgense fehlermeldung in ms vs 2005 beta 2
Control 'TextBox' of type 'TextBox' must be placed inside a form tag with runat=server.
ich muss dynamische textboxen erstellen die labels und auch das panel ließen sich problemlos erstellen aber die textbox das klappt nicht
WAS MACHE ICH falsch ???
hier die Methode :
private void module()
{
//Counter
string xml = Server.MapPath("counter.xml");
XmlDocument counter = new XmlDocument();
counter.Load(xml);
// Aktuellen Stand holen
XmlNode count = counter.SelectSingleNode("count");
int currentCount = int.Parse(count.InnerText);
count.InnerText = currentCount.ToString();
string id;
id = currentCount.ToString();
// Das Panel wird erzeugt
Panel pR = new Panel();
pR.HorizontalAlign = HorizontalAlign.Left;
pR.Wrap = true;
pR.Height = 8000;
pR.Width = 500;
pR.BackColor = System.Drawing.Color.Gainsboro;
//Das Label wird erzeugt
Label modul = new Label();
modul.Text = "Modul : "+id;
modul.ID = "Modul"+id;
pR.Controls.Add(modul);
pR.Controls.Add(new LiteralControl("<br>"));
pR.Controls.Add(new LiteralControl("<br>"));
Label titel = new Label();
titel.Text = "Titel : ";
titel.ID = "Titel"+id;
pR.Controls.Add(titel);
pR.Controls.Add(new LiteralControl("<br>"));
pR.Controls.Add(new LiteralControl("<br>"));
Label thema = new Label();
thema.Text = "Themen : ";
thema.ID = "Themen"+id;
pR.Controls.Add(thema);
pR.Controls.Add(new LiteralControl("<br>"));
TextBox textBox = new TextBox();
textBox.ID = "tb"+id;
pR.Controls.Add(textBox);
pR.Controls.Add(new LiteralControl("<br>"));
Page.Controls.Add(pR);
}
ich hoffe ihr könnt mir helfen 🙂
SORRY hatte es erst bei ADO.NET eingestellt ist doch asp 🙂
jetzt ist es richtig bitte prüft mal 🙂
danke markus
Du musst doch eigentlich nur die Fehlermeldung richtig lesen:
Control 'TextBox' of type 'TextBox' must be placed inside a form tag with runat=server.
Dir fehlt ein <form id="bla" runat="Server"> Tag.
Check einfach mal ob dies in der Seite vorhanden ist.
Dann wird das Panel und die dazugehörige TextBox wahrscheinlich oberhalb des Form Tags erzeugt. Versuch mit Placeholdern zu arbeiten.