单选按钮文本对齐问题 [英] Radiobutton Text alignment Issue

查看:48
本文介绍了单选按钮文本对齐问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在asp.net中工作,并且具有单选按钮列表,我想根据需要对齐其文本.这是我目前所拥有的:

I am working in asp.net and have radiobutton list and I want to align their text as I require. Here is what I have currently:

我想让他们像这样:

其次,当我单击Ages From单选按钮时,我将显示一个div像这样:

Secondly, when I click Ages From radiobutton, I display a div against this like:

,当我单击"All Ages"单选按钮时,我想隐藏该div.但是SelectedIndexChanged从第二次开始不起作用.它只能在第一次使用.

and when I click back to All Ages radio button, I want to hide that div. But SelectedIndexChanged doesn't work second time and onwards. It only works first time.

aspx代码:

<table>
                        <tr>
                            <td>
                                <asp:RadioButtonList ID="rdoAge" runat="server" RepeatDirection="Horizontal" 
                                    onselectedindexchanged="rdoAge_SelectedIndexChanged" AutoPostBack="true" >
                                    <asp:ListItem Text="All Ages" Value="All Ages" Selected="True"></asp:ListItem>
                                    <asp:ListItem Text="Ages From" Value="Ages From"></asp:ListItem>
                                </asp:RadioButtonList>
                            </td>
                            <div id="divAge" runat="server" visible="false">
                                <td>
                                    <asp:TextBox ID="txtAgeFrom" runat="server" CssClass="textEntry2" MaxLength="3" Width="65"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:Label ID="lblTo" runat="server" Text="To"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="txtAgeTo" runat="server" CssClass="textEntry2" MaxLength="3" Width="65"></asp:TextBox>
                                </td>
                            </div>
                        </tr>
                    </table>

cs文件的代码:

protected void rdoAge_SelectedIndexChanged(object sender, EventArgs e)
    {
        switch (rdoAge.SelectedValue)
        {
            case "All Ages":
                divAge.Visible = false;
                break;
            case "Ages From":
                divAge.Visible = true;
                break;
        }
    }

如果有人对这个问题有帮助的话,我将不胜感激.

I'll be grateful if anyone suggests something useful for this issue.

提前谢谢.

推荐答案

这是缺少结束标记的问题.我一定错过了某些控件的结束标记.我重新添加了所有控件,同时考虑了结束标签.现在一切正常.

That was the problem of missing closing tag. I must have missed a closing tag of some control. I re-added all controls with taking care of closing tags. Now it is working fine.

谢谢大家的帮助.

这篇关于单选按钮文本对齐问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