views:

94

answers:

1

Hi,

I'm struggling to read an int from the hidden field on aspx page.

<input type = "hidden" id = "myIntegerId" name = "integerId" value= "<%: Model.MyObjectId %>" runat = "server" />

The value is definately on the form, I can see it in the debugger and print it with <%: %>

When I read the form values in the controller, instead of an int I recieve a following string: <%: Model.MyObjectId %>

I have tried casting data in the hidden field to string and calling ToString() method on that field, neither has worked.

The data is submitted using the post event.

I have a feeling that I'm missing something very basic...

Any help is greately appreciated.

Thanks

A: 

Ahh, <%: String.Format("{0:g}", Model.MyObjectId) %> has done the job...

vikp