What is wrong with this code

string licenseNumber = "MyKeyValue"; 

imglnk.Url = "javascript:OpenTextbook( " + licenseNumber + " )";

Error is:

Error: LIC0002 is not defined
Source File: javascript:OpenTextbook( LIC0002 )
Line: 1


HighOnCoding
Wanna get high!
0
azamsharp
8/19/2005 3:00:08 PM
asp.net.client-side 24353 articles. 1 followers. Follow

2 Replies
483 Views

Similar Articles

[PageSpeed] 38

 azamsharp wrote:
string licenseNumber = "MyKeyValue";
imglnk.Url = "javascript:OpenTextbook( " + licenseNumber + " )";
Error is:
Error: LIC0002 is not defined
Source File: javascript:OpenTextbook( LIC0002 )


As the error message states (and a view source would confirm) your output is:

   javascript:OpenTextbook( LIC0002 )

which is invalid, since strings in JS must be quoted (as usual). So rewrite it as:

   imglnk.Url = "javascript:OpenTextbook(\"" + licenseNumber + "\")";

whose output is:

   javascript:OpenTextbook("LIC0002")

(I do not use C# so check the sintax for the escape sequence...)

HTH. -LV
Julio P. Di Egidio
Software Analyst Programmer
=BUSINESS AND SCIENTIFIC=
=SOFTWARE DEVELOPMENT=
http://julio.diegidio.name

(Peace X Love] = [++1)
0
LudovicoVan
8/19/2005 3:42:07 PM
Yeah I got it fixed. 

I had to include the quotes.

THanks,


HighOnCoding
Wanna get high!
0
azamsharp
8/19/2005 6:00:17 PM
Reply:

Similar Artilces:

client side code & server side code
what is the difference between client side coding & server side coding ? when to use client side & server side code? Client side code runs on the user's browser and includes languages such as javascript and vbscript. Server side code runs on the web server and can be written in languages such as ASP.NET, PHP, ASP, ColdFusion etc. Website Design Darlington - http://mdssolutions.co.ukhttp://lessthandot.com - Experts, Information, Ideas & Knowledgehttp://aspnetlibrary.com - An online resource for professional ASP.NET developersPlease remember to click "Mark as Answer...

executing server side code and client side (javascript) code simultaneously while clicking a button
how to execute server side code and client side (javascript) code simultaneously while clicking a button in asp.net. You can't. When clicking a button: the client-side executes, the page does a PostBack, then the server-side executes.NC... what if i want to update a database and then open a new windows is it possible with Jscript.net?...

How to Pass Information from Server-Side Code to Client-Side Code in AJAX Control Extender?
Hi All,For some reason I can't get the following to work: I have a custom AJAX Control Extender with a few getters and setters. I also have some images I want to use with the extender saved in a resource file. How to I make the respective image URLs available to the javascript of the extender? Are there any examples available?Thanks![Update: renamed the subject to something more appropriate.]  Perhaps I can clarify a bit:I have set up a getter and setter to set the image URL from the resource file: 1 [ExtenderControlProperty] 2 public string CoverURL 3 { 4 get...

Is it possible to call client side function from server side code without initial client request?
Atlas is great. I'm using timer to periodically check database changes on server to populate client side controls with new data. Is it possible to do it without a lot of client requests to server which takes a huge useless network traffic? Server should call client side function on all connected clients when, for example, 'database updated' event occurs on server. Thanks. Hi~ Just for your interest, I think you could have a look at Comet, many web IM like Gmail's embeded Gtalk and meebo.com are built on this architecture你好! Just FYI o_O...

XMLHTTP in .Net
I'm trying to convert an ASP page that uses XMLHTTP. At first I removed the XMLHTTP code and used regular server side code. Now I'm finding the XMLHTTP code (or something like it) might be needed. The situation is that the page has a lot of data on it in text boxes and drop down lists and response is very slow each time we send data back and forth to the server. On the ASP page the XMLHTTP was used to limit the trips to the server and the amount of data sent back and forth. It was used in client side code to do things like populate a drop down list when the value in a different drop down ...

client side and server side code
Making things clear:When creating a web application one must know the difference between client side code and server side code.client side code is the code that is executed on the computer of the user. server side code is the code that is executed on the ....server.why is there client side code and server side code?well... server side code exist for the reason of sharing data with multiple users. for example: accessing a database.ASP.NET is a server side technology. in ASP.net you can use different languages such as VB.NET or C#.client side code is used to perform tasks on the computer of th...

Local Client-side printing using server vb.net code?
Hi,Rather than use the window.print() command which is just a form dump.  I want to use vb.net code to do this as it has all the features necessary.I came across this useful article from developers.com.  http://www.developer.com/net/net/article.php/3102381However, when I run this it throws an exception because there is no default printer attached to the server.  Of course I don't want to print server side - thats no good.  But print client side.  The users would print to whatever print queue on the network they have connected to their own pc.I thought ...

Execute the client side and server side code
Hi, Hi, I have two drop down lists one ddl1, ddl2. when ddl1 index is changed I have to change the label before the ddl1 and contents of ddl2. 1) to change the label before ddl2, I am using the javascript like this:ddl1.Attributes.Add("onchange", "changeLabelText(this); return false;"); Javascript function<script language="javascript"> function changeLabelText(ddl) { var indx = ddl.selectedIndex; var lbl = document.getElementById('<%= lblSelect.ClientID %>'); if(indx == 0) lbl.innerHTML = "Select A:"; if(indx == 1)lbl.i...

Client side to execute server side code
I am maintaining an ASP.NET C# application written by someone else.  I am essentially a newbie to web development especially client side stuff.  Based on reading these forums I understand that I can't directly call a server side method from the client side and I have to use post pack in some way (using a webservice is not an option here).  My confusion comes from the HTML setup being used.The page has three frames; a header, body and footer.  Each frame is filled by it's own ASPX page.  The footer contains buttons for navigating to another page and some of the b...

Calling server-side code from client-side
Hi,  I´m implementing some shortcut functionality in my web forms and wanna know where i can find something that explains, for example, how to call the handler event "onclick" of a button. I´m using this library to add shortcuts to my controls: http://www.openjs.com/scripts/events/keyboard_shortcuts/   And I want to "link" some key combination for the event handlers of the controls. Does anybody knows?  Thanks. You could attach an AJAX event to the Javascript shortcut event handler so, for example, the shortcut function will trigger a button cl...

Question about client side and code behind code
How is code behind code processed on client side? I ask because I'm trying to figure out a problem I have with a link button in a gridview. If I open the page and run it as normal everything fires fine. I click on the link button and it loads the new page. However if I email the page to myself and click on the link button nothing happens. I do not think that the Gridview_Rowcommand fires. The link button represents a DB ID field and all the code is in the GridView_RowCommand event in the code behind and fires a Server.Transfer at the end to load the new page. I have tried Response.Redi...

How to Excecute Server side code in Client Side
I have a Textbox with linkButton on right side.  if i click linkbutton i have one text box agian in poup. if we enter some text and click search button i am showing ListView with searched data in Poup. the Listview contains one Radio Button at eash row. Now my request is if i select one radiobuton and click "OK"  the poup should close and display the selected row text in TextBox in my Page where the Linkbutton Presents. i can do it on my server side on "Okbutton_Click" . i wabnt to do this in Client side only with out PostBack.   Is ther...

Loading client side variables from server side code
Just curious whether anyone has seen a better way to implement the following. It doesn't seem like the best way! What I'm doing is passing in an array of values to the client via server side code. The reason for this is because I'd like the server to do most of the crunch work and then pass the final results to the client. I use the 'onload' event of an image. code behind: imgLoader.Attributes.Add("onload", "Init('Tag1;Tag2;Tag3')") client-side. The page also contains an image called 'imgLoader'. var Entities = new Array(); function Init(s) ...

Writing cline side code from VB.NET code
I have a script where in I want to write client side javascript code and send it to the browser where it will display the disired affects. But the client side tag "</script>" makes the ASP.NET engine look at it as an end of the main server side block:<script Language="VB" Option="Explicit" runat="server"> I am using inline code for VB.NET, not code behind. With warm regards,Dolphus PerieraWith warm regards,Dolphus Pereira The script block tag you posted is marked as runat="server" which makes it a server side script block ??Mike Banavige~~~~~~~~~~~~Need a site code sample i...

what type of code is appropriate for client-side and server-side
Hi, I have a very simple and basic question.. What type of code should ideally go to the .aspx and what kind should be written in the code-behind ? For example, In an application that gets data from database and display it on the website, should I write all ADO.net code in code-behind and all code related to UI such as datagrid population in JavaScript on .aspx page ?? In other words, all business logic code should go to code-behind and UI in .aspx ?? In some of the Ajax development resources, all code is written in .aspx and nothing in .cs, so I am a little confused here. Thanks, &n...

Web resources about - What is wrong with this code - asp.net.client-side

Wrong - Wikipedia, the free encyclopedia
while civil law countries tend to have some additional categories, such as contraventions . Moral wrong is an underlying concept for legal wrong, ...

NASCAR Directs Facebook Users To Wrong TV Network For Pure Michigan 400
Facebook pages are a useful tool for brands to share information, but they may want to ensure that the information being shared is correct, which ...

Ken Ham - Well, our new “Thank God You're Wrong” billboard... - Facebook
Well, our new “Thank God You're Wrong” billboard campaign began with a big bang (☺ ) yesterday—which we praise the Lord for. As expected, many ...

Facebook says bug caused wrong contact syncing on some users’ phones
A contact synchronization bug, combined with Facebook’s latest changes to users’ email visibility settings , led some mobile phones to update ...

What Went Wrong (@AmericaWWW) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Scripting News: Silicon Valley is wrong about college.
Lately I've been thinking a lot about startup culture, and am reminded of its nobility having started three companies in my career, and learned ...

Scripting News: Why Charles Pierce is wrong about Ezra Klein being wrong.
... Pierce's attitude many times, from all kinds of ink-stained pros, some very accomplished. The arrogance is impressive, but they're still wrong. ...

Scripting News: I had to get a NYT Digital Subscription to figure out what's wrong.
Yesterday I posted a tweet with some feedback for the NY Times marketers. Getting a NYT Digital Subscription should open up something new and ...

Scripting News: Privacy is the sometimes wrong word.
You can talk about the security of your personal information in a different ways, each of which suggests a different set of issues. If I call ...

Don’t Take the Wrong Paths to Power
... it, and hoard it. If you have to bruise egos along the way, so what? No one will care or even remember how you got to the Don’t Take the Wrong ...

Resources last updated: 11/29/2015 3:21:34 AM