Calling a javascript function from .aspx.cs file

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...
 
E

Eliyahu Goldin

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?
 
M

moni

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..
 
E

Eliyahu Goldin

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..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top