Showing posts with label google. Show all posts
Showing posts with label google. Show all posts

Saturday, March 24, 2012

Mystery of the Un-positionable DragPanel!

I am creating a portal page for my company's intranet, a la Google homepage. Since DropZones seem like such a pain to work with, I decided to take a different approach to the widget movement, and use Javascript. My idea requires that I move a Panel (which also happens to be the subject of the DragPanelExtender) using "Style:top" and "Style:left". The problem is, I can't seem to get this to work, no matter how I form the line.

 function adjustToColumn(e){
//get location var widg= getWholeWidgetOnDrop(e); var location= $common.getLocation(widg); x= location.x; y= location.y; alert(x +"," + y);
//set location

//widg.style("top","100px"); //, "100px");
//widg.Attributes.CssStyle.Add("top", "100px");
}

 
In the above code, 'getWholeWidgetOnDrop' returns the outermost panel containing the entire widget.
The 'get' portion of this code works just fine.
However, no matter how I form the 'set' portion, I always seem to get an error.
I've tried widg.Attributes.Style.Add, widg.Attributes.Add, among countless others, and they always come back
saying that either 'Attributes... is null or not a method" or "Object does not have this method or property"
I'm all out of ideas! 
 Help please?!Big Smile 

Hello,

Use the Javascript debugger in your set call with the line 'debugger;'.

Then, add the widg variable to the watch window. I believe you will need 'widg.style.top'. Check out jquery as well for manipulating dom objects.

Regards,

Louis


Thanks for the reply.

I tried widg.style.top, and unfortunately it didn't work either...

However, this morning, I ran across another command that DID work. I used Sys.UI.DomElement.setLocation(element, x, y) ; This worked like a CHAMP. Supposedly, you can abbreviate this by using $common.setLocation(element, x, y); but for some reason or the other, this didn't work for me.

I appreciate the help, though!

--Dustin

need HELP

how do i add client-side validation on cascading dropdownlist for ajax ext controls?

i look almost all the post and Google it but i didn't find any post which helps me, any help please?

thanks.

Doesn't a validation control work?

never mind, i implement the customvalidation actually they way i want does not work with RFV

thanks

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.