Friday, August 15, 2008

I HAD A WAR WITH A checkbox

Have you created a gridview with a checkbox template field. sure you have if not just jumb to that nice article on how to do and that article to know how to implement Check All and Uncheck All functionality but don't forget to come back, am waiting.As you all know the main idea is to save round trips to the server by selecting multiple checkboxes and take an action on the selected rows.So why I had that war since everything seems just cool and under control.The problem was that each time I check the checkbox it returns false on the server side which drive me crazy "Why, why, why ....".However after many trials reviewing the javascript for attaching the event to the checkbox I found myself searching in the wrong part of the city so I got back to the server side where I found my terrible mistake "in that case off course". I was binding the Grodview control each time the page was loading "what was I thinking of, Nothing I guess and That was the problem :D". Anyway It seemed so natural why the checkbox always returned false since it had just been created.To Summary the long story The !IsPostBack check was the solution.

No comments: