Static user control disappears after postback

Discussion in 'ASP .Net Building Controls' started by Svetoslav Vasilev, Nov 19, 2007.

  1. Hi, I have recently come across a subtle behavior of ASP.NET 2.0 user
    controls, for which i cannot find the cause and therefore need som help. I
    have the following scenario - i need to show one grid view where I can select
    individual rows, which are displayed in a second grid upon selection. From
    the second grid i have the ability to remove rows individually.
    I have developed this as follows - user control A.ascx containing a grid
    view and the logic for handling the events fired by it - both select and
    remove. It exposes public events that are fired upon corresponding event from
    the grid view, so that other controls & pages can be notified if needed. In
    another control - B.ascx i have defined 2 instances of the control A through
    markup - each with its own ID. The strange behaviour is expressed in that
    when I select a row from the first grid, the SelectedIndexChanged is properly
    fired, the corresponding logic properly executed, but when the page is
    rendered, the first grid disappears and only the second with the selected
    rows is shown. If I then try to remove one row from the second grid, the
    event fires correctly and the logic executes properly, but the page is
    rendered without no grids.
    In a breakpoint in the SelectedIndexchanged I noticed that the DataKeys
    collection is properly populated, but the Rows collection is empty.
    Have anyone experienced similar behaviour and if so, please let me know how
    to solve it.
    Many thanks in advance!
    Svetoslav
    Svetoslav Vasilev, Nov 19, 2007
    #1
    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. Guadala Harry

    User Control Disappears After PostBack - Why?

    Guadala Harry, Jul 1, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    10,172
    Guadala Harry
    Jul 2, 2004
  2. Ryu
    Replies:
    1
    Views:
    3,211
    Lucas Tam
    Aug 18, 2004
  3. Sami Rehman
    Replies:
    1
    Views:
    1,269
    Mark Rae [MVP]
    Sep 3, 2007
  4. Hagai Amiel via .NET 247

    Data Grid Disappears after postback

    Hagai Amiel via .NET 247, Oct 17, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    150
    Scott Mitchell [MVP]
    Oct 18, 2004
  5. Hagai Amiel via .NET 247

    Data Grid Disappears after postback

    Hagai Amiel via .NET 247, Oct 31, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    168
    Scott M.
    Nov 14, 2004
Loading...

Share This Page