我试图为RadioButtonList的每个ListItem的任何,或

<asp:RadioButtonList ID="RadioButtonListPaymentFrequency"
    runat="server"
    RepeatDirection="Vertical"
    RepeatLayout="Table"
    RepeatColumns="1" />


后面的VB代码...

Dim ListItemOneTimeOnly As New ListItem("One-Time Only", "1")
ListItemOneTimeOnly.Attributes.Add("onmouseover", "ddrivetip('Example: $300 total amount paid one-time means 1 payment of $300.')")
ListItemOneTimeOnly.Attributes.Add("onmouseout", "hideddrivetip()")
RadioButtonListPaymentFrequency.Items.Add(ListItemOneTimeOnly)

Dim ListItemMonthly As New ListItem("Monthly", "12")
ListItemMonthly.Attributes.Add("onmouseover", "ddrivetip('Example: $300 total amount paid monthly means 12 payments of $25.')")
ListItemMonthly.Attributes.Add("onmouseout", "hideddrivetip()")
RadioButtonListPaymentFrequency.Items.Add(ListItemMonthly)

Dim ListItemQuarterly As New ListItem("Quarterly", "4")
ListItemQuarterly.Attributes.Add("onmouseover", "ddrivetip('Example: $300 total amount paid quarterly means 4 payments of $75.')")
ListItemQuarterly.Attributes.Add("onmouseout", "hideddrivetip()")
RadioButtonListPaymentFrequency.Items.Add(ListItemQuarterly)

Dim ListItemSemiannually As New ListItem("Semiannually", "2")
ListItemSemiannually.Attributes.Add("onmouseover", "ddrivetip('Example: $300 total amount paid monthly means 2 payments of $150.')")
ListItemSemiannually.Attributes.Add("onmouseout", "hideddrivetip()")
RadioButtonListPaymentFrequency.Items.Add(ListItemSemiannually)

Generated HTML...

<table id="RadioButtonListPaymentFrequency" border="0">
    <tbody>
        <tr>
            <td>
                <input id="RadioButtonListPaymentFrequency_0" name="RadioButtonListPaymentFrequency" value="1" type="radio">
                <label for="RadioButtonListPaymentFrequency_0">One-Time Only</label>
            </td>
        </tr>
        <tr>
            <td>
                <input id="RadioButtonListPaymentFrequency_1" name="RadioButtonListPaymentFrequency" value="12" type="radio">
                <label for="RadioButtonListPaymentFrequency_1">Monthly</label>
            </td>
        </tr>
        <tr>
            <td>
                <input id="RadioButtonListPaymentFrequency_2" name="RadioButtonListPaymentFrequency" value="4" type="radio">
                <label for="RadioButtonListPaymentFrequency_2">Quarterly</label>
            </td>
        </tr>
        <tr>
            <td>
                <input id="RadioButtonListPaymentFrequency_3" name="RadioButtonListPaymentFrequency" value="2" type="radio">
                <label for="RadioButtonListPaymentFrequency_3">Semiannually</label>
            </td>
        </tr>
    </tbody>
</table>

最佳答案

你不知道除非您使用workaroundsubclass RadioButtonList。我个人只是使​​用JQuery附加事件处理程序。

09-25 18:39