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.
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.
<A 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"> </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
作者:Zhi-QiangNi(Zhi-QiangNi's Tech Blog)
出处:http:// Zhi-QiangNi.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。