Hello ,
I have one gridview with location and check box i want to show selected location on the map but it dont show it still show all location on the map.
Please refere below image for understand what i am trying to say
https://ibb.co/k18rPc
I am done following code for that
protected void GrdLocation_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "select")
{
int ans = 0;
for (int i = 0; i < GrdLocation.Rows.Count; i++)
{
if ((((CheckBox)GrdLocation.Rows[i].FindControl("ChkDel")).Checked) == true)
{
ans = 1;
if (objData.StrDel == null || objData.StrDel == "")
{
objData.StrDel = (((Label)GrdLocation.Rows[i].FindControl("lblLocationId")).Text);
}
else
{
objData.StrDel = objData.StrDel + "," + (((Label)GrdLocation.Rows[i].FindControl("lblLocationId")).Text);
}
}
}
DataSet ds1 = new DataSet();
if (objData.StrDel != "" || objData.StrDel != null)
{
ds1=obj.GetLocationForRoutechecked(objData);
}
if (ans == 0)
{
msgbox("No Record Selected");
//BindGv();
}
else
{
//BindGrid();
rptMarkers.DataSource = ds1;
rptMarkers.DataBind();
ScriptManager.RegisterStartupScript(this, GetType(), "sab", "showGrid();map1();", true);
}
}
}
public DataSet GetLocationForRoutechecked(RouteDispatchMastObj obj)
{
DataSet ds = new DataSet();
try
{
con.Open();
cmd = new SqlCommand("[GetCheckedLocation]", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@SrNo", obj.StrDel);
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
cmd.Dispose();
}
catch (Exception ex)
{
throw;
}
finally
{
if (con.State != ConnectionState.Closed)
{
con.Close();
}
ds.Dispose();
}
return ds;
}
What can i do?please help!!