Dark Spire Design
   


About
Dark Spire Design, Design, Code, Play

My Name
me@here

Subscribe
Subscribe to a syndicated feed of my weblog, brought to you by the wonders of RSS.

Flavours
There's more than one way to view this weblog; try these flavours on for size.

  • index
  • circa 1993
  • RSS
  • Links
    These are a few of my favourite links.

  • raelity bytes ;-)
  • link 2
  • link 3

  •        
    Sat, 14 Aug 2010
    ASP.NET ViewState, Page Cycle, and the Mystery of the Databind
    *****

    Developing primarly in ASP.NET webforms requires that you take a lot of things for granted as you work. Perhaps the same could be said of all web frameworks, but ASP.NET is what I know best right now. I haven’t decided yet if knowing ASP.NET that well is a sign of experience or insanity. What I do know is insane is trying to piece together how it is that ASP.NET decides to do certain things.

    ASP.NET asks for an act of faith: believe in the framework, and thy data shall be saved. That works, of course, until it doesn’t. We do some pretty complex things with ASP.NET around here, and so I often find myself trying to circumvent the framework, rather than work with it. Again, I’m not yet sure when the line is crossed between “tweaking the execution path” and “hacking around the framework” but I feel I’m skirting dangerously close.

    Take databinding, as an example of my current scripture. Controls that are declaritive (on the .aspx page) are supposed to databind after the Page.PreRender event but before the Page.PreRenderComplete event. I have seen them do that, but I’ve also seen the opposite. It’s not totally clear to me what causes the engine to decide that databinding should occur some other time. It seems if you change just the wrong property in code behind, the databinding events slip into a different place in the life cycle.

    That frustation is just doing normal manipulations on the controls. If controls need to bind in a certain order, such as a DropDownList feeding another DropDownList feeding a GridView, then you’re in for a fight. Our page does that, and you can switch the viewing context of the entire page, changing the contents but keeping the controls basically the same. There may be better ways to get what I’m trying for here, but I can’t think of any that don’t involve lots of copy-paste and code duplication.

    So instead I find myself torn between hacks and compromises I don’t want to make: either I have to use some value preservation tricks to make the DropDownLists maintain the right state after their automatic databind, or I have to try and disable the automatic databinding and viewstate updates so I can take manual control over their contents. Neither option is super appealing, and I find myself really hating ASP.NET for not just working like I expect it to work.

    This is just the kind of thing that drives me to other options like ASP.NET MVC or bone simple pages using PHP and Javascript. Sadly, none of the alternatives are an option around here, but its fun to consider. Although really, the power and flexibillity of the ASP.NET webforms comes in real handy on many occasions, and non-.NET options are unappealing because .NET offers a lot of behind-the-scenes flexibility that something like PHP doesn’t come close with. Other frameworks like Rails are something to consider, but then I’m just buying into a whole new framework and whatever unknown problems will haunt me there.

    Is there no peace for the weary web warrior?

    0 1 [/Programming/ASP-NET] permanent link
    Wed, 12 May 2010
    The Newer, Minimal Dark Spire Design
    ****

    I realized recently that two things were true about my website:

    1. It doesn’t get updated enough.
    2. It doesn’t really show off anything of what I can do.

    This could not stand.

    So, I’ve removed my old Wordpress blog and replaced it with an ultra-light Blosxom script instead. Since the blog is nothing but plain-text now, should be much easier to manage. Likewise, now that my site is free and clear of clutter, I can start trying to write some new content for it using a traditional, simple webstack: HTML, CSS, Javascript, and PHP.

    0 1 [/News] permanent link