I have a Gmap Control where i add lots of points(markers) via c# code.
Directly after i add the marker i add a GListener to all the markers.
Now i have a few buttons on the web page that when a user clicks one of them the map gets refreshed to show only relative markers.
Everything works fine when the user clicks the first button but when the user clicks on any other button the Glistener just doesnt work but the markers does change accordingly.
Here is some code where i add the markers and listeners.
marker = new GMarker(new GLatLng(lat, lng), new GIcon(Gicon));
clicklistener = new GListener(marker.ID, GListener.Event.click, string.Format(#"function(){{var w=new google.maps.InfoWindow();w.setContent('<center><b>{0}</b></center></br><center>{3}</center></br><center>{4}</center></br><center>{5}</center></br><center>{6}</center>');w.open({1}, {2});}}", SName + " , " + FacType, GMap1.GMap_Id, marker.ID, "Printer Status: " + PrinterStatus.ToString() + ", Battery: " + Sbat + "V Signal: " + SSignal + "%", "Scanner Status: " + ScannerStatus.ToString(), "SMS Received: " + Sreceived + " , SMS Sent: " + Ssent, "Last SMS Date: " + SsmsDate.ToString() + " , Last Comms Date: " + ScommsDate.ToString()));
The Marker and clicklistener is globally defined and gets added to the map via gmap1.add(marker) and gmap1.add(clicklistener)
any ideas?
Regards
Patrick
Sorted.
All that needed to be done is a complete reset of the whole map like so:
GMap1.reset();
and then just add the new markers and listeners as necessary :)
Related
I'm creating an application in C#. In this i can create a meeting request that is sent to the user through code and appears in Outlook mail.
The below code is what I am using to send the meeting invitation. It is working fine.
StringBuilder OutlookBody = new StringBuilder();
string textvs = #"BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN
VERSION:1.0
BEGIN:VEVENT
LOCATION:" + Location + #"
DTSTART:" + string.Format("DTSTART:{0:yyyyMMddTHHmmssZ}", start) + #"
DTEND:" + string.Format("DTEND:{0:yyyyMMddTHHmmssZ}", end) + #"
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:= " + OutlookBody + #"=0D=0A SUMMARY:" + AppoitmentName + #"
PRIORITY:3
END:VEVENT
END:VCALENDAR";
How can i use the same code to remove outlook meeting request.
I have also checked this answer, but it didn't solve my problem.
In OutLook every appointment/meeting will get a unique Id and a ChangeKey. A new ChangeKey is generated whenever there is a modification done to the meeting. To update an existing meeting you must have the Id and latest ChangeKey.
In your approach, if I am not wrong, you are just constructing an ICAL which is added to the outlook via email. In this case, you will not have the Id and ChangeKey to modify the meeting programatically. I would rather suggest you to change the approach.
If you have Microsoft Exchange the following links will guide. Else, ignore the links.
https://msdn.microsoft.com/en-us/library/office/dn495611(v=exchg.150).aspx
https://msdn.microsoft.com/en-us/library/office/dn495612(v=exchg.150).aspx
You can set the method and status of the meeting by adding these lines:
METHOD: CANCEL
STATUS: CANCELLED
See more here.
Use the following code
StringBuilder OutlookBody = new StringBuilder();
string textvs = #"BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN
VERSION:1.0
BEGIN:VEVENT
LOCATION:" + Location + #"
DTSTART:" + string.Format("DTSTART:{0:yyyyMMddTHHmmssZ}", start) + #"
DTEND:" + string.Format("DTEND:{0:yyyyMMddTHHmmssZ}", end) + #"
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:= " + OutlookBody + #"=0D=0A SUMMARY:" + AppoitmentName + #"
PRIORITY:3
METHOD:CANCEL
STATUS:CANCELLED
END:VEVENT
END:VCALENDAR";
And use the following Mime Type
System.Net.Mime.ContentType mimeType = new System.Net.Mime.ContentType("text/calendar; method=CANCEL");
AlternateView alternate = AlternateView.CreateAlternateViewFromString(body, mimeType);
message.AlternateViews.Add(alternate);
I solved this issue by changing some lines in code.
Change method from REQUEST to CANCEL ==> str.AppendLine("METHOD:CANCEL");
Change Status to Cancelled ==> str.AppendLine("STATUS:CANCELLED");
In System.Net.Mime.ContentType contype = newSystem.Net.Mime.ContentType("text/calendar"); change method from REQUEST to CANCEL ==> contype.Parameters.Add("method", "CANCEL");
I'm currently working on an equipment return eform, people input the equipment they're returning and when they click submit an email is sent to them and the equipment return team. I've also added a function where by when submit is clicked the programme accesses a database and brings up all the equipment that user still has yet to return. It then adds a grid view of the equipment they have yet to return to the email. To make the grid view show up on the email i had to convert the email to html, but when it does this it ruins the formatting of the email and puts it into one big paragraph instead of a few lines e.g.
(how I want it)
Hello
Bob Johnson has returned a laptop to Steve Johnson on the 28th of may
They also have these items taken out:
(How it comes out)
Hello Bob Johnson has returned a laptop to Steve Johnson on the 28th of may
They also have these items taken out:
below I have included the c# method I've used to send the email
}
protected void emailconfirmation(ObjectClass obIn_survey);
try
{
s_Body += " Hello" + " \n\n" +
"*************** \n" +
ob_survey.ob_Name + " " + "has Returned a" + " " + ob_survey.ob_Description_of_Equipment + " " + ob_survey.ob_asset_number + " " + "to" + " " + ob_survey.ob_Returned_To + " " + "(Charger returned, " + ob_survey.Return_Charger + ")" + " on" + " " + ob_survey.ob_Date_of_Return.ToShortDateString() + " " + " \n\n" +
" \n\n" + "Regards" + " \n\n" + "RCI Team" + " \n\n" + "This User also has the current Item(s) taken out";
s_GridView = GetGridviewData(gv_Equipment);
utility.Email_GenericMessage("RCITeam#rotherham.gov.uk", ob_survey.ob_Email_Receipt_to + ",RCITeam#rotherham.gov.uk", "Equipment Return", s_Body + s_GridView);
edited the above line
}
catch (Exception)
{
throw;
}
Here is the method in the utility class
public void Email_GenericMessage(String sIn_EmailFrom, String sIn_Emailto, String sIn_Subject, String sIn_Body )
{
using (MailMessage msg = new MailMessage(sIn_EmailFrom, sIn_Emailto, sIn_Subject, sIn_Body ))
{
msg.IsBodyHtml = true;
using (SmtpClient clt = new SmtpClient(System.Configuration.ConfigurationManager.AppSettings["SmtpServer"]))
{
clt.Send(msg);
}
}
Can anyone help? Thanks
This seems like it could be solved with a string replace. Have you tried s_Body.replace("\n", "<br/>");? Since the message html new lines are represented as <br/> instead of \n.
Use .html layout and placeholder for creating emails.
It's most ease and correct way.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<div>{{NameFirst}}</div>
<div>{{NameSecond}}</div>
<div>{{Price}}</div>
<div>{{InvoiceNumber}}</div>
</body>
</html>
string forReplace = "{{" + prName + "}}";
if (res.Contains(forReplace))
{
var prValue = item.GetValue(obj);
res = res.Replace(forReplace, prValue.ToString());
}
hello m using visual studio 2012 , and trying to send session on different web page. its transferring my sessions but the problem is it is not showing in separate rows :( m using this code
Session["ProductName" + "\n"] += "\n" + ProductName; //this is on page 1
string pName = Convert.ToString(Session["ProductName" + "\n"]);
ListBox1.Items.Add("\n" + pName); //this one m using on targeted page
Use Environment.NewLine :
Session["ProductName" ] += Environment.NewLine + ProductName; //this is on page 1
Then you will not have to use "/n" in the other page Also.
I have HTML code stored in a database and would like to display (render) it onto a view.
I wanted to show it as a normal text page.
eg: **HTML:** <h3 style="font-weight: bold">Usage:</h3>
<p style="text-decoration: underline">Viewing of Form -</p>
Should be shown as: Usage:
Viewing of Form -
I have a button as view and when clicked, it should show me the page.
I am using entity frame work so i have written,
string url = ("view.aspx?id = " + page.ID + "&Text=" + page.Text);
ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open( '" + url + "', null, 'height=500,width=800,status=yes,toolbar=yes,menubar=no,location=no,scrollbars=yes,resizable=no,titlebar=yes' );", true);
and i have created a new page view.aspx and tried to use System.Web.HttpUtility.HtmlDecode(Request.QueryString["Text"]) to render the file.
But i am getting a blank page.
Please help me.
Thanks,
Can you confirm that page.Text has a value when it's being rendered?
If you are certain that the value page.Text is populated correctly (I'm assuming something like "view.aspx?id=1&Text=<h3>example post<h3>") then you may want to try encoding the string for the URL before returning it to the client.
string url = ("view.aspx?id = " + page.ID + "&Text=" + System.Web.HttpUtility.UrlEncode(page.Text));
ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open( '" + url + "', null, 'height=500,width=800,status=yes,toolbar=yes,menubar=no,location=no,scrollbars=yes,resizable=no,titlebar=yes' );", true);
Then make sure that you are getting encoded characters in your links on the client.
I am trying to create a customized messagebox using javascript but not getting too far.
string txtConfirmMessage = "On " + DateTime.Now + ", ";
txtConfirmMessage = txtConfirmMessage + sUserID;
txtConfirmMessage = txtConfirmMessage + " added this record. Do you want to continue? ";
btnSubmit.OnClientClick = #"return confirm('" + txtConfirmMessage + "' Do you want to continue);";
I need to display a custom message involving the UserID, the date, and the value that the user has enetered. When I click the Submit button, the messagebox does not pop up.
Update:
I know this code is executed at the Page_Load event. However, is it possible to display in this alert box, a value that the user has selected (that action occurs after the page load event) ?
Any ideas to resolve this issue?
The javascript that you have is not valid, as the "confirm" method taks a single parameter, but you are giving it two bits.
Try this modified version.
string messageFormat = "On {0}, {1} added this record. Do you want to continue?";
string formattedMessage = string.format(messageFormat, DateTime.Now, sUserID);
btnSubmit.OnClientClick = "return confirm('" + formattedMessage + "');";
You just have an extra string after the one you're passing to confirm(), change it to this:
btnSubmit.OnClientClick = #"return confirm('" + txtConfirmMessage + "');";
About the update of the question, you could assign an OnClientClick event handler to the button as late as PreRender and the value will be persisted in the ViewState.