Showing posts with label value. Show all posts
Showing posts with label value. Show all posts

Wednesday, March 28, 2012

Multiple updates with Ajax

I have two dropdownboxes, one that is dependent on the other for the value. I have these dropdown boxes in an update panel using a sqldatasource on both of them. The second dropdown box uses the selected value from the first dropdown box to populate its content. I also have two text boxes that are start and end dates that are based on the second dropdown box. For further clarification, I have a publication dropdown box that will populate the issue dropdown box with a listing of all issues for that publication and also will populate the start and end dates for that issue. However, when I select a different publication and the issue is on another month, the issue then is updated but not the start and end dates. How would I go about accomplishing this?

//

//

Publication: ARCHI-TECH Buildings Interiors and SourcesIssue: April 2007 March 2007 January 2007 January/February 2007 December 2006 November/December 2006 October 2006 September 2006 September/October 2006 July 2006 July/August 2006 June 2006 May/June 2006 March/April 2006 January 2006 January/February 2006 November 2005 November/December 2005 September/October 2005 July 2005 July/August 2005 June 2005 May 2005 May/June 2005 April 2005 March/April 2005 February 2005 January 2005 January/February 2005 December 2004 November 2004 November/December 2004 September/October 2004 August 2004 July/August 2004 May/June 2004 March 2004 February 2004 January 2004*Section: Please Select a Section Awards Bottom Line Energy Issues Career CaseStudy CoverStory FastTalk Feature Innovations Awards - 2001 Innovations Awards - 2002 Interior Design Award - 2001 Interior Design Award 2002 News NextPage OnlineExclusive Opinion Product Smarter SmarterBuildings SubArticle TechWork theBuzz ViewPoint Who'sWho

Start Date:**End Date:**

Can you post the ASPX, or explain how you have this set up? Are the textboxes inside of the updatepanel? Do you have the textboxes in a separate updatepanel that has a trigger set? Are you updating the textbox values in the page_load event? You should try stepping through your code, and ensure that the code responsible for setting the text in the textboxes is actually being reached. If it is, verify that the textboxes are inside of an update panel. Control outside of the updatepanel can not be udpated asynchronously (unless insdie of another updatepanel).

Wednesday, March 21, 2012

Need help with implementing google map with Ajax

Hi, i am making use of the Google maps to save a location, i wanted to save the lat and lng value of the marker into my database, but without any success. Could someone enlighten me pls, many thanks in advance

<%@dotnet.itags.org. Page Language="VB" %
<%@dotnet.itags.org. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<script runat="server"
Protected Sub post_Click(ByVal sender As Object, ByVal e As System.EventArgs)


Try
eventDataSource.Insert()
Catch ex As Exception

End Try
End Sub
</script
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>map</title>
<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>
<link href="http://links.10026.com/?link=jiawei.css" rel="stylesheet" type="text/css" />
<script src="http://pics.10026.com/?src=http://maps.google.com/maps?file=api&v=2&key=ABQIAAAATWDgkaMeL60f_hR3JzHgQBRBZbUqgwWQv7nmLu01TGDQYDe1qhRYsXRdid8s1O4VSMi4tlCJ6WMXJA"
type="text/javascript"></script>

<script type="text/javascript"
//<![CDATA[

function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(37.4419, -122.1419), 13);

GEvent.addListener(map, "click", function(marker, point) {
if (marker) {
map.removeOverlay(marker);
} else {
map.addOverlay(new GMarker(point));
}
var slat=point.lat();
var slng=point.lng();
document.getElementById('lat').innerHTML=slat;
document.getElementById('lng').innerHTML=slat;

});
}
}

//]]>
</script>
</head>
<body id="event" onload="load()" onunload="GUnload()">
...

<div id="map" style="width: 600px; height: 400px"></div>
<asp:Label ID="lat" runat="server" Text=""></asp:Label>
<asp:Label ID="lng" runat="server" Text=""></asp:Label><br />
<asp:Button ID="post" runat="server" Text="Post" ><br />
......
</body>
</html>.

Hi There,

jwillbe:

Hi, i am making use of the Google maps to save a location, i wanted to save the lat and lng value of the marker into my database, but without any success. Could someone enlighten me pls, many thanks in advance

<%@. Page Language="VB" %
<%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<script runat="server"
Protected Sub post_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles post.Click


Try
'eventDataSource.Insert() DO YOUR INSERT HERE
Catch ex As Exception

End Try
End Sub
</script
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>map</title>
<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>
<link href="http://links.10026.com/?link=jiawei.css" rel="stylesheet" type="text/css" />
<script src="http://pics.10026.com/?src=http://maps.google.com/maps?file=api&v=2&key=ABQIAAAATWDgkaMeL60f_hR3JzHgQBRBZbUqgwWQv7nmLu01TGDQYDe1qhRYsXRdid8s1O4VSMi4tlCJ6WMXJA"
type="text/javascript"></script>

