Aj1
Aj1

Reputation: 973

Access User control Id used in aspx page in the user control code behind

I have a user control registered and placed in a aspx page.

<%@ Register TagPrefix="uc1" TagName="Client" src="/PageLayout/Client.ascx"  %>
<uc1:Client id="IdClient1" runat="server"></uc1:Client>

I would like to access the id "IdClient1" in the codebehind of my user control Client. Can anybody tell how can i access it ?

Thanks

Upvotes: 1

Views: 2242

Answers (1)

JayHach
JayHach

Reputation: 204

In the code behind you can access the Control ID using Me.ID in VB or this.ID in C#.

In VB.NET

Me.ID

In C#

this.ID

Upvotes: 4

Related Questions