문제

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...

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top