当前位置:编程学习 > C#/ASP.NET >>

RadioButtonList 不支持代码块

页面中用到一个RadioButtonList,aspx代码如下:
 <asp:RadioButtonList ID="RadioButtonList1" runat="server">
        <asp:ListItem Value="0" Selected=True >男</asp:ListItem>
        <asp:ListItem Value="1">女</asp:ListItem>
 </asp:RadioButtonList>
想要实现根据当前用户选择的语言更改“男、女”字样。

<asp:RadioButtonList ID="RadioButtonList1" runat="server">
        <asp:ListItem Value="0" Selected=True ><%=Session["language"].ToString()=="zh-cn"?"男":"Man"%></asp:ListItem>
        <asp:ListItem Value="1"><%=Session["language"].ToString()=="zh-cn"?"女":"Woman"%></asp:ListItem>
 </asp:RadioButtonList>

提到不支持代码块。求解?? --------------------编程问答-------------------- 没人回答? --------------------编程问答-------------------- 可以通过后台进行判断啦! 前台那样写有点问题的!  我给一点参考代码~
   if (Session["language"] != null && Session["language"].ToString()=="zh-cn")
                    {
                        this.RadioButtonList1.Items[0].Text = "男";
                       
                    }
                    else
                    {
                        this.RadioButtonList1.Items[0].Text = "Man";
                    } --------------------编程问答-------------------- 后台试试。
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,