Hi @Diksha dudi ,
In the repeater you can use FindControl
to find the div
.
Dim sample As HtmlGenericControl = TryCast(b.Parent.FindControl("div1"), HtmlGenericControl)
Page.FindControl(String) Method:searches the page naming container for a server control with the specified identifier.
https://learn.microsoft.com/en-us/dotnet/api/system.web.ui.page.findcontrol?view=netframework-4.8
You can refer to the example below.
Protected Sub OnMyCommand1(ByVal sender As Object, ByVal e As CommandEventArgs)
Dim b As LinkButton = TryCast(sender, LinkButton)
Dim sample As HtmlGenericControl = TryCast(b.Parent.FindControl("div1"), HtmlGenericControl)
If b IsNot Nothing Then
Dim c As Label = CType(b.Parent.FindControl("Label1"), Label)
If c IsNot Nothing Then
sample.Visible = False
c.Text = "text changed in handler"
c.ForeColor = System.Drawing.Color.Green
End If
End If
End Sub
Best regards,
Lan Huang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.