Doing this is pretty easy, if you know how or what method to use. I wanted to disable a Validator for a province TextBox if the country DropDownList chosen is USA because the state DropDownList will be enabled so the province should be inactive. Doing this server-side may be easy, but I wanted to use client-side Javascript so that no request will be sent whenever the OnChange event of the country’s DropDownList gets fired. Luckily, there is already a pre-made function in Javascript that disables Validators.

Just set the second parameter as either true or false to enable and disable a Validator. I hope this will help those who have no clue how to go about it like I did until I found out about this function.

One of the reasons why I’m impressed with’s rich set of controls is its GridView control. This control displays your data in a table structure complete with delete, update and select features. It even has paging in case you have lots of records in your database. The best thing about this paging is that everything is done for you, the links, the paging number, the paging labels and others. If you click a page link, it will retrieve the next set of record(s) for you without changing any SQL query. For example, you can use this SQL query to retrieve all records of the table.

In MySQL, you would need to supply the LIMIT keyword in order to get a specific set of rows. With GridView’s paging feature enabled, everything is done for you. Neat huh. Took me like a day in getting this one to work though because I had problems with the update and delete function. Since I am using MySQL, turns out when you do parameters in your query commands, the @ sign does not work because it is only for MS SQL. You would have to change the @ to ?.

Take this sample code for a GridView control as an example. This assumes you have a working database connection to MySQL. If you do not know how to connect to a MySQL in, go here to use the custom MySQLProvider classes by Rakotomalala Andriniaina.

If you read e-books regarding, the queries used are for MS SQL. It’s been a long time since I dabbled with MS SQL, so when I read about it, I thought the @ sign for parameters were required for any database used. Took me some time to know that ? has to be used. See the DeleteCommand and UpdateCommand properties of the SqlDataSource tag.

How you design your GridView control is up to you. With styles, you can override how the table would look like. The other GridView like control that I had used before that looks like’s version is the datagrid taglib for Java. The downside with using the taglib is that if your SQL query returns lots of rows, it may not load fast and may use up resources in doing so because it gets all records at one time.’s GridView control totally impressed me in more ways.

Related Posts Plugin for WordPress, Blogger...