Asp.net radiobuttonlist:元素'br'不能嵌套在元素'listitem'中 [英] Asp.net radiobuttonlist: the element 'br' cannot be nested within the element 'listitem'

查看:160
本文介绍了Asp.net radiobuttonlist:元素'br'不能嵌套在元素'listitem'中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如我有这个单选按钮。



(o)item1(o)item 2 





但是,我希望它像:



(o)item1(o)item2 
在这里这里排队





我目前的加价是:



< pre lang =HTML> < asp:RadioButtonList ID = RadioButtonList1 runat = server RepeatDirection = 水平 宽度 = 650px 字体-Size = 较小的 >
< asp:ListItem 已选择 = True = 0 > 放宽< br > (MY MAN)< / asp:ListItem >
< asp:ListItem < span class =code-keyword> = 1 > 再次放松< span class =code-keyword>< br > (我的男士) < / asp:ListItem >
< asp:ListItem = 2 > 再次放松2 < br > (MyMan)< / asp:ListItem >
< asp:ListItem = 3 > 放宽3 < br > (我的男士)< / asp:ListItem >
< asp:ListItem = 4 > 放松4 < br > (我的男人)< / asp:ListItem >
< asp: ListItem = 5 > 放宽5 < br > (我的男士)< / asp:ListItem >
< ; asp:ListItem = 6 > 放松6 < br > (我的男人)< / asp:ListItem > ;
< / asp:RadioButtonList >





但它会生成以下验证错误消息:元素'br'不能嵌套在元素'listitem'。



我尝试过:



i尝试谷歌搜索,但没有找到可能的答案。请帮忙谢谢。甚至尝试用br /

解决方案

替换br使用文本属性



 <   asp:label     text   =  text    id   =  lbl_total_users    runat   =  server    xmlns:asp   = #unknown    /  >  <   br     /  >  
< asp:radiobuttonlist id = RadioButtonList1 runat = server repeatdirection = 水平 width = 650px font-size = 更小 xmlns:asp = #unknown >
< asp:listitem 已选择 = True value = 0 text = 放松< br>(我的男人) > < / asp:listitem >
< asp:listitem value = 1 text = 再次放松< br>(我的男人) > < / asp:listitem >
< asp:listitem = 2 text = 再次放松2< br>(MyMan) > < < span class =code-leadattribute> / asp:listitem
>
< asp:listitem value < span class =code-keyword> = 3 text = 放松3< br>(我的男人) > < / asp:listitem >
< asp:listitem value = 4 text = 放松4< br>(我的男人) > < / asp:listitem >
< asp:listitem value = 5 text = 放松5< br>(我的男人) > < / asp:listitem >
< asp:listitem = 6 text = 放松6< br>(我的男人) > < / asp:listitem >
< / asp:radiobuttonlist >


< blockquote class =quote>

引用:

整行就行了。我的问题是我不想收到这个警告。

简单,从列表项中删除< br>



[UpDate]

如果你想要列表项中的< br> 而SQP不想要,我想我们有离婚的情况。


for example i have this radio button.

(o) item1  (o) item 2



however, i want it to be like:

(o) item1   (o) item2
  line here   line here



My current markup is:

<asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal" Width="650px" Font-Size="Smaller">
    <asp:ListItem Selected="True" Value="0">Relax<br>(MY MAN)</asp:ListItem>
    <asp:ListItem Value="1">Relax Again<br>(My Man)</asp:ListItem>
    <asp:ListItem Value="2">Relax Again 2<br>(MyMan)</asp:ListItem>
    <asp:ListItem Value="3">Relax 3<br>(My Man)</asp:ListItem>
    <asp:ListItem Value="4">Relax 4<br>(My Man)</asp:ListItem>
    <asp:ListItem Value="5">Relax 5<br>(My Man)</asp:ListItem>
    <asp:ListItem Value="6">Relax 6<br>(My Man)</asp:ListItem>
</asp:RadioButtonList>



But it generates the following validation error messages: the element 'br' cannot be nested within the element 'listitem'.

What I have tried:

i tried googling for this but found no possible answer. Please help Thanks. Even tried replacing br with br /

解决方案

use Text Property

 <asp:label text="text" id="lbl_total_users" runat="server" xmlns:asp="#unknown" /> <br />
    <asp:radiobuttonlist id="RadioButtonList1" runat="server" repeatdirection="Horizontal" width="650px" font-size="Smaller" xmlns:asp="#unknown">
    <asp:listitem selected="True" value="0" text="Relax <br>(MY MAN)"></asp:listitem>
    <asp:listitem value="1" text="Relax Again<br>(My Man)"></asp:listitem>
    <asp:listitem value="2" text="Relax Again 2<br>(MyMan)"></asp:listitem>
    <asp:listitem value="3" text="Relax 3<br>(My Man)"></asp:listitem>
    <asp:listitem value="4" text="Relax 4<br>(My Man)"></asp:listitem>
    <asp:listitem value="5" text="Relax 5<br>(My Man)"></asp:listitem>
    <asp:listitem value="6" text="Relax 6<br>(My Man)"></asp:listitem>
</asp:radiobuttonlist>


Quote:

the whole thing above the line. my issue is that i don't want to receive that warning.

Simple, remove the <br> from your List Items.

[UpDate]
If you want a <br> in List Items and SQP don't want, I think we have a case of divorce.


这篇关于Asp.net radiobuttonlist:元素'br'不能嵌套在元素'listitem'中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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