Tag Archives: ASP.NET

google maps in a razor view

These days I was working on a ASP.NET MVC web application to show events on a map. I had to use Google Maps for that purpose. I looked around for a way to integrate these maps. Fortunately Google provides a JavaScript API, which was the best option for me to explore. Although you can use it without any key, but creating and using a key is a good practice. If you have one, Google provides you usage statistics, and can warn you on exceeding your limits. For creating a key you will have to launch Google API Console. After going through the initial reference documents, I was ready to try it in my own application.

Continue reading

Google like auto complete suggestions

I like Google’s suggest feature and was thinking of using it in any of my project. ASP.NET’s AJAX Control Toolkit have a similar control (AutoCompleteExtender) which provides a basic items to complete this functionality. I searched about its usage, and found many examples, but I was not satisfied with them. They all were populating only a single field using this extender.

I then came up with an idea, why not fill a contacts detail including its name, email address, and phone numbers using just one extender, but without modifying any provided functionality, so that our code be used with newer versions. Below is what it will look after populating that contact form.

contact

Continue reading

Disabling ASPX Controls on client side

To enable or disable .Net controls on client side use following scripts.

//To Disable
document.getElementById(element_client_id).setAttribute('disabled','true');

//To Enable
document.getElementById(element_client_id).removeAttribute('disabled');

Nearly all html rendered control would adher to this coding guide, but aspx checkbox has a span element wrapped up on it. To disable checkbox properly add a extra line as below.

document.getElementById(element_client_id).parentElement.removeAttribute('disabled');