Jump to content

Dynamically created controls not retaining values after postback

- - - - -

  • Please log in to reply
No replies to this topic

#1
Mishalkk09

Mishalkk09

    Newbie

  • Members
  • Pip
  • 3 posts
Hi,

I have created a asp.net custom server control(cc1) where few dropdown boxes and textboxes are dynamically created inside a table. I also have a asp.net webcontrol containing two buttons and two instances of the server control(cc1) which is created.The buttons control the visibility of the cc1 controls in the page.Noe i select value from the dropdown box and click on second button.and again i click on first button.the last selected value from thr dropdown box disappers.It is not retaining the values after postback.Note that I have used AJAX in order to avoid page reload.However it doent work wothouit ajax also.Can anyone please guide how can I retain the values after postback?


    <%@ Register Assembly="abc" Namespace="abc"

    TagPrefix="cc1" %>



    <asp:ScriptManager ID="ScriptManager1" runat="server">

    </asp:ScriptManager>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">

     

    <asp:ImageButton ID="Button1" runat="server" Height="25px" Width="100px" OnClick="Button1_Click"

    ImageUrl="~/Images/button1.png" />

     

    <asp:ImageButton ID="Button2" runat="server" Height="25px" Width="100px" OnClick="Button2_Click"

    ImageUrl="~/Images/button2.png" />

     

    <asp:Panel ID="Panel1" runat="server">

     

    <cc1:test1 ID="test1" runat="server" />

    <cc1:test2 ID="test2" runat="server" />

    </asp:Panel>

     

    </ContentTemplate>

    </asp:UpdatePanel>






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users