How to grayout google map

Hello,

Recently, one of my client need gray Google map. So, i have done it simple way which i want to share with you.

To add Google map and gray it out add following code.



In html add following code

Here, oceanStyle is for gray style and then add oceanMapType. In Options mapTypeIds add grayscale then set mapTypes in map.

All done. Now you will see your map in grayscale. enjoy!!!

Google Map integration using API v3

Hello,

Now a days google map integration is common solution to show the address and markers in web application.

Google Map API provides a flexible way to integrate maps in your web application.

Today I am going to provide information about the latest Google Maps API V3.

In the earlier versions of the Google Maps API, we need to register web application with Google for generating an API key but in new version google eliminates the registration process.

Lets take a simple example of google map, I have created one simple html page for displaying google map.
see below code for generating a google map:



    

    

    


    

I have used google map API V3 “https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false” in above code. you can see it in header section.

After execution of the above code, you will get below output.

map1

You can see that I have used different properties for google map control like zoom, mapTypeControl, scrollwheel, zoomControl etc. You can set it as per your requirements. For more details, please see this link google map properties

click here for demo.

I hope you enjoyed this post.

Delete xml element in asp.net using linq

Hello,

Today, in this article let’s play around with one of the interesting and most useful concepts in LINQ to XML.

LINQ to XML Delete functionality, we will see how to delete elements from existing XML file.

We will load an XML file from the disk, remove the elements and save the updated XML to the disk.

see the below example code of Employee.xml file:


  
    1
    Sachin
    Tendulkar
    41
  
  
    2
    Virender
    Sehwag
    35
  
 
   3
   Gautam
   Gambhir
   30
 
 
   4
   Yuvraj
   Singh
   33
 

Now we will remove the Element, for the Employee Gautam

    XDocument doc = XDocument.Load(XMLDocPath);

    doc.Root.Elements("Employees")
   .Where(p => p.Element("firstName").Value == "Gautam")
   .Remove();

   doc.Save(XMLDocPath);

After execution of this code, the Employee.xml file will looks like as below,


  
    1
    Sachin
    Tendulkar
    41
  
  
    2
    Virender
    Sehwag
    35
  
 
   4
   Yuvraj
   Singh
   33
 

That’s it we have deleted an Element from XML file and saved the changes to the Disk.

I hope this post is useful for you

Rounded corner close button in html

Hello All,

Sometimes we need rounded corner close button and we are using background image for that but now in css3 we can do it by using “border-radius” property.

Please check this link for border-radius syntax and details.

Today I am going to represent how to make rounded corner close button on other element.

see below example



    
    


    
 
X

Here, I have created close button on top right cornet of image.

I have defines class “closebtn” in span which contains anchor tag with onclick event.

I have used top and left for positioning a button on image. You need to change this property as per your image size.

see the output of above code :
closebtn

How to replace a specified substring with another string in asp.net

Hi Friends,

Today I am going to describe how to replace specified substring with another string value.

This is most common problem in web development to replace string with other string.

we can do this by many ways.
Generally we are using asp.net inbuilt functions i.e. indexof, lastindexof, subsctring etc. for replacing a string value.

lets take an example
There is a youtube trailer string which contains width and height parameter

Now I want to change width and height value as per our requirement.

Currently I am replacing width from 640 to 780 and height from 360 to 460.

I have used asp.net Regex expression for the string replacement.
see the below code which replace the height and width value

.............................
.............................
.............................
string trailerCode = "iframecode";

Regex wregx = new Regex("(?.*width=\")(?\\d+)(?\".*)");
Regex hregx = new Regex("(?.*height=\")(?\\d+)(?\".*)");

string replacedString = "";
replacedString  = wregx.Replace(trailerCode, "${part1}780${part3}");
replacedString  = hregx.Replace(trailerCode, "${part1}460${part3}");
.............................
.............................
.............................

Here I have used 2 Regex for width and height parameter replacement.
For Regex expression, you nee to register System.Text.RegularExpressions.
Hope this will help you too.

How to host website in IIS with custom URL

Hello friends,

Recently i need to add website in IIS with custom URL to check third party account sign in. I want to share steps to create website in IIS with all of you to help someone who do it first time.

First you have to check IIS is installed in your machine or not. To confirm it go to Start -> Control Panel -> Programs -> Turn windows features on or off -> Internet Information Services -> Web Management Tools -> check IIS Management Console. Click OK.
IISMgmtConsole

To create website in IIS follow below steps.
-> Go to IIS Manager

IIS Manager

-> Right click on Sites. Select Add Web Sites.

AddWebsite

-> Enter site name and select physical path. Also add Host name you want. Also set App pool.

SiteNameHostName

-> Click on OK.

You have done all. Now, go to browser and type your URL. Enjoy!!!

Error 404.2 ISAPI and CGI list settings restrictions list settings on Web Server

Hello All,

Recently i have got an error 404 for ISAPI and CGI list settings restrictions list settings on Web Server.

To solve this problem we can set this in IIS.
-> Go to IIS manager click on Server Name.
-> Go in ISAPI and CGI Restrictions.
-> Select ASP.Net 4.0 (your .net version).
-> If it has “Not Allowed” then Right click and select “Allow”.

Now check your site the error will gone. To give more idea see below image.
ISAPIandCGIOption

ISAPIandCGIAllow