all groups > asp.net building controls > april 2005 >
You're in the

asp.net building controls

group:

Javascript and ServerControl



Javascript and ServerControl CalvinKash
4/30/2005 10:37:01 AM
asp.net building controls: Hi,
I'm trying to add Server controls on the JavaScript side, I'm using the
following syntax:
var oText = document.createElement("asp:Label");
div.appendChild(oText);

that works when I use html controls, but doens't work with ASP controls, any
idea why?
Re: Javascript and ServerControl Steve C. Orr [MVP, MCSD]
4/30/2005 11:53:34 AM
The problem is described farily clearly by the names.
You're trying to create a "Server" control from the "Client".
This is not simply not going to work.

As you've discovered, you can create HTML controls from the client though.
You can also read the values from the HTML controls from your server side
code by using the Request.Form object.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net



[quoted text, click to view]

AddThis Social Bookmark Button