[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 385
  • Last Modified:

Command button to trigger an event

Hi Guys,

I know I am about to ask a very silly question, but how do I get my command button to show my google map only when it is clicked.
0
xmalcolm
Asked:
xmalcolm
  • 2
  • 2
1 Solution
 
lazyberezovskyCommented:
Silly answer:
1) Open designer.
2) Drag Asp:Button from toolbox to your page.
3) Double click on button.
4) Add your code to generated click event handler
0
 
xmalcolmAuthor Commented:
Yes I know that but what code do I need to put in? In the aspx.cs file I already have:

protected void btnSearch_Click(object sender, EventArgs e) {

}

But what I want is for the google map to only initialise when this command button is clicked.
0
 
lazyberezovskyCommented:
Well, if you are not going to build commercial site, try
http://en.googlemaps.subgurim.net

Very simple Asp.Net control. Just add reference to dll, register control
<%@ register assembly="GMaps" namespace="Subgurim.Controles" tagprefix="subgurim" %>

and place to your page:
<subgurim:GMap ID="GMap1" runat="server" />

And button click:
protected void Button1_Click(object sender, EventArgs e)
{
    GMap1.setCenter(new GLatLng(51, 12), 6);
}

Voila
0
 
xmalcolmAuthor Commented:
I found an easier way to do it. That is by making another page and having a Response.Redirect ("ToYourPage.aspx") command assigned to the command button. But thanks anyway.
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now