how to make radiobuttion visible false in repeater?

Diksha dudi 126 Reputation points
2022-04-16T06:51:10.927+00:00

I am having 5 radio button in repeater and want to make it invisible when its text is nothing, but it is not working

aspx code:

193470-screenshot-63.png193591-screenshot-64.png193527-screenshot-65.png

vb.net code:

Imports System.Data  
Imports System.Data.SqlClient  
  
Partial Class Product_detailpage  
    Inherits System.Web.UI.Page  
  
    Dim user_id As Integer  
  
    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load  
  
       
         
        If Not Me.IsPostBack Then  
            Me.pDetailsurl()  
            Me.pincode()  
            Me.prod_size()  
  
        End If  
    End Sub  
  
    Private Sub prod_size()  
        Dim value As String = ""  
  
  
        For Each item As RepeaterItem In durl.Items  
  
            If item.ItemType = ListItemType.AlternatingItem OrElse item.ItemType = ListItemType.Item Then  
                Dim rdb As RadioButton = TryCast(item.FindControl("RadioButton1"), RadioButton)  
                Dim rdb1 As RadioButton = TryCast(item.FindControl("RadioButton2"), RadioButton)  
                Dim rdb2 As RadioButton = TryCast(item.FindControl("RadioButton3"), RadioButton)  
                Dim rdb3 As RadioButton = TryCast(item.FindControl("RadioButton4"), RadioButton)  
                Dim rdb4 As RadioButton = TryCast(item.FindControl("RadioButton5"), RadioButton)  
  
                If rdb.Text Is Nothing Then  
                    MsgBox("hyy")  
                    rdb.Visible = False  
                End If  
                If rdb1.Text Is Nothing Then  
                    rdb1.Visible = False  
                End If  
                If rdb2.Text Is Nothing Then  
                    rdb2.Visible = False  
                End If  
                If rdb3.Text Is Nothing Then  
                    rdb3.Visible = False  
                End If  
                If rdb4.Text Is Nothing Then  
                    rdb4.Visible = False  
                End If  
  
            End If  
  
  
        Next  
    End Sub  

output:

193500-screenshot-66.png

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
1,481 questions
ASP.NET Web Forms
ASP.NET Web Forms
A part of the ASP.NET web application framework that can be used to create ASP.NET web applications.
550 questions
{count} votes