<script type="text/javascript"
//<![CDATA[

function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(37.4419, -122.1419), 13);

GEvent.addListener(map, "click", function(marker, point) {
if (marker) {
map.removeOverlay(marker);
} else {
map.addOverlay(new GMarker(point));
}
var slat=point.lat();
var slng=point.lng();
document.getElementById('lat').innerHTML=slat;
document.getElementById('lng').innerHTML=slat;

document.getElementById('post').click(); // you can use this to click the button when you make a marker



});
}
}

//]]>
</script>
</head>
<body id="event" onload="load()" onunload="GUnload()">
...

<div id="map" style="width: 600px; height: 400px"></div>
<asp:Label ID="lat" runat="server" Text=""></asp:Label>
<asp:Label ID="lng" runat="server" Text=""></asp:Label><br />
<asp:Button ID="post" runat="server" Text="Post" ><br />
......
</body>
</html>.

Please refer to the bold line.

1) Add event handler to post button

2) When you click on google map, use that event to trigger your button too.

e.g

document.getElementById('post').click(); // you can use this to click the button when you make a marker


i tried ur method, but the lat and lng values are still unable to save into my database, btw the lat n lng attributes are set to String data type in my database

Hi There,

By the way, did you set parameter value to your datasource

e.g. say your eventdatasource insert startment have 2 parameter. lat and lng

eventDataSource.InsertParameters["lat"].DefaultValue = lat.Text;

eventDataSource.InsertParameters["lng"].DefaultValue = lng.Text;

'eventDataSource.Insert() DO YOUR INSERT HERE

If above not working

Did you add insert statement to your eventdatasource ?

Can you should me your datasource.


i don't quite get ur question do u mean this?

<InsertParameters>
<asp:ControlParameter ControlID="tb_eventTitle" DefaultValue="" Name="eventTitle"
PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="fromDate" DefaultValue="" Name="fromDate" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="toDate" DefaultValue="" Name="toDate" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="fromTime" DefaultValue="" Name="eventTimeHr" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="toTime" DefaultValue="" Name="eventTimeMin" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="tb_desc" DefaultValue="" Name="eventDesc" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="tb_venue" DefaultValue="" Name="eventVenue" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="lat" Name="lat" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="lng" Name="lng" PropertyName="Text" Type="String" />
</InsertParameters>


Hi There,

Yes, this is what im talking about.

In your

Protected void post( object sender, System.EventArgs e )

{

// on save your data, you require to set the value to your parameter // like following

eventDataSource.InsertParameters["lat"].DefaultValue = lat.Text;

eventDataSource.InsertParameters["lng"].DefaultValue = lng.Text;

}


hi there, i am quite new in programming, where do i put that piece of code to?


hi there, i am new to programming, where do i put that piece of code into?


Hi There,

Didn't notice that you are using VB.

Put the code as below

<script runat="server"
Protected Sub post_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles post.Click

Try

' SET YOUR PARAMETER VALUE BEFORE INSERT

eventDataSource.InsertParameters["lat"].DefaultValue = lat.Text

eventDataSource.InsertParameters["lng"].DefaultValue = lng.Text

' AND ALL OTHER VALUE THAT YOU NEED TO IN YOUR INSERT STATEMENT


eventDataSource.Insert() DO YOUR INSERT HERE


Catch ex As Exception

End Try

End Sub


</script>

Also, have a look at this tutorial, it give you idea how to use datasourcehttp://www.asp.net/learn/dataaccess/default.aspx?tabid=63


hi there, i am using the sqldatasource control, the insert statement was already created

INSERT INTO [eEvent] ([eventTitle], [fromDate], [toDate], [eventTimeHr], [eventTimeMin], [eventDesc], [eventVenue], [lat], [lng]) VALUES (@.eventTitle, @.fromDate, @.toDate, @.eventTimeHr, @.eventTimeMin, @.eventDesc, @.eventVenue, @.lat, @.lng)

thx a lot anyway


Hi There,

jwillbe:

INSERT INTO [eEvent] ([eventTitle], [fromDate], [toDate], [eventTimeHr], [eventTimeMin], [eventDesc], [eventVenue], [lat], [lng]) VALUES (@.eventTitle, @.fromDate, @.toDate, @.eventTimeHr, @.eventTimeMin, @.eventDesc, @.eventVenue, @.lat, @.lng)

You have to pass value to the sqldatasource as argument ( e.g. value for (@.eventTitle, @.fromDate, @.toDate, @.eventTimeHr, @.eventTimeMin, @.eventDesc, @.eventVenue, @.lat, @.lng)

My previous post is teaching you how to set value to it.


Can the datasource wrong? Check again.