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

Guest

you can just use:

Response.Write("<script language='javascript'>showAddress();</script>");

or use ajax which is more complex
 
M

moni

you can just use:

Response.Write("<script language='javascript'>showAddress();</script>");

or use ajax which is more complex

--
sharepoint developper












- Show quoted text -

Hi..

This is not displaying the map, I am creating using Javascript.

I am calling it this way:

Response.Write("<script
language='javascript'>showAddress(getAddress);</script>");

where, getAddress is the comma-seperated Address string.

I am trying to use google maps.

If I call the javascript function from my aspx file I use:

<input type="text" id="addresstext" value="Huntington Avenue,
Boston, MA" name="yourName" style="width: 287px" />
<input type="button" id="addressclick" value="Display Map"
onclick="showAddress(addresstext.value)" /><br />

and it works. But using the Response.Write from the aspx.cs file it
does not display it. Am I passing the value wrongly??

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

Top