Last post Jul 29, 2009 07:17 AM by kallem
Jul 28, 2009 07:51 AM|kallem|LINK
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"
<asp:TextBox ID="tb_name" runat="server" Text="" />
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.
I tried to describe the problem and didn't posted the complete source-code to leave this post slim.
Jul 29, 2009 07:17 AM|kallem|LINK
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.