<div id="divsvg"> <svg width="350" height="300"><defs></defs> ................</svg> </div> <script type="text/javascript"> var svg = $('#divsvg').html(); document.getElementById("<%= hfdata.ClientID %>").value = encodeURIComponent(svg); </script> Code behind: var svg = hfdata.Value; var urldec = System.Web.HttpUtility.UrlDecode(svg); var svgpath = Server.MapPath("~") + "temp\\" + sessionid + ".svg"; File.WriteAllText(svgpath, urldec); var sampleDoc = SvgDocument.Open(svgpath); sampleDoc.Draw().Save(Server.MapPath("~") + "\\App_Data\\tempImages\\" + sessionid + ".png");
.net , Sharepoint 2010
RealTime Interview Questions and RealTime Errors
Thursday, 31 October 2013
Convert SVG to PNG using svg.dll
Generate Pdf Using HTML file and iTextSharp
string contents = File.ReadAllText(HttpContext.Current.Server.MapPath("user.htm")); string receiptString = this.GetReceiptString(contents); string PdfPathwithName = Server.MapPath("~") + "\\temp\\" + DateTime.Now.ToString("ddMMyyyyhhmmss") + ".pdf"; Document document = new Document(PageSize.B4); PdfWriter writer = PdfWriter.GetInstance( document, new FileStream(PdfPathwithName, FileMode.Create)); PdfDestination pdfDest = new PdfDestination(PdfDestination.XYZ, 0, document.PageSize.Height, 1.00f); document.Open(); PdfAction action = PdfAction.GotoLocalPage(1, pdfDest, writer); writer.SetOpenAction(action); XMLWorkerFontProvider fontProvider = new XMLWorkerFontProvider(); CssAppliers cssAppliers = new CssAppliersImpl(fontProvider); HtmlPipelineContext htmlContext = new HtmlPipelineContext(cssAppliers); htmlContext.SetTagFactory(Tags.GetHtmlTagProcessorFactory()); ICSSResolver cssResolver = XMLWorkerHelper.GetInstance().GetDefaultCssResolver(true); IPipeline pipeline = new CssResolverPipeline(cssResolver, new HtmlPipeline(htmlContext, new PdfWriterPipeline(document, writer))); XMLWorker worker = new XMLWorker(pipeline, true); XMLParser p = new XMLParser(true, worker, Encoding.UTF8); TextReader reader = new StringReader(receiptString); p.Parse(reader); p.Flush(); document.Close(); document.Dispose();
Friday, 26 July 2013
Get label value, Hidden field value using java script / jquery
var lat = document.getElementById("<%= hflat.ClientID %>").value; alert(lat); var mytit = document.getElementById("<%= lbltitle.ClientID %>").innerHTML; alert(mytit);
Wednesday, 10 July 2013
call javascript function from page load c#.net / vb.net / asp.net
call javascript function from page load c#.net / vb.net
c#.net:
Page.ClientScript.RegisterStartupScript(this.GetType(), "Call my function", "Myfunction();", true);vb.net
Page.ClientScript.RegisterStartupScript(Me.[GetType](), "Call my function",
"Myfunction();", True)
Friday, 5 July 2013
Get location (Latitude & Longitude) for given address in ASP.NET using google api
Get latitude and longitude using C# for given location
C#.NET:
public static List<string> GetLatLng(string address) { dynamic requestUri = string.Format("http://maps.googleapis.com/maps/api/geocode/xml?address={0}&sensor=true", Uri.EscapeDataString(address)); dynamic request = WebRequest.Create(requestUri); dynamic response = request.GetResponse(); dynamic xdoc = XDocument.Load(response.GetResponseStream()); dynamic latLngArray = new List<string>(); dynamic xElement = xdoc.Element("GeocodeResponse"); if (xElement != null) { dynamic result = xElement.Element("result"); if (result != null) { dynamic element = result.Element("geometry"); if (element != null) { dynamic locationElement = element.Element("location"); if (locationElement != null) { dynamic xElement1 = locationElement.Element("lat"); if (xElement1 != null) { dynamic lat = xElement1.Value; latLngArray.Add(lat); } dynamic element1 = locationElement.Element("lng"); if (element1 != null) { dynamic lng = element1.Value; latLngArray.Add(lng); } } } } } return latLngArray; }
add multple locations in google map using asp.net c#.net/ vb.net
here shows multiple locations adding in google map using java script / jquery in Asp.net, c#.net, vb.net
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var markers = [
<asp:Repeater ID="rptMarkers" runat="server">
<ItemTemplate>
{
"title": '<%# Eval("title") %>',
"lat": '<%# Eval("lat") %>',
"lng": '<%# Eval("lng") %>',
"description": '<b><%# Eval("title") %></b> <br><%# Eval("address") %>'
}
</ItemTemplate>
<SeparatorTemplate>
,
</SeparatorTemplate>
</asp:Repeater>
];
</script>
<script type="text/javascript">
window.onload = function () {
Dataload();
}
function Dataload() {
var mapOptions = {
center: new google.maps.LatLng(markers[0].lat, markers[0].lng),
zoom: 13,
disableDefaultUI: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var infoWindow = new google.maps.InfoWindow();
var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
for (i = 0; i < markers.length; i++) {
var data = markers[i]
var myLatlng = new google.maps.LatLng(data.lat, data.lng);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: data.title
});
(function (marker, data) {
google.maps.event.addListener(marker, "click", function (e) {
infoWindow.setContent(data.description);
infoWindow.open(map, marker);
});
})(marker, data);
}
}
</script>
<script type="text/javascript">
var markers = [
<asp:Repeater ID="rptMarkers" runat="server">
<ItemTemplate>
{
"title": '<%# Eval("title") %>',
"lat": '<%# Eval("lat") %>',
"lng": '<%# Eval("lng") %>',
"description": '<b><%# Eval("title") %></b> <br><%# Eval("address") %>'
}
</ItemTemplate>
<SeparatorTemplate>
,
</SeparatorTemplate>
</asp:Repeater>
];
</script>
<script type="text/javascript">
window.onload = function () {
Dataload();
}
function Dataload() {
var mapOptions = {
center: new google.maps.LatLng(markers[0].lat, markers[0].lng),
zoom: 13,
disableDefaultUI: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var infoWindow = new google.maps.InfoWindow();
var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
for (i = 0; i < markers.length; i++) {
var data = markers[i]
var myLatlng = new google.maps.LatLng(data.lat, data.lng);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: data.title
});
(function (marker, data) {
google.maps.event.addListener(marker, "click", function (e) {
infoWindow.setContent(data.description);
infoWindow.open(map, marker);
});
})(marker, data);
}
}
</script>
Retrieve data from visible false BoundField of Gridview
get value of visible false boundfield in gridview Asp.net
<style type="text/css">
.hidden
{
display:none;
}
</style>
<asp:BoundField DataField="ReportId" HeaderText="RId" >
<ItemStyle CssClass="hidden"/>
</asp:BoundField>
Convert SVG to PNG using svg.dll
<div id="divsvg"> <svg width="350" height="300"><defs></defs> ............
-
< html xmlns ="http://www.w3.org/1999/xhtml"> < head > < title > Add blinking effect to text in jQuery ...
-
string contents = File.ReadAllText(HttpContext.Current.Server.MapPath("user.htm")); string receiptString = this.GetReceiptString...
-
I have solved my problem deleting my temporary files in both .net frameworks folders C :\ Windows \ Microsoft . NET \ Framework \...