c# const in jQuery?

Posted by Cristian Boariu on Stack Overflow See other posts from Stack Overflow or by Cristian Boariu
Published on 2010-03-21T09:36:41Z Indexed on 2010/03/21 9:41 UTC
Read the original article Hit count: 289

Filed under:
|
|
|

Hi guys, I have this piece of code in javascript:

 var catId = $.getURLParam("category");

In my asp.net and c# code for "category" query string i use a public const:

public const string CATEGORY = "category";

so if i want to change the query string parameter to be "categoryTest" i only change this const and all the code is updated.

Now the question is: how can i do something similar for the javascript i have in the same application (so i want to use the same constant)?

I mean i want something like this:

var catId = $.getURLParam(CQueryStringParameters.CATEGORY);

but because there are none asp.net tags, my const is not interpreted...

Any workaround?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about c#