Javascript and ServerControl

C

CalvinKash

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?
 
S

Steve C. Orr [MVP, MCSD]

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.
 

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,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top