The value of Hidden Field can be programmatically set. Best Dot Net Training

The value of Hidden Field can be programmatically set. Best Dot Net Training

  1. Like ViewState, HiddenField is also used for managing the state of the client in round trips to the same web form.

  2. ViewState is managed by Page framework but HiddenField has to be coded by us.

  3. It can store data which is of type string and cannot store serializable custom objects unlike ViewState

  4. The value of HiddenField can be programmatically set on the client using Javascript, the same can be retrieved from the server from the HiddenField object

    Example:-To get DateTime of the client when the form was posted

In a Form add the button and HiddenField:

And the Code Behind:

Note: Both ViewState and Hidden element can be used only for managing state in round trips to the same web form but they cannot be used for managing state between different web forms of the web application.


SandeepSoni

Mr Sandeep Soni, CEO & Founder of Deccansoft Software Services. He has over 21years of Experience in Teaching and Development using Microsoft Technologies. Since 1997, of the total 100000+ students, Deccansoft has trained, he has personally trained over 60,000+ students and we are proud of him because almost every student he had trained is very happy with the quality and many are well placed in various I.T Firms. This will reflect in testimonials on our website.

Please follow and like us:
0

Leave a Reply

Your email address will not be published. Required fields are marked *