MsCorEE

JeffGonzalez : IScalable

Model View Presenter Redemption

I just wanted to clarify that I figured out my issue with the databinding.   Rookie mistake, I forgot to wrap OnItemDataBound with ItemType check.  I can't believe I missed that.  Thanks to members of the Faithful 21 (The endearing term for all of my 21 readers =P)
 

Sorry, I forgot to post the solution:

void CustomerRepeaterCodeBehind_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
    switch(e.Item.ItemType)
    {
         case ListItemType.AlternatingItem:
         case ListItemType.Item:
            RepeaterItem item = e.Item;
            Customer c = item.DataItem as Customer;
            Label nameLabel = e.Item.FindControl("NameLabel") as Label;
            nameLabel.Text = c.Name;
            break;
    }

It does sort of beg the question on how to handle this scenario.  I mean if the View is supposed to be lightweight and you have to write custom databinding logic, it seems like you lose the testability aspect of the view.  I haven't figured this part out yet, if anyone has any experience with it or has read about this kind of case (which is pretty common in my world) I would love to hear about it.

Thanks! 

Comments

No Comments