[英]Hide text of radiobuttonlist inside gridview
Here's a radiobuttonlist in a template field of gridview (using sqldatasource): 这是gridview的模板字段中的单选按钮列表(使用sqldatasource):
</asp:TemplateField>
<asp:TemplateField HeaderText=" -- 1 -- 2 -- 3 -- 4 -- 5 -- " HeaderStyle-Width="200px" ItemStyle-HorizontalAlign="Center" >
<ItemTemplate>
<asp:RadioButtonList AutoPostBack="True" ID="rblRating" runat="server"
SelectedIndex='<%# Convert.ToInt32(DataBinder.Eval(Container.DataItem , "Rating"))%>'
OnSelectedIndexChanged="rblRating_SelectedIndexChanged"
RepeatDirection="Horizontal">
<asp:ListItem Value="0"></asp:ListItem>
<asp:ListItem Value="1"></asp:ListItem>
<asp:ListItem Value="2"></asp:ListItem>
<asp:ListItem Value="3"></asp:ListItem>
<asp:ListItem Value="4"></asp:ListItem>
<asp:ListItem Value="5"></asp:ListItem>
</asp:RadioButtonList>
<%--<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Select a Rating" ControlToValidate="rblRating"></asp:RequiredFieldValidator>--%>
</ItemTemplate>
<FooterTemplate>
<div class="divright"><asp:Label ID="lblSum" runat="server" Text="Sum ratings: " Font-Size="Small" ForeColor="#3399FF"></asp:Label></div>
<div class="divleft2"><asp:Label ID="lblAverage" runat="server" Width="50px" Font-Bold="True"></asp:Label></div>
</FooterTemplate>
<HeaderStyle Width="150px"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
The Text values of each radiobuttonlist item have “1”, “2”, “3” etc beside them and I want them to be blank since I am designating the rating/number (1 through 5) in the header. 每个单选按钮列表项的文本值旁边都有“ 1”,“ 2”,“ 3”等,我希望它们为空白,因为我要在标题中指定等级/数字(1到5)。 I've left out Text in aspx, and set Text to blank in the radiobuttonlist ListItem Collection editor properties but the Values are still showing up.
我在aspx中省略了Text,并在单选按钮ListItem集合编辑器属性中将Text设置为空白,但是Values仍在显示。 How to hide?
如何隐藏?
Simply specify the Text
property and leave them empty. 只需指定
Text
属性并将其留空即可。
<asp:ListItem Value="0" Text=""></asp:ListItem>
<asp:ListItem Value="1" Text=""></asp:ListItem>
<asp:ListItem Value="2" Text=""></asp:ListItem>
<asp:ListItem Value="3" Text=""></asp:ListItem>
<asp:ListItem Value="4" Text=""></asp:ListItem>
<asp:ListItem Value="5" Text=""></asp:ListItem>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.