Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I have a google map project which is showing every added Event on the map in the evnet database but i need to show the events when users filter it by the Chif guest or country or by category.......plz help me???
Posted
Updated 28-Nov-13 0:23am
v2
Comments
TrushnaK 28-Nov-13 6:36am    
Information is not enough. improve your question what you want exactly.
S.M.Arsalan 28-Nov-13 6:54am    
please review a solution i am using
ExpertITM 28-Nov-13 6:36am    
Just select filter records from db..and do same as for all records
S.M.Arsalan 28-Nov-13 6:54am    
please review a solution i am using

1 solution

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using ClassLibrary1;


public partial class _Default : System.Web.UI.Page
{Class1 cl=new Class1();
protected void Page_Load(object sender, EventArgs e)
{
}
// This method is used to convert datatable to json string
public string ConvertDataTabletoString()
{
DataTable dt = new DataTable();
using (SqlConnection con = new SqlConnection("Data Source=arsalan\\sqlexpress;Initial Catalog=FindEvent;Integrated Security=true"))
{
using (SqlCommand cmd = new SqlCommand("select lat=latitude,lng=longitude,ename=eventName,chiefguest fron Event", con))
{

con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);

da.Fill(dt);
System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
List<dictionary><string,>> rows = new List<dictionary><string,>>();
Dictionary<string,> row;
foreach (DataRow dr in dt.Rows)
{
row = new Dictionary<string,>();
foreach (DataColumn col in dt.Columns)
{
row.Add(col.ColumnName, dr[col]);
}
rows.Add(row);
}
return serializer.Serialize(rows);
}
}
}
protected void Button3_Click(object sender, EventArgs e)
{
if (DropDownList6.SelectedItem.Text == "By Country")
{
DropDownList3.DataSource = cl.showCountry();
DropDownList3.DataValueField = "C_ID";
DropDownList3.DataTextField = "C_Name";
DropDownList3.DataBind();
}
else if (DropDownList6.SelectedItem.Text == "By Category")
{
DropDownList3.DataSource = cl.showcategory();
DropDownList3.DataValueField = "C_ID";
DropDownList3.DataTextField = "C_Name";
DropDownList3.DataBind();
}
else
{
DropDownList3.DataSource = cl.showarea();
DropDownList3.DataValueField = "A_ID";
DropDownList3.DataTextField = "A_Name";
DropDownList3.DataBind();
}
}
protected void Button4_Click(object sender, EventArgs e)
{
{
if (DropDownList6.SelectedItem.Text == "By Country")
{
GridView1.DataSource = cl.countryID(Convert.ToInt16(DropDownList3.SelectedValue));
GridView1.DataBind();
}
else if (DropDownList6.SelectedItem.Text == "By Category")
{
GridView1.DataSource = cl.categoryID(Convert.ToInt16(DropDownList3.SelectedValue));
GridView1.DataBind();
}
else
{
GridView1.DataSource = cl.areaID(Convert.ToInt16(DropDownList3.SelectedValue));
GridView1.DataBind();
}
}
}
}

}
 
Share this answer
 
Comments
S.M.Arsalan 28-Nov-13 6:44am    
In the upper solution i was getting the result on grid view but now i want to show it on map with markers

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900