|
-
Mar 28th, 2006, 02:12 AM
#1
Thread Starter
Lively Member
[2.0] Passing an integer argument into a javascript function
Hi,
How do we pass an integer argument from C# into a javascript function?
I declare an integer variable first, then I pass it into the javascript function.
But the javascript code didnt execute correctly.
//First, an integer variable is declared
int numofItems;
// Returns the Javascript code to attach the context menu to a HTML element
public string GetMenuReference()
{
return String.Format("return __showContextMenu({0},numofItems);", Controls[0].ClientID);
}
//Then the Javascript is called when the oncontextmenu event happens
ctl1.Attributes["oncontextmenu"] = GetMenuReference();
Initially the javascript function has the {0} argument only and it worked fine. But when I added one more integer argument, it doesnt work. What is the correct way to pass an int argument ?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|