I want to build an application that when clicking on a point on a map, it send an ajax request that changes some server controls on my page:
$.post("Default.aspx",
{ latLng: event.latLng });
on the same page:
<asp:Panel runat="server" Visible="false" ID="SaveForm">
<asp:Label runat="server" Text="Save your result:" Font-Size="X-Large"></asp:Label><br /><br />
<asp:TextBox runat="server" ID="Latitude" ReadOnly="true"></asp:TextBox><br />
<asp:TextBox runat="server" ID="Longitude" ReadOnly="true"></asp:TextBox><br />
<asp:TextBox runat="server" ID="Score" ReadOnly="true"></asp:TextBox><br />
<asp:TextBox runat="server" ID="Comment" Width="500px" Height="200px"></asp:TextBox>
<asp:Button runat="server" OnClick="Save" />
</asp:Panel>
aspx.cs:
protected void Page_Load(object sender, EventArgs e)
{
if (Session["userId"] == null)
Response.Redirect("LoginForm.aspx");
if (Request["latLng"] != null)
{
String latLng = Request["latLng"];
SaveForm.Visible = true;
char[] delimiterChars = { '(', ',', ')'};
String[] numbers = latLng.Split(delimiterChars);
Latitude.Text = numbers[0];
Longitude.Text = numbers[1];
Score.Text = (getScore(float.Parse(numbers[0]), float.Parse(numbers[1]))).ToString();
}
}
Of course this doesn't work, because it isn't even logical that it would. But from this code you can get the idea of what I am trying to do and help me. Thanks!