More in this section

Forums / General Discussions / Control ViewState

Control ViewState

24 posts, 1 answered
  1. Matt
    Matt avatar
    56 posts
    Registered:
    20 Nov 2009
    21 Oct 2010
    Link to this post
    Hello,

    I'm trying to migrate all of our code from DNN to Sitefinity for one of our clients (hoping to go live in January with the final release).  I moved one control with a registration form, and none of the viewstate is working.  I've tried every method I know of to enable viewstate, but no luck.  Anybody else using viewstate successfully within custom widgets?  I'd love to avoid it altogether, but it's going to make the migration a bit more painful...

    Thanks,
    Matt

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    22 Oct 2010
    Link to this post
    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);
    }

    We are going to expose interface for disabling/enabling the view state.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  3. JV
    JV avatar
    74 posts
    Registered:
    15 Jun 2012
    22 Oct 2010
    Link to this post
    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.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    26 Oct 2010
    Link to this post
    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>


    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Matt
    Matt avatar
    56 posts
    Registered:
    20 Nov 2009
    26 Oct 2010
    Link to this post
    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.

    Thanks,
    Matt

  6. JV
    JV avatar
    74 posts
    Registered:
    15 Jun 2012
    26 Oct 2010
    Link to this post
    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.
  7. John S.
    John S. avatar
    126 posts
    Registered:
    09 Aug 2004
    30 Nov 2010
    Link to this post
    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
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    30 Nov 2010
    Link to this post
    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
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. John S.
    John S. avatar
    126 posts
    Registered:
    09 Aug 2004
    01 Dec 2010
    Link to this post
    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
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    01 Dec 2010
    Link to this post
    Hi John,

    Override OnInit as shown in "Marked as answer"  post.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  11. John S.
    John S. avatar
    126 posts
    Registered:
    09 Aug 2004
    01 Dec 2010
    Link to this post
    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?

  12. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    01 Dec 2010
    Link to this post
    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>



    Greetings,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  13. John S.
    John S. avatar
    126 posts
    Registered:
    09 Aug 2004
    01 Dec 2010
    Link to this post
    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

    When will this be resolved?

    This is a major problem. I waited for the RC to be released because I thought it would be 99.5% finished but there is no ability to use viewstate or sessionstate. Again, this is a major issue.
     
    How do people develop controls without this? I know I can make my own master file to work around 'this' issue....but I don't want to. I could write a complete application too but am choosing to use this because I want Sitefinity to handle the framework issues. I know it may sound contradictory, but from what I have seen this is really a beautiful system and I want to use it.

    Please help.

    Thanks,
    John
  14. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    02 Dec 2010
    Link to this post
    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
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  15. John S.
    John S. avatar
    126 posts
    Registered:
    09 Aug 2004
    02 Dec 2010
    Link to this post
    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
  16. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    03 Dec 2010
    Link to this post
    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,
    Georgi
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  17. John S.
    John S. avatar
    126 posts
    Registered:
    09 Aug 2004
    03 Dec 2010
    Link to this post
    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.
  18. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    06 Dec 2010
    Link to this post
    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.  

    Kind regards,
    Georgi
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  19. John S.
    John S. avatar
    126 posts
    Registered:
    09 Aug 2004
    16 Dec 2010
    Link to this post
    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
  20. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    16 Dec 2010
    Link to this post
    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
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  21. John S.
    John S. avatar
    126 posts
    Registered:
    09 Aug 2004
    16 Dec 2010
    Link to this post
    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

  22. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    16 Dec 2010
    Link to this post
    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.

    Regards,
    Georgi
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  23. John S.
    John S. avatar
    126 posts
    Registered:
    09 Aug 2004
    16 Dec 2010
    Link to this post
    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
  24. John S.
    John S. avatar
    126 posts
    Registered:
    09 Aug 2004
    18 Dec 2010
    Link to this post
    Georgi,

    I have decided to just create my own master pages at this point so an answer is not required.

    Thanks,
    John
24 posts, 1 answered