Click here to Skip to main content
15,911,132 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# new linq to sql file problem Pin
vinodkrebc7-Jul-12 17:12
vinodkrebc7-Jul-12 17:12 
QuestionC# add table to linq to sql file problem Pin
dcof6-Jul-12 14:17
dcof6-Jul-12 14:17 
QuestionC# filename, linenumber logging Pin
TheGreatAndPowerfulOz6-Jul-12 6:44
TheGreatAndPowerfulOz6-Jul-12 6:44 
AnswerRe: C# filename, linenumber logging Pin
TheGreatAndPowerfulOz6-Jul-12 7:10
TheGreatAndPowerfulOz6-Jul-12 7:10 
GeneralRe: C# filename, linenumber logging Pin
PIEBALDconsult6-Jul-12 7:28
mvePIEBALDconsult6-Jul-12 7:28 
GeneralRe: C# filename, linenumber logging Pin
TheGreatAndPowerfulOz6-Jul-12 7:58
TheGreatAndPowerfulOz6-Jul-12 7:58 
AnswerRe: C# filename, linenumber logging Pin
Luc Pattyn6-Jul-12 10:38
sitebuilderLuc Pattyn6-Jul-12 10:38 
QuestionHow to display Information window by clicking on the push pin in Google Maps in C# Pin
ChandrakanthGaddam6-Jul-12 5:26
ChandrakanthGaddam6-Jul-12 5:26 
Hi This is Chandra,
presently working on GoogleMaps. Right now i can able to bind the langitude and latitude dynamically based on selection of country. That is multiple locations i can able to display in the map.Here my problem is i want to display information window when i click any one of the location. Please find my code below in C~ as well as Asp.net

C# Code:-

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bindInfo();
}
}

protected void bindInfo()
{
try
{
SqlConnection con = new SqlConnection("Data Source=xxx;Initial Catalog=Test;Persist Security Info=True;User ID=xxx;Password=xxx$;Connect Timeout=38000;pooling='true'; Max Pool Size=200");
con.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "GetCountryNames";
cmd.ExecuteNonQuery();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
ddlPostalCode.DataTextField = "Country";
ddlPostalCode.DataValueField = "Country";
ddlPostalCode.DataSource = ds.Tables[0];
ddlPostalCode.DataBind();
con.Close();
}
catch (Exception x)
{
Response.Write(x.ToString());

}
}

private void GetLocation(string CName)
{

try
{

SqlConnection con = new SqlConnection("Data Source=xxxx;Initial Catalog=Test;Persist Security Info=True;User ID=xxxx;Password=xxxx$;Connect Timeout=38000;pooling='true'; Max Pool Size=200");
con.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "GetLocationWiseInfo";
SqlParameter param = new SqlParameter();
param.ParameterName = "@Name";
param.Value = ddlPostalCode.SelectedItem.Text.ToString();
cmd.Parameters.Add(param);
cmd.ExecuteNonQuery();
SqlDataAdapter da = new SqlDataAdapter(cmd);

DataSet ds = new DataSet();
da.Fill(ds);

con.Close();
BuildScript(ds);

}
catch (Exception x)
{
Response.Write(x.ToString());

}

}

public void BuildScript(DataSet tbl)
{
string Locations = "";
foreach (DataRow dr in tbl.Tables[0].Rows)
{
if (dr["Latitude"].ToString().Trim().Length == 0)
continue;
string Latitude = dr["Latitude"].ToString();
string Longitude = dr["Longitude"].ToString();
string Sales = dr["Sales"].ToString();
Locations += Environment.NewLine + " map.addOverlay(new GMarker(new GLatLng(" + Latitude + "," + Longitude + ")));";
}

js.Text = @"<script type='text/javascript'>
function initialize() {
if (GBrowserIsCompatible())
{
var map = new GMap2(document.getElementById('map_canvas'));
map.setCenter(new GLatLng(45.05,7.6667), 2);
" + Locations + @"
map.setUIToDefault();
}
}
";

}
protected void btnPlaceName_Click(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
GetLocation(ddlPostalCode.SelectedItem.Text.ToString());

}
}


ASPX Code:








<asp:label id="lblName" runat="server" text="Please Select PostalCode">
<asp:dropdownlist id="ddlPostalCode" runat="server" width="150px"
="">

<asp:button id="btnPlaceName" runat="server" text="GetGeoData" onclick="btnPlaceName_Click">




<asp:panel id="Panel1" runat="server">
<asp:literal id="js" runat="server">
<asp:literal id="js1" runat="server">












In the dataset i am getting rows like Longitude, Latitude and sales data based on selection of Country.

Can any one suggest me how to do that?

Thanks
Chandra
AnswerRe: How to display Information window by clicking on the push pin in Google Maps in C# Pin
Wes Aday6-Jul-12 6:29
professionalWes Aday6-Jul-12 6:29 
AnswerRe: How to display Information window by clicking on the push pin in Google Maps in C# Pin
Luc Pattyn6-Jul-12 10:40
sitebuilderLuc Pattyn6-Jul-12 10:40 
QuestionQuestion about MesageBoxIcon... Pin
glennPattonWork36-Jul-12 4:59
professionalglennPattonWork36-Jul-12 4:59 
GeneralRe: Question about MesageBoxIcon... Pin
OriginalGriff6-Jul-12 6:21
mveOriginalGriff6-Jul-12 6:21 
GeneralRe: Question about MesageBoxIcon... Pin
glennPattonWork38-Jul-12 21:40
professionalglennPattonWork38-Jul-12 21:40 
QuestionNetworking connection Pin
S.Alexanser6-Jul-12 2:47
S.Alexanser6-Jul-12 2:47 
AnswerRe: Networking connection Pin
Eddy Vluggen6-Jul-12 3:05
professionalEddy Vluggen6-Jul-12 3:05 
GeneralRe: Networking connection Pin
S.Alexanser6-Jul-12 3:42
S.Alexanser6-Jul-12 3:42 
GeneralRe: Networking connection Pin
Eddy Vluggen6-Jul-12 5:01
professionalEddy Vluggen6-Jul-12 5:01 
AnswerRe: Networking connection Pin
jschell6-Jul-12 11:12
jschell6-Jul-12 11:12 
GeneralAlgorithm to handle overlapping appointments Pin
Dick de Zeeuw6-Jul-12 1:02
Dick de Zeeuw6-Jul-12 1:02 
GeneralRe: Algorithm to handle overlapping appointments Pin
Dave Kreskowiak6-Jul-12 4:52
mveDave Kreskowiak6-Jul-12 4:52 
GeneralC# 2010 files Pin
sc steinhayse5-Jul-12 10:49
sc steinhayse5-Jul-12 10:49 
GeneralRe: C# 2010 files Pin
Dave Kreskowiak5-Jul-12 12:01
mveDave Kreskowiak5-Jul-12 12:01 
GeneralRe: C# 2010 files Pin
sc steinhayse5-Jul-12 16:23
sc steinhayse5-Jul-12 16:23 
GeneralRe: C# 2010 files Pin
OriginalGriff5-Jul-12 20:39
mveOriginalGriff5-Jul-12 20:39 
GeneralRe: C# 2010 files Pin
Abhinav S5-Jul-12 16:19
Abhinav S5-Jul-12 16:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.