microsoft.public.dotnet.framework.aspnet

N

nitc3

How to access script tag attributes in asp.net from code behind?

Thanks in advance
Nitc
 
N

Natty Gur

If i get you right, By accessing properties.

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
 
N

nitc3

Let me rephrase my question.
If you want to add <script language="javascript" src="/aspnet/scripts.js"></script> tag from the code behind page then how would you do it?

For eg. If you want to add link tag you can use this.LinkTag.Attributes["href"] = "Local/Styles/Style.css";

Thanks
Nitc
 
N

Natty Gur

RegisterClientSideScriptBlock("BlockID","<script language="javascript"
src="/aspnet/scripts.js"></script>");

Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114

Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377

Know the overall picture
 
N

nitc3

Natty,
Had to make slight modifications and it worked!
The actual problem was if you do server.transfer to a page which is having an asp.net validations control the WebUIvalidations.js is not loaded some times and it displays an error stating to reinstall the js file by running aspnet_regiis -c command.
The possible solution for this problem is add this code from where you are performing server.transfer.

//ASP.NET bug fix which causes script file not to bind with page
string sEnvVersion=Environment.Version.ToString();

//From 1.0.3705.288 To 1_0_3705_288
sEnvVersion = Regex.Replace(sEnvVersion,"[.]","_");

//Register the client script
RegisterClientScriptBlock("BlockID","<script language=\"javascript\" src=\"/aspnet_client/system_web/"+sEnvVersion+"/WebUIValidation.js\"></script>");

Cheers
nitc3
 

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,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top