Frage

Currently, I am passing data from my codebehind into hidden fields like so:

Code behind: HiddenField statusValue.Value = progressPercent.ToString();

.ASCX page: <asp:HiddenField ID="statusValue" value="" runat="server" />

In MVC, I would pass a model from my controller to a view. Is there a similar way to do this in webforms? I am beginning to have a large number of hidden fields and it seems like a bad way to program this...

War es hilfreich?

Lösung

Generally, having tons of hidden fields isn't the best practice. Have you looked into ASP.NET View State? It may achieve what you are looking for.
http://msdn.microsoft.com/en-us/library/bb386448(v=vs.100).aspx
http://msdn.microsoft.com/en-us/library/ms972976.aspx

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top