隐藏radiobuttonlist的文本,内部gridview



这是gridview模板字段中的radiobuttonlist(使用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>

每个RadioButtonList项目的文本值在它们旁边都有" 1"," 2"," 3"等,我希望它们是空白的,因为我在标头中指定了评分/数字(1至5)。我在ASPX中遗漏了文本,并将文本设置为RadioButtonList ListItem Collection Editor属性中的空白,但值仍在显示。如何隐藏?

简单地指定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>

最新更新