Viewstate of Controls Within WebControl

Discussion in 'ASP .Net Web Controls' started by quiggle, May 3, 2004.

  1. quiggle

    quiggle Guest

    Howdy!

    I have created a web control (ExplanationControl) that contains a datagrid,
    and a dropDownList. Both of these controls get populated with data, and are
    bound in the Page_Load event of the webcontrol itself. I have a couple of
    issues that I am facing, which I believe are related to veiwstate...

    1. When a value is selected in the dropDownList, and then the page is
    saved, when the page reloads, that same value is selected.
    2. When one of the values in the dataGrid is deleted (using a link button
    with the commandName of Delete) when the page reloads, the item is still
    present. If the page is reloaded again, the item disappears.

    I have set enableViewState to false for as many things I can think of....The
    page, the form, the asp:Table, the custom webcontrol and the controls with
    the web control.

    One other tidbit that might be of some use for solving this is that I am
    dynamically adding the ExplainControl to the asp:Table dynamically in the
    Page_Load of the actual page all this stuff sits on.

    Any help would be greatly appreciated...I have been racking my brain over
    this for a few days now!

    Thanks!

    Aimee
    quiggle, May 3, 2004
    #1
    1. Advertising

  2. quiggle wrote:
    > I have created a web control (ExplanationControl) that contains a datagrid,
    > and a dropDownList. Both of these controls get populated with data, and are
    > bound in the Page_Load event of the webcontrol itself. I have a couple of
    > issues that I am facing, which I believe are related to veiwstate...
    >
    > 1. When a value is selected in the dropDownList, and then the page is
    > saved, when the page reloads, that same value is selected.


    This is the intended behavior. This is NOT due to view state. I
    discuss this in an upcoming article of mine on view state that will be
    on the ASP.NET Dev Center on MSDN [http://msdn.microsoft.com/asp.net/].
    If you want, drop me an email [] and I'll
    email you the draft I submitted (a Word document), if you like.

    > 2. When one of the values in the dataGrid is deleted (using a link button
    > with the commandName of Delete) when the page reloads, the item is still
    > present. If the page is reloaded again, the item disappears.


    My guess would be that you're not rebinding the data to the DataGrid
    after you delete the record. If you are, then chances are you're not
    closing the connection after deleting the row from DataGrid, but before
    rebinding the data...

    Let me know if this works for you...

    Thanks.

    --

    Scott Mitchell

    http://www.4GuysFromRolla.com
    http://www.ASPFAQs.com
    http://www.ASPMessageboard.com

    * When you think ASP, think 4GuysFromRolla.com!
    Scott Mitchell [MVP], May 4, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    2
    Views:
    723
  2. Luis Ramírez.

    Can a webcontrol (webcontrol.dll) have a configuration file?

    Luis Ramírez., Jul 5, 2004, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    182
    Luis Ramírez
    Jul 6, 2004
  3. Kasabaarde Sumta

    WebControl inside of WebControl and attaching events

    Kasabaarde Sumta, Dec 13, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    174
    Kasabaarde Sumta
    Dec 13, 2004
  4. Fabricio

    Custom webcontrol that references another webcontrol

    Fabricio, Sep 21, 2005, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    166
    Fabricio
    Sep 21, 2005
  5. Peter Morris [Air Software Ltd]

    WebControl with non-WebControl property

    Peter Morris [Air Software Ltd], Dec 7, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    126
    Peter Morris [Air Software Ltd]
    Dec 7, 2004
Loading...

Share This Page