473,386 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Problem in adding template of server side control using client side scripts

I have an aspx page which have the following code segment:

<script>
// I do something here
template = "<input id=\"hidden_info_1\" type=\"hidden\"
runat=\"server\">
// I do other things here
</script>

When I tried to run, it returns "Parser Error Message: The Runat attribute
must have the value Server."

Basically I want to create a server-side control with client-side
javascript. I can get rid of the error by removing the \" from the front and
back of "server", but I still want to find a way to have it double-quoted.
And actually this checking should not be inside any <script> tags,
especially when it is just a string. Any ideas?

I know I can do it at the server-side, but because the controls are supposed
to be added too frequently so that the overhead for the whole
"client-server-client" trip is just not acceptable.

--
If you want to mail to me, please replace all instance of "e" to "a" in my
email address. Thank you.
Sorry for any inconvience caused, but there's many spam-mailers.
Nov 18 '05 #1
1 1678
I found that just remove the \" won't work, it continues to complain
\"hidden_info_1\" is not a valid ID.
Now I have to move the whole thing to a seperate .js file to make it work.
Just for your information......

"Lau Lei Cheong" <le****@yehoo.com.hk> ¦b¶l¥ó
news:ev*************@TK2MSFTNGP09.phx.gbl ¤¤¼¶¼g...
I have an aspx page which have the following code segment:

<script>
// I do something here
template = "<input id=\"hidden_info_1\" type=\"hidden\"
runat=\"server\">
// I do other things here
</script>

When I tried to run, it returns "Parser Error Message: The Runat attribute
must have the value Server."

Basically I want to create a server-side control with client-side
javascript. I can get rid of the error by removing the \" from the front and back of "server", but I still want to find a way to have it double-quoted.
And actually this checking should not be inside any <script> tags,
especially when it is just a string. Any ideas?

I know I can do it at the server-side, but because the controls are supposed to be added too frequently so that the overhead for the whole
"client-server-client" trip is just not acceptable.

--
If you want to mail to me, please replace all instance of "e" to "a" in my
email address. Thank you.
Sorry for any inconvience caused, but there's many spam-mailers.

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Kathryn | last post by:
Hiya I have a problem with using some client side and server side scripting together in an ASP. I'm using VBScript. What I'm trying to achieve is this - - Page loads up and some server side...
1
by: Jax | last post by:
I am looking to populate web page with controls as a result of a database query. eg (pseudocode) <% foreach(Garment g in GetStuffFromDB()) { //add controls Response.Write("<asp:Button id =...
5
by: | last post by:
Hi, I'm trying to use the cookie munging session handling behaviour of asp.net instead of cookies themselves as I'm finding quite a few people are barring cookies (especially AOL users). If I...
7
by: | last post by:
What is the beat way to dynamically write/add to the HEAD tag of an ASPX page (the <head runat=server ... is too error prone and not very repeatable)? Thanks.
4
by: earwicker | last post by:
I recently deployed a web application which contains a user registration form with the usual fields: name, address, email, password, etc. Each of the TextBoxes uses a validation control to verify...
3
by: http://www.visual-basic-data-mining.net/forum | last post by:
I have the following problem. My asp.net page has one html list box control and I made that as "RUN AS SERVER" so that I could access it in client side script as well as server side script. And also...
3
by: Nathan Sokalski | last post by:
I have a validator that I wrote by inheriting from BaseValidator. At certain points in the code, I need to access other controls on the page containing the validator. I have the IDs of these...
4
by: Lewis Holmes | last post by:
Hi I have the following situation in one of my asp.net pages. The user can add multiple table rows to a form by selecting a button. These rows can contain asp.net controls. When this button is...
3
by: Crazy Cat | last post by:
Hi all, I am developing an asp.net 2.0 application in Visual Studio 2005. On my page I have a simple datalist that is bound programmatically to a collection of simple objects. On this page I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.