Monday, May 23, 2011

Friday, May 20, 2011

Web Forms Bloat

When .Net web forms first came out I hated them. Then I got used to them. Now MVC is out, and if I would have skipped web forms I would have loved MVC I think, but because there are some great web form tools out there I find looking to doing something similar in MVC to be not worth it, at least at this point for me. But, web forms do have their draw backs. Look at the line number of this error...


Now I'm hoping this is a faulty line number, but unfortunately I don't think it is. MS Ajax -> Telerik generated Javascript handlers -> 200 lines of Javascript on a page with 5 web grids = a bazillion lines of code I guess.

I bet with MVC this would be about 1/20th of the line number...interesting.

By the way, here is how to do a global Javascript catch if debugging tools aren't working for you-

 window.onerror=function(m, u, ln){
       alert('Error: '+m+'\nURL: '+u+'\nLine: '+ln)
       return true
      }


More info here http://www.javascriptkit.com/

Wednesday, May 11, 2011

Passing Client Side Dates to Server Side Vars With Telerik Rad Controls

Ok, sometimes you need to pass a client side datetime value from a Raddatetimepicker up to the server side for use. Sometimes with localization this can get kind of tricky, but Telerik introduced a new method to make this somewhat less painless.

in javascript
var dt = $telerik.findDatePicker("controlID", null);
  var dtValue = dt.get_selectedDate().format("yyyy/MM/dd");


This method will put your datetime value in a format that is SQL server friendly. Happy coding.