本文介绍了使用Javascript或JQuery更改ASP radiobuttonlist repeatdirection属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,只是想知道当屏幕尺寸小于980时是否可以更改asp radiobuttonlist重复方向



Hi everyone just wondering if it is possible to change a asp radiobuttonlist repeatdirection when screen size is smaller than 980

<asp:RadioButtonList ID="RadioButtonList1"  runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" >
                                <asp:ListItem Text="Strongly&nbsp;Agree"></asp:ListItem>
                                <asp:ListItem Text="Agree"></asp:ListItem>
                                <asp:ListItem Text="Neutral"></asp:ListItem>
                                <asp:ListItem Text="Disgree"></asp:ListItem>
                                <asp:ListItem Text="Strongly&nbsp;Disgree"></asp:ListItem>

                            </asp:RadioButtonList>







请任何帮助都是apreciated



SHOUTING删除 - OriginalGriff [/ edit]




please any help would be apreciated

[edit]SHOUTING removed - OriginalGriff[/edit]

推荐答案



  1. 案例 - 1 RepeatDirection =Horizo​​ntal


  1. Case - 1 (RepeatDirection="Horizontal")
<span id="RadioButtonList1">
    <input id="RadioButtonList1_0" type="radio" name="RadioButtonList1" value="Strongly Agree" />
    <label for="RadioButtonList1_0">Strongly Agree</label>
    
    <input id="RadioButtonList1_1" type="radio" name="RadioButtonList1" value="Agree" />
    <label for="RadioButtonList1_1">Agree</label>
    
    <input id="RadioButtonList1_2" type="radio" name="RadioButtonList1" value="Neutral" />
    <label for="RadioButtonList1_2">Neutral</label>
    
    <input id="RadioButtonList1_3" type="radio" name="RadioButtonList1" value="Disgree" />
    <label for="RadioButtonList1_3">Disgree</label>
    
    <input id="RadioButtonList1_4" type="radio" name="RadioButtonList1" value="Strongly Disgree" />
    <label for="RadioButtonList1_4">Strongly Disgree</label>
</span>





  • 案例 - 2 RepeatDirection =Vertical



    注意: - 在这里,我们可以检查标签后添加 Break(br)标签,以便 RadioButtons 垂直对齐。



  • Case - 2 (RepeatDirection="Vertical")

    Note:- Here we can check that Break (br) tags are getting added after labels to make the RadioButtons Vertically aligned.

    <span id="RadioButtonList1">
        <input id="RadioButtonList1_0" type="radio" name="RadioButtonList1" value="Strongly Agree" />
        <label for="RadioButtonList1_0">Strongly Agree</label><br />
        
        <input id="RadioButtonList1_1" type="radio" name="RadioButtonList1" value="Agree" />
        <label for="RadioButtonList1_1">Agree</label><br />
        
        <input id="RadioButtonList1_2" type="radio" name="RadioButtonList1" value="Neutral" />
        <label for="RadioButtonList1_2">Neutral</label><br />
        
        <input id="RadioButtonList1_3" type="radio" name="RadioButtonList1" value="Disgree" />
        <label for="RadioButtonList1_3">Disgree</label><br />
        
        <input id="RadioButtonList1_4" type="radio" name="RadioButtonList1" value="Strongly Disgree" />
        <label for="RadioButtonList1_4">Strongly Disgree</label>
    </span>











  • 现在我的逻辑w应按照 RepeatDirection 删除并添加这些 Break(br)标签。





    • 如果找到 Break 标签(意味着当前它是垂直)标签之后,它们将被删除以使其水平
    • 否则如果找不到标签(表示当前它是水平),然后会添加它们以使其垂直




    • Now my logic would be removing and adding these Break (br) tags as per the RepeatDirection.


      • If Break tags are found (means currently it is Vertical) after the labels, then they will be removed to make it Horizontal.
      • Else if Break tags are not found(means currently it is Horizontal), then they will be added to make it Vertical.

      • 这篇关于使用Javascript或JQuery更改ASP radiobuttonlist repeatdirection属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

    10-28 00:42