EnableViewState property of label [Resolved]

Posted by Surajemo under ASP.NET on 1/12/2012 | Points: 10 | Views : 4068 | Status : [Member] | Replies : 10
what is EnableViewState and EnableTheming property of label what does it do if we make it True Or false
can someone please help me out in understanding this propertys of label.




Responses

Posted by: Surajemo on: 1/12/2012 [Member] Starter | Points: 25

Up
0
Down

Resolved
got it
i understood the concept
thanks :)

Surajemo, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ogipansrk on: 1/12/2012 [Member] Starter | Points: 25

Up
0
Down
Surajemo,

EnableThemeing property indicates whether themes are enabled for this control or not.

EnableViewState property : Regarding this , first you need a have a better understaning of what is "VIEWSTATE".

pls refer this url for better knowledge by MSDN : http://msdn.microsoft.com/en-us/library/bb386448.aspx

Regards,
Ogipansrk

Surajemo, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 1/12/2012 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
ASP.NET is another form of html and it is stateless , which means if a a postback can occur, you will look selection on your combobox , listbox or the value that was selected will be lost. So there is a Property named "ViewState" it is another form of persistence , which means it help you to persist or keep the changes after the post backs.

and EnableThemeing has been well explained by Ogipansrk

Thank you for posting at Dotnetfunda
[Administrator]

Surajemo, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Surajemo on: 1/12/2012 [Member] Starter | Points: 25

Up
0
Down
i went through that url it is kind of confusing
can u please explain this with an small example :)

Surajemo, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ogipansrk on: 1/12/2012 [Member] Starter | Points: 25

Up
0
Down
Surajemo ,

Let me explain this in simple terms.

Step1: Take a new Webform.
Step2: Place Two Labels and Make its text property to empty.
Step3: Place a Button and Click on it. It will generate some code.
Step4: Now for one of the label make the property ViewStateEnabled="Disable" and Another as Enabled .
Step5: In Page Load , Set Text Property of two labels to some text.
Step6: Now run you application.
Step7: See the difference before and after clicking the button.

Regards,
Ogipansrk


Surajemo, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Surajemo on: 1/12/2012 [Member] Starter | Points: 25

Up
0
Down
no change

Surajemo, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Surajemo on: 1/12/2012 [Member] Starter | Points: 25

Up
0
Down
whatever i had written in the load event for the labels ie textproperty is being showed even if i clicked on the button still no change same out put is being displayed

Surajemo, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ogipansrk on: 1/12/2012 [Member] Starter | Points: 25

Up
0
Down

I Understood wat u r doing.

Write the code in not ispostback mode like below:
protected void Page_Load(object sender, EventArgs e)
{

if (!IsPostBack)
{
Label1.Text = "Hello world!";
Label2.Text = "Label2";

}

}

Surajemo, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mankuji on: 12/6/2014 [Member] Starter | Points: 25

Up
0
Down
Step1: Write the code in EnableViewState.aspx.
Step2: Run the application
Step3: After click on Check button.

For full solution see this:
http://www.mindstick.com/blog/683/EnableViewState%20in%20ASP%20NET

Surajemo, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response