Zhi-QiangNi's tech blog--AJAX's paradise
I'm working at the Microsoft IBS DevDiv Community Support Team, in charge of the customer service of ASP/AJAX forum. Welcome to my blog and AJAX forum, anyone interested in ASP.Net Ajax can discuss it with me. :-)
When we hover over the stars of the Rating control, the hovered star's value would be displayed as the Tooltip. Customer may wish to customize the Tooltip of the Rating's star. Now, let's do it.

After the Rating control is rendered, three sections will be generated. An INPUT document, whose id is "the Rating's ID"_"RatingExtender"_"ClientState", which is used to save the Rating behavior's value.
<INPUT id=ThaiRating_RatingExtender_ClientState type=hidden value=2 name=ThaiRating_RatingExtender_ClientState>
An A document, whose id is "the Rating's ID"_"A", which is used to disply the Tooltip.
<id=ThaiRating_A title=4 style="TEXT-DECORATION: none" href="#">
A few SPAN documents, whose id are "the Rating's ID"_"Star"_"the Index", which are used to display the stars with the corresponding format CssClass.
<SPAN class="ratingStar filledRatingStar" id=ThaiRating_Star_1 style="FLOAT: left" value="1">&nbsp;</SPAN>

Then, to customize the Tooltip, we need find the current A document. The RatingBehavior provides a function add_MouseOver(handler) to help us handle the mouse over event. In the handler function, we can find the Rating's client behavior by the parameter-sender.

Code

 

Notice that we can also simply use $find(the Rating's Id) to achieve this in any client function.

Then, the A document is this $get(elt.id + "_A"). Modifying the title property is the final step.

Here is the complete code:

Code

 

Thread url:http://forums.asp.net/t/1369024.aspx

posted on 2009-01-13 13:20  Zhi-Qiang Ni  阅读(879)  评论(0编辑  收藏  举报