简体   繁体   English

ASP.NET服务器标签格式不正确

[英]ASP.NET The server tag is not well formed

I have the following code, I'm trying to disable the radio button when the condition is true. 我有以下代码,当条件为真时,我试图禁用单选按钮。 However when I add in the <%# Eval("category_id").ToString().Equals("5") ? "disabled" : "" %> 但是,当我添加<%# Eval("category_id").ToString().Equals("5") ? "disabled" : "" %> <%# Eval("category_id").ToString().Equals("5") ? "disabled" : "" %> statement I'm getting the The server tag is not well formed error. 我正在获取<%# Eval("category_id").ToString().Equals("5") ? "disabled" : "" %>语句The server tag is not well formed错误。

I'm not sure what is wrong with my code. 我不确定我的代码有什么问题。 If I removed the Code snippet outside of the radio button tag the word disabled displays as text on the screen, but as soon as I move it in the radio button tag I get the error. 如果我删除了单选按钮标签之外的代码段,则disabled字会在屏幕上显示为文本,但是一旦在单选按钮标签中移动它,我就会收到错误消息。

   <asp:RadioButton  
        ID="Status_C" 
        runat="server" 
        Text="C" 
        GroupName="Status" 
        Style="color: green;" 
        <%# Eval("category_id").ToString().Equals("5") ? "disabled" : "" %> 
    />
<asp:RadioButton  
        ID="Status_C" 
        runat="server" 
        Text="C" 
        GroupName="Status" 
        Style="color: green;" 
        Enabled='<%# !(Eval("category_id").ToString().Equals("5")) %>'
    />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM