Repost : Viewstate being maintained second time around

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Repost : Viewstate being maintained second time around

    Hi all,

    I have a problem with viewstate being maintained. I use LoadControl to load
    a user control and the data is sent down to the client correctly. However,
    when I change some data and post it, the viewstate does not seem to load for
    the user control upon sending it back down to the client. If I change the
    data again, then the viewstate DOES seem to be maintained.

    What gives?

    Regards


    John Guest

  2. Similar Questions and Discussions

    1. Failed to load viewstate. The control tree into which viewstate...
      Hi to all, I have a webform.aspx and inside i have a dropdown list with autopostback and a place holder... Depending of the selected index...
    2. Repost: Getting Project Folder during Design Time
      I was given the following code in response to a request to retrieving the Web Root for a Project while at design time. However this does not do what...
    3. Viewstate only being maintained second time around
      Hi all, I have a problem with viewstate being maintained. I use LoadControl to load a user control and the data is sent down to the client...
    4. User-maintained MQT
      Has anybody used user-maintained Materialized Query Tables?, I'm trying to use the latest DB2 8.1 MQT functionality where you can INSERT, UPDATE or...
    5. in LoadViewState() : ViewState is empty after page reloads the 2nd time
      Hi, I have a Webform with 1 submit button and 1 label code behind : public class MainWebForm: System.Web.UI.Page { protected...
  3. #2

    Default Re: Repost : Viewstate being maintained second time around

    John -
    I had quite a bit of trouble getting a usercontrol to work when the
    usercontrol included webcontrols that I wanted to interact with the
    parent.
    The best way I found to work is to drag the usercontrol onto the
    parent, then toggle the visible property, rather than using
    LoadControl.
    My web page is in GridLayout, so I programmatically move it to
    position when it's changed to visible = true.
    I also found that ViewState wasn't working. I found an usercontrol
    example that showed removing the OnInit() function in the usercontrol
    and replacing it with
    public void Page_Init(object sender, EventArgs e)
    {
    InitializeComponent();
    }
    ** I'm not sure why the example used this method. It seems like you
    could just remove the base.OnInit(e) for the Designer generated code,
    but I didn't try that.

    Then, in the parent, add

    this.Init += new System.EventHandler(this.ctlAddNewRule.Page_Init);
    (** Mine is in C#, I'm not sure how to do it in VB)

    I have this usercontrol on several pages, and it is working
    consistently.

    Dawn.

    "John" <a@b.com> wrote in message news:<ebUlf2bWDHA.3232@tk2msftngp13.phx.gbl>...
    > Hi all,
    >
    > I have a problem with viewstate being maintained. I use LoadControl to load
    > a user control and the data is sent down to the client correctly. However,
    > when I change some data and post it, the viewstate does not seem to load for
    > the user control upon sending it back down to the client. If I change the
    > data again, then the viewstate DOES seem to be maintained.
    >
    > What gives?
    >
    > Regards
    HrtgSkr Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139