asp:Menu, DynamicItemTemplate and formating text

J

Jerry C

I am working with a asp:menu the NavigateURL is blank I want the menu to
postback . I am using the DynamicItemTemplate. The simple form for the
template is

<DynamicItemTemplate>
<b><%# Eval("Text") %></b> <br /> <%#Eval("ToolTip")%>
</DynamicItemTemplate>

and it look like this for example

Text dkd kdk
ToolTip alkd alkdj fl adjla l dfjaldkfja la dfaldfka laskdflas dflajdf a
aldkjfal ajdf

This works great but I want to format the text in the ToolTip so I can set
the width and allow it to wrap. So it would look like this

Text dkd kdk
ToolTip alkd alkdj fl adjla l dfjaldkfja la dfaldfka
laskdflas dflajdf a aldkjfal ajdf


Code in the dynamicItemTemplate like this formats ok but when I click in the
tooltip text the menu does not work. when I click in the text section it
works OK.


<DynamicItemTemplate>
<b><%# Eval("Text") %></b> <br />
<table Width=250><tr><td width=250> <%#Eval("ToolTip")%> </td></tr></table>
</DynamicItemTemplate>

Thank you
 
S

Steven Cheng[MSFT]

Hi Jerry,

Regarding on the ASP.NET Menu control's dynamiItemTemplate postback issue,
it is due to the html <table/> element will suppress the click event at
client-side, somewhat related to the client-side webbrowser's
implementation when there is html <table> nested inside html <a> link
element.

So far I have tested a means to overcome this behavior. You can add a
javascript statement in your html table element's "onclick" client-side
handler which programamtically trigger the parent element(the postback link
generated by ASP.NET menu control). Here is the code snippet:

=====================
<asp:Menu ID="Menu1" .............>

<DynamicItemTemplate >
<b><%# Eval("Text") %></b>

<table Width="250" onclick="this.parentNode.click();">
<tr><td width="250"> <%#Eval("ToolTip")%> </td></tr></table>
</DynamicItemTemplate>
=======================

You can have a test on your side to see whether it works.

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top