Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > localized asp:label w/nested control bug?

Reply
Thread Tools

localized asp:label w/nested control bug?

 
 
Anson Goldade
Guest
Posts: n/a
 
      10-30-2007
I think I may have run into an issue with the asp.net lable control. Take
the following code

<asp:label runat="server" id="txtTextLabel"
associatedcontrolid="txtText" meta:resourcekey="txtTextLabel">
<asp:textbox runat="server" id="txtText"></asp:textbox>
</asp:label>

Create the app local resource file with a single entry (e.g. Name:
"txtTextLabel.Text" Value: "Testing resource").

Now run the page. You should get the following error "Unable to find
control with id 'txtText' that is associated with the Label 'txtTextLabel'."
Now remove the meta:resourcekey="txtTextLabel" attribute from the asp:label
control and it works fine. Is there a reason why controls can't be nested
when using localized resources with labels? Thanks for your assistance in
advance.
 
Reply With Quote
 
 
 
 
Anson Goldade
Guest
Posts: n/a
 
      10-30-2007
Dave,

Nesting inside label tags is supported within HTML. According to the 4.0
spec any inline elements are supported as child elements to a label. The way
to get the asp:label control to render as a label tag instead of a span is to
set the associatedcontrolid property as in the sample code. The nesting is
not the problem, the problem is the nesting when used in conjunction with the
localized resource files.

The reason we want to nest them is so that we can apply the style
information we want across the label to get the flowing working properly. If
the nesting isn't going to work, then we have to wrap all of the label,
input, validation control pairs in a div just to get the layout and flow
working properly.

Also, usually, if you aren't able to nest something within another control,
you won't get the option in intellisense. For nesting the textbox control
in the label, you do get the intellisense meaning that it's been defined in
the schema that nesting is allowed/supported ... at least I believe that's
how it works.

The ultimate resolution to my question would be for me to understand if this
is a bug or if it's intentionally not supported. I need to make a decision
about wether we should work with support to resolve on just bite the bullet
and wrap everything in a div.

Thanks for your feedback.

"Dave Bush" wrote:

> You can't nest an asp:textbox in an asp:label. Put them beside each other
> and I bet it works.
>
> -----Original Message-----
> From: Anson Goldade [(E-Mail Removed)]
> Posted At: Tuesday, October 30, 2007 12:08 PM
> Posted To: microsoft.public.dotnet.framework.aspnet.webcontro ls
> Conversation: localized asp:label w/nested control bug?
> Subject: localized asp:label w/nested control bug?
>
> I think I may have run into an issue with the asp.net lable control. Take
> the following code
>
> <asp:label runat="server" id="txtTextLabel"
> associatedcontrolid="txtText" meta:resourcekey="txtTextLabel">
> <asp:textbox runat="server" id="txtText"></asp:textbox>
> </asp:label>
>
> Create the app local resource file with a single entry (e.g. Name:
> "txtTextLabel.Text" Value: "Testing resource").
>
> Now run the page. You should get the following error "Unable to find
> control with id 'txtText' that is associated with the Label
> 'txtTextLabel'."
> Now remove the meta:resourcekey="txtTextLabel" attribute from the
> asp:label
> control and it works fine. Is there a reason why controls can't be nested
> when using localized resources with labels? Thanks for your assistance in
> advance.
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating asp.net composite control using .net 1.1 which can themselves be localized John H ASP .Net Web Controls 0 05-22-2006 10:59 AM
Localized pages and change keylayout/Language by code (simulance Alt+Shift ) sastwhc ASP .Net 0 12-06-2005 07:44 AM
Adding a control to a localized ASP .NET 2.0 application =?Utf-8?B?SGVua2U=?= ASP .Net 0 08-08-2005 05:39 AM
Localized resources not loaded until an administrator open the site... Jéjé ASP .Net 0 06-25-2005 02:53 PM
Customizing localized applications Piotr Strycharz ASP .Net 4 08-20-2004 07:34 PM



Advertisments