|
 |
aspx thread: Concatenate <input type=""checkbox"" vs. <asp:textbox
Message #1 by "Jose Haymaker" <ehaymaker@a...> on Tue, 16 Oct 2001 19:04:58
|
|
Of these two the first shows up in an html page, but the second one
doesn't. Anybody know why?
response.write ("<input type=""textbox"" name=""myBox"" runat=""server"">")
response.write ("<asp:textbox id=""prodid"" runat=""server"" />")
Message #2 by "Jeffrey Widmer" <jeffwids@a...> on Tue, 16 Oct 2001 14:25:31 -0400
|
|
Response.write is used for writing strings directly out to the output
stream. So any tags that a browser would understand would be translated
correctly. A browser does not understand the <asp:textbox> tag. So if you
view the source from the browser you will see the tag there but it has not
been translated into anything.
You have to use the Page_Prerender or Page_Load events to insert the textbox
object into the page. Then the asp.net engine will translate this "server"
tag into the correct html (in this case the asp:textbox tag would be
translated into the input type=textbox tag).
Pretty much, the difference is what is happening on the server verse what is
happening on the client.
Hope this helps.
-Jeff
-----Original Message-----
From: Jose Haymaker [mailto:ehaymaker@a...]
Sent: Tuesday, October 16, 2001 7:05 PM
To: ASP+
Subject: [aspx] Concatenate <input type=""checkbox"" vs. <asp:textbox
Of these two the first shows up in an html page, but the second one
doesn't. Anybody know why?
response.write ("<input type=""textbox"" name=""myBox"" runat=""server"">")
response.write ("<asp:textbox id=""prodid"" runat=""server"" />")
Message #3 by "Samuel Engelman" <samuel_engelman@p...> on Tue, 16 Oct 2001 14:24:27 -0400
|
|
You are sending server side code (asp:textbox) to the browser. If you look at
source from the browser you will probably see the asp code.
The correct way to build a textbox through code would be something like this:
TextBox t = new TextBox();
t.visible = true;
If you need it positioned you can put a panel and add the following line to the
code
panel.Controls.add(t);
Please let me know if you need more help on this
|--------+--------------------------------->
| | "Jose Haymaker" |
| | <ehaymaker@a...> |
| | |
| | |
| | Tuesday October 16, 2001 03:04|
| | PM |
| | Please respond to "ASP+" |
| | |
|--------+--------------------------------->
>----------------------------------------------------------------------------|
| |
| To: "ASP+" <aspx@p...> |
| cc: |
| Subject: [aspx] Concatenate <input type=""checkbox"" vs. |
| <asp:textbox |
>----------------------------------------------------------------------------|
Of these two the first shows up in an html page, but the second one
doesn't. Anybody know why?
response.write ("<input type=""textbox"" name=""myBox"" runat=""server"">")
response.write ("<asp:textbox id=""prodid"" runat=""server"" />")
|
|
 |