【问题标题】:Radio button not visible in ASP.NET page单选按钮在 ASP.NET 页面中不可见
【发布时间】:2020-02-11 23:32:19
【问题描述】:

ASP.NET 单选按钮在我的页面中不可见。我在 ASP.NET ListView 中使用它。我也尝试将单选按钮放在 ASP.NET 更新面板内容模板中。请告诉我出了什么问题?

<asp:UpdatePanel runat="server">
 <ContentTemplate>
 <asp:ListView ID="FraudCheckList_listView" runat="server">
 <ItemTemplate>
     <p class="fraud-step-title"><%#Eval("question")%></p>
     <div class="row">
    <asp:RadioButton 
         runat="server" 
         class="radio-inline col" 
         GroupName="govt" 
         Text="Low Risk"
    ></asp:RadioButton>
                                                       
    <asp:RadioButton 
         runat="server" 
         GroupName='govt' 
         Text="Medium Risk"
    ></asp:RadioButton>
                                                            
    <asp:RadioButton 
        runat="server" 
        GroupName='govt' 
        Text="High Risk"
     ></asp:RadioButton>
     </div> 
  </ItemTemplate>   
  </asp:ListView> 
  </ContentTemplate>
 </asp:UpdatePanel>   

【问题讨论】:

  • 您需要分享您的代码。没有它,我们就无法猜测出了什么问题以及如何纠正。
  • 谢谢@ChetanRanpariya 我已经上传了代码,但似乎不是css问题
  • 您是否将任何数据加载到列表视图中?
  • 是的。我正在从表数据源加载数据。
  • 你能分享一下 ListView 的屏幕截图吗?

标签: c# asp.net user-interface radio-button visible


【解决方案1】:

由于您没有分享您的代码的外观,我只是假设某些事情。看看你有没有这样做。

void Button_Click(object sender, System.EventArgs e){RadioButton.Visible=false;}

如果它是真的或其他东西,您的单选按钮将不可见。在您的情况下,它必须被隐藏。因此,将可见的变量设置为 **false ** 这样您就可以将代码更改为此并尝试一下。 您必须在主代码中执行此操作。不在您的 html 代码中。 谢谢!

【讨论】:

  • 在 Page_Load 方法中,我使用了 RadioButton radio = new RadioButton(); radio.Visible = false;但它没有任何区别。
  • 对不起。我的错。试试 radio.Visible = true;这行得通吗?
  • 您能否更新您的问题,同时显示您的 html 代码?
  • html页面包含大约5000行代码,Aadi。我会尽量给你相关代码。
  • 好的。否则只需更新您的问题,显示针对单选按钮编写的代码。也可以工作
猜你喜欢
  • 2011-01-12
  • 2019-01-16
  • 2013-07-30
  • 2012-09-05
  • 2019-08-10
  • 2018-03-06
  • 1970-01-01
  • 2011-10-10
  • 1970-01-01
相关资源
最近更新 更多