User control resets the form elements

Discussion in 'ASP .Net Building Controls' started by Furkan Atli, Jan 5, 2004.

  1. Furkan Atli

    Furkan Atli Guest

    hi,
    i have an aspx page with 3 ascx files(header,footer,left
    menu).
    my aspx page several textbox and dropdowns.some dropdowns
    submit the form when selection change.and all other
    textbox and other elements reset!
    but you know asp.net don't reset the form elements when
    the form submit.,
    if i remove ascx pages it is working and dont reset the
    form elements.but i need to use ascx files.
    i dont want to reset elements when form submit.Please help
    me.
     
    Furkan Atli, Jan 5, 2004
    #1
    1. Advertising

  2. Hi Furkan,

    Are you dinamically creating and adding controls to the control tree? It
    looks like some of your controls are not there when postback data is
    processed.

    --
    Victor Garcia Aprea
    Microsoft MVP | ASP.NET
    Looking for insights on ASP.NET? Read my blog:
    http://obies.com/vga/blog.aspx

    To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
    "Furkan Atli" <> wrote in message
    news:05cb01c3d37a$28b99e30$...
    > hi,
    > i have an aspx page with 3 ascx files(header,footer,left
    > menu).
    > my aspx page several textbox and dropdowns.some dropdowns
    > submit the form when selection change.and all other
    > textbox and other elements reset!
    > but you know asp.net don't reset the form elements when
    > the form submit.,
    > if i remove ascx pages it is working and dont reset the
    > form elements.but i need to use ascx files.
    > i dont want to reset elements when form submit.Please help
    > me.
     
    Victor Garcia Aprea [MVP], Jan 5, 2004
    #2
    1. Advertising

  3. Furkan Atli

    shoeb Guest

    I am having problem maintaining state of user control .
    I am loading then dynamically.
    here's the code
    -----------
    System.Web.UI.WebControls.PlaceHolder phAD;
    AttributeDetail ucAttributeDetail;

    ucAD= (AttributeDetail)LoadControl
    ("AttributeDetail.ascx");
    phAD.Controls.Add(ucAD);
    ----------

    during postback am not able to maintain state of my user
    control
    am I missing something
    Please help
    please cc it to

    Thanks
    >-----Original Message-----
    >Hi Furkan,
    >
    >Are you dinamically creating and adding controls to the

    control tree? It
    >looks like some of your controls are not there when

    postback data is
    >processed.
    >
    >--
    >Victor Garcia Aprea
    >Microsoft MVP | ASP.NET
    >Looking for insights on ASP.NET? Read my blog:
    >http://obies.com/vga/blog.aspx
    >
    >To contact me remove 'NOSPAM'. Please post all questions

    to the newsgroup
    >"Furkan Atli" <> wrote in message
    >news:05cb01c3d37a$28b99e30$...
    >> hi,
    >> i have an aspx page with 3 ascx files

    (header,footer,left
    >> menu).
    >> my aspx page several textbox and dropdowns.some

    dropdowns
    >> submit the form when selection change.and all other
    >> textbox and other elements reset!
    >> but you know asp.net don't reset the form elements when
    >> the form submit.,
    >> if i remove ascx pages it is working and dont reset the
    >> form elements.but i need to use ascx files.
    >> i dont want to reset elements when form submit.Please

    help
    >> me.

    >
    >
    >.
    >
     
    shoeb, Jan 6, 2004
    #3
  4. Can't tell much by your posted code. At which point is it running? The
    important thing is that you add the control to the control tree:

    >>> phAD.Controls.Add(ucAD);


    as early as possible in the page execution lifecycle (Init, Load)

    If you're adding it in response to a click event or such then you're out of
    luck as at that point the postback data has been already processed and your
    control wasn't in the tree to receive it.


    --
    Victor Garcia Aprea
    Microsoft MVP | ASP.NET
    Looking for insights on ASP.NET? Read my blog:
    http://obies.com/vga/blog.aspx

    To contact me remove 'NOSPAM'. Please post all questions to the newsgroup

    "shoeb" <> wrote in message
    news:000001c3d402$376ba350$...
    > I am having problem maintaining state of user control .
    > I am loading then dynamically.
    > here's the code
    > -----------
    > System.Web.UI.WebControls.PlaceHolder phAD;
    > AttributeDetail ucAttributeDetail;
    >
    > ucAD= (AttributeDetail)LoadControl
    > ("AttributeDetail.ascx");
    > phAD.Controls.Add(ucAD);
    > ----------
    >
    > during postback am not able to maintain state of my user
    > control
    > am I missing something
    > Please help
    > please cc it to
    >
    > Thanks
    > >-----Original Message-----
    > >Hi Furkan,
    > >
    > >Are you dinamically creating and adding controls to the

    > control tree? It
    > >looks like some of your controls are not there when

    > postback data is
    > >processed.
    > >
    > >--
    > >Victor Garcia Aprea
    > >Microsoft MVP | ASP.NET
    > >Looking for insights on ASP.NET? Read my blog:
    > >http://obies.com/vga/blog.aspx
    > >
    > >To contact me remove 'NOSPAM'. Please post all questions

    > to the newsgroup
    > >"Furkan Atli" <> wrote in message
    > >news:05cb01c3d37a$28b99e30$...
    > >> hi,
    > >> i have an aspx page with 3 ascx files

    > (header,footer,left
    > >> menu).
    > >> my aspx page several textbox and dropdowns.some

    > dropdowns
    > >> submit the form when selection change.and all other
    > >> textbox and other elements reset!
    > >> but you know asp.net don't reset the form elements when
    > >> the form submit.,
    > >> if i remove ascx pages it is working and dont reset the
    > >> form elements.but i need to use ascx files.
    > >> i dont want to reset elements when form submit.Please

    > help
    > >> me.

    > >
    > >
    > >.
    > >
     
    Victor Garcia Aprea [MVP], Jan 6, 2004
    #4
    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. Ruth
    Replies:
    1
    Views:
    1,419
    Tim Hubberstey
    Jun 26, 2003
  2. Mike Treseler

    Help with state mahine resets

    Mike Treseler, Jun 2, 2005, in forum: VHDL
    Replies:
    8
    Views:
    501
    Weng Tianxiang
    Jun 4, 2005
  3. =?Utf-8?B?cmVuZ2VlazMz?=

    DropDownList.SelectedValue resets inadvertently

    =?Utf-8?B?cmVuZ2VlazMz?=, Dec 21, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    2,572
    =?Utf-8?B?cmVuZ2VlazMz?=
    Dec 22, 2005
  4. kuhan
    Replies:
    0
    Views:
    1,843
    kuhan
    Jan 7, 2004
  5. Madhur Ahuja

    help newbie : frame resets

    Madhur Ahuja, Aug 23, 2004, in forum: Java
    Replies:
    2
    Views:
    508
    Madhur Ahuja
    Aug 25, 2004
Loading...

Share This Page