Control ViewState
Hello,
Hello Matt,
By default the view state is disabled. You can enable it from the master page by overriding OnInit
protected
override
void
OnInit(EventArgs e)
this
.Page.EnableViewState =
true
;
base
.OnInit(e);
Hi,
Now i don't loose the values in the dropdown but when i change the selected value and in debug mode the selected value is allways the first item in the list despite the value i select.
Hello Matt,
I tried to reproduce the issue with a basic sample with no avail. Could you try to add the code below to your master page and send me a basic sample of the code you use.
<
telerik:RadComboBox
runat
=
"server"
ID
=
"Combo1"
AutoPostBack
=
"true"
>
<
Items
>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"1"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"2"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"3"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"4"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"5"
/>
</
Items
>
</
telerik:RadComboBox
>
I think you meant this for the other person who posted on the thread. I couldn't reproduce their problem either. Your first suggestion worked for me.
Hi,
Your solution Worked.
After my last post I check my code again and your solution worked.
I was making something wrong in my code .
Sorry.
Hello,
This seems like I have to be missing something....but where is the master page that I can add this code to?
I am using the built in templates.
Thanks,
John
Hi John,
In 4.0 the default templates are embedded and there are no physical files. You can create a custom template with a static master file or use a control.
Regards,
Ivan Dimitrov
the Telerik team
Since I do not want to use my own master file how do I do this with a control (usercontrol?) in VB.NET
Thanks,
John
Hi John,
Override OnInit as shown in "Marked as answer" post.
Sincerely yours,
Ivan Dimitrov
the Telerik team
I don't want to do it in the master page. In your last post to me you said: "You can create a custom template with a static master file or use a control." How do I use a control to do this?
Hi John S.,
If you create a control and place it on the page or template you will not be able to override the page's init event or the template's init event. You will override the init event of the control, and it might be too late to enable the view state. You can give this a try. Bellow is sample code for the .ascx control you have to create and register in your toolbox:
<%@ Control Language="C#" AutoEventWireup="true" %>
<
script
type
=
"text/C#"
runat
=
"server"
>
protected override void OnInit(EventArgs e)
this.Page.EnableViewState = true;
base.OnInit(e);
</
script
>
Radoslav,
I used the following code in my .ascx file and it did not work.
<
script
type
=
"text/VB"
runat
=
"server"
>
Protected Overrides Sub OnInit(e As EventArgs)
Me.Page.EnableViewState = True
MyBase.OnInit(e)
End Sub
Hello John S.,
As mentioned previously, most probably using the code from a control will not work. This issue is logged (#66613) and we will soon provide a configuration section where you can set properties such as view state, session state, etc.
Regards,
Radoslav Georgiev
the Telerik team
Radoslav,
Do you have an estimate as to when soon is? I need to know an approximation so I can determine how to proceed.
Thanks,
John
Hello John S.,
We will start working on page configuration properties after the official Release. I hope that we will be ready till Q1 2011 with them.
Best wishes,Isn't this supposed to be an ASP.NET development system? How can ViewState just not be there? It's like telling me there is a News Module but text is not supported yet.
I don't hear anyone else having a problem with this so I have to ask....maybe I am missing something here.
I am looking for an actual answer to why this is not important.
Hello John S.,
We have raised the priority of this task, so this feature together with other page options will come in the official release.
It wasn't there yet, because we were planning to introduce it with the page options screens, which weren't ready. Now that we see it's really important for you and other people, we will implement it sooner.
According to this post...
http://www.sitefinity.com/devnet/forums/sitefinity-4-x/general-discussions/sitefinity-4-0-rc-weekly-builds-release-notes.aspx#1457600
...all features will be present in the buid next week. Does this include the viewstate functionality?
Thanks,
John
Hello John S.,
The advanced Page Properties will be introduced in the a release after the official one. By that time, you may use the workaround provided.
All the best,Georgi,
Your response contradicts your earlier post:
"We have raised the priority of this task, so this feature together with other page options will come in the official release"
Now you are saying after the official release.
I have made plans based on your previous response.
What is the problem here???
This going back and forth between what is going to be in the "official release" compared to a release that has all the features is extremely confusing.
It seems all responses contradict each other to the point that responses don't really mean anything. Heck, the RC (which in theory should be feature complete...ready to go) webcast and an email I received from your sales staff said Sitefinity will be ready for an official feature complete release early December; however, the decision was made to release it after the beginning of the year for business reasons. So based on that, it should be ready to go now.
When will this feature be available?????????
This is extremely aggravating.
John
Hi John S.,
I agree that I misled you. It was my misunderstanding of the feature - the page properties were not initially in the plan, and we decided not do it because it will require serious testing. The ViewState property goes together with the other page properties and we are at risk to give this feature to you with bugs. This is something that we do not want.
Could you please let me know why is this stopping you when you have a way to enable or disable the view state even now? More over the view state can be enabled / disabled globally for the application.
Apologies for the inconvenience. I too wanted this feature very much.
Georgi,
The work around being making my own master page may 'seem' like a valid work around but it really is more than a workaround it means I can't use the application as it is intended. Perhaps I am being too picky here but your answer in an exageratted form is "you can just write your own application as a work around"
In any case, you said...
"More over the view state can be enabled / disabled globally for the application?"
How do I do this? The earlier post said I could only do this through a custom master page
"You can enable it from the master page by overriding OnInit"
If I can enable it globally that will probably be fine for now and get me what I need.
Thanks,
John
Georgi,
I have decided to just create my own master pages at this point so an answer is not required.
Thanks,
John