views:

73

answers:

2

This is very strange and I don't know why. I have a ViewModel that return some value for my object, when rendering it, they have different values, yet, they points to the same property:

<%: Model.myProperty %>

That returns "25", which is what I've set the property to be. But when rendered it as an textbox, it returned "0" as the value for my textbox!

<%: Html.TextBoxFor(f => f.myProperty) %>

Any idea why? The property is of decimal type. Thanks.

A: 

My bad, seems like the problem is in the HTML, where I have the view rendered from multiple partial views, and some of the ID for the input are the same (I hide the edit view and rendered the main view using jQuery), somehow this textbox picks up the value from the view that was hidden!!! :)

Thanks all for looking.

Saxman
A: 

I'm having the same problem, but no duplicate Ids for the text controls that aren't working. I hope someone has some ideas, its the oddest thing.

jbierling
Can you post your code?
Saxman