Calling a javascript function from .aspx.cs file

  • Thread starter Thread starter moni
  • Start date Start date
M

moni

Hi,

I wanted to call a javascript function

function showAddress(address)
{
.....
}

from the aspx.cs file from the Gridview_RowCommand function

protected void GridView1_RowCommand(object sender,
GridViewCommandEventArgs e)
{
......
//got a string value a
//showAddress(a);
}

How would i be able to call the function from here.

Any help will be appreciated.

Thanks alot...
 
The Gridview_RowCommand function runs on server. Javascript function runs in
client's browser. That is in different time and in different place. You
likely may not need a trip to the server in the first place. What are you
trying to achieve?
 
The Gridview_RowCommand function runs on server. Javascript function runs in
client's browser. That is in different time and in different place. You
likely may not need a trip to the server in the first place. What are you
trying to achieve?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldin




I wanted to call a javascript function
function showAddress(address)
{
....
}
from the aspx.cs file from the Gridview_RowCommand function
protected void GridView1_RowCommand(object sender,
GridViewCommandEventArgs e)
{
.....
//got a string value a
//showAddress(a);
}
How would i be able to call the function from here.
Any help will be appreciated.
Thanks alot...- Hide quoted text -

- Show quoted text -

Hi..

I am actually getting the value, the user selects from the gridview so
that I get the address from the SQL server, and then i am using google
maps javascript, to display the map.

Thx..
 
You should communicate your intention to show the map and the address from
server to client. You can do in hidden input fields. This article can help
you:

How to Pass Messages and Actions between Server and Client
http://usableasp.net/DeveloperPage....o/HowToPassMessagesBetweenServerAndClient.htm

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


moni said:
The Gridview_RowCommand function runs on server. Javascript function runs
in
client's browser. That is in different time and in different place. You
likely may not need a trip to the server in the first place. What are you
trying to achieve?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldin




I wanted to call a javascript function
function showAddress(address)
{
....
}
from the aspx.cs file from the Gridview_RowCommand function
protected void GridView1_RowCommand(object sender,
GridViewCommandEventArgs e)
{
.....
//got a string value a
//showAddress(a);
}
How would i be able to call the function from here.
Any help will be appreciated.
Thanks alot...- Hide quoted text -

- Show quoted text -

Hi..

I am actually getting the value, the user selects from the gridview so
that I get the address from the SQL server, and then i am using google
maps javascript, to display the map.

Thx..
 
Back
Top