locked
Composite Control with DropDownList loses items after Postback RRS feed

  • Question

  • User2111504239 posted

    Hi,

    I'm creating a composite control which should be called from aspx/ascx like the following:

    <ws:ExtendedLabel ID="lab_name" Text="Name" PopupText="Enter your name here" runat="server"
                IsMandatory="true">
                   <asp:TextBox ID="tb_name" runat="server" Text="" />
    </ws:ExtendedLabel>

    So, the Label should be rendered, together with an mandatory-sign and small tooltip popping up when mouseover is active. Additionally, the TextBox should be associated to the label and rendered.

    For that I created a UserControl, derived from Label. I use the [ParseChildren(false)]-Property.

    In CreateChildControls() I add the Link for the tooltip-layer and the tooltip itself. I also override the RenderChildren-function to add some html before/after rendering the textbox.

    This works fine, even after Postback everything works as espected.

    If I want to use a DropDownList instead of a TextBox, the DropDownList loses their items. After some websearch I think this is a viewstate-problem, but I don't know how to solve it.

    Any help?


    I tried to describe the problem and didn't posted the complete source-code to leave this post slim.

    Cheers, kalle.

    Tuesday, July 28, 2009 7:51 AM

Answers

  • User2111504239 posted

    So, after some more tries I decided to go another way.

    The ExtendedLabel will only render the label, the mandatory sign and the help popup. This works.

    I'll leave the controls outside the ExtendedLabel, because I'm afraid of more side effects.



    Cheers, kalle. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 29, 2009 7:17 AM