odoe
[H]F Junkie
- Joined
- Oct 10, 2001
- Messages
- 9,796
Ok, I'm a bit stumped on this portion of a web app I am working on.
I'm not a hardcore developer by any means, but I have had to learn C# over the past year or so for work and I'm still learning. I just recently dived into the nitty gritty of javascript.
I have a variable that is pulled from a database and have the ability to use javascript to grab it.
In my C#, I have a function that creates a Gridview based off a single variable passed to the function.
I'm trying to use javascript to create a hyperlink that will pass the variable to the C# function that creates the Gridview in the same page.
Basically, I'm thinking of calling a javascript function that will call a C# function.
like "onclick='toCsharp(" + variable + ")'"
then
function toCsharp(mine)
{
go to csharp already damnit
}
I have found plenty of documentation on passing C# variables to javascript functions, but not the other way around.
The only other thing I can think of is creating another page with the Gridview function, adding the variable to the URL and using regular expressions to grab the variable from the URL, but I'd like to avoid that if I can.
If I haven't provided enough detail, let me know.
This web page is using a ScriptManager if that matters at all.
I'm not a hardcore developer by any means, but I have had to learn C# over the past year or so for work and I'm still learning. I just recently dived into the nitty gritty of javascript.
I have a variable that is pulled from a database and have the ability to use javascript to grab it.
In my C#, I have a function that creates a Gridview based off a single variable passed to the function.
I'm trying to use javascript to create a hyperlink that will pass the variable to the C# function that creates the Gridview in the same page.
Basically, I'm thinking of calling a javascript function that will call a C# function.
like "onclick='toCsharp(" + variable + ")'"
then
function toCsharp(mine)
{
go to csharp already damnit
}
I have found plenty of documentation on passing C# variables to javascript functions, but not the other way around.
The only other thing I can think of is creating another page with the Gridview function, adding the variable to the URL and using regular expressions to grab the variable from the URL, but I'd like to avoid that if I can.
If I haven't provided enough detail, let me know.
This web page is using a ScriptManager if that matters at all.