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...
 
you can just use:

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

or use ajax which is more complex
 
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
 
Back
Top