Control ID: ctl00_ctl00

S

shapper

Hello

I am creating a custom control using CreateChildControls.

I needed to change the begin and end tags so I have added the following
code:

Public Overloads Overrides Sub RenderBeginTag(ByVal writer As
HtmlTextWriter)
If Not String.IsNullOrEmpty(Me.ID) Then
writer.AddAttribute(HtmlTextWriterAttribute.Id, Me.ID)
End If
writer.RenderBeginTag(HtmlTextWriterTag.Div)
End Sub

Public Overloads Overrides Sub RenderEndTag(ByVal writer As
HtmlTextWriter)
writer.RenderEndTag()
End Sub

Now my custom control child controls are wrapped inside a <div> tag.

All my custom control child controls have "ctl00_ctl00_" because of the
master page

The problem is that the wrapper <div> tag ID does not include
"ctl00_ctl00_".

How can I solve this problem?

Thanks,
Miguel
 
L

Laurent Bugnion

Hi,
Hello

I am creating a custom control using CreateChildControls.

I needed to change the begin and end tags so I have added the following
code:

Public Overloads Overrides Sub RenderBeginTag(ByVal writer As
HtmlTextWriter)
If Not String.IsNullOrEmpty(Me.ID) Then
writer.AddAttribute(HtmlTextWriterAttribute.Id, Me.ID)
End If
writer.RenderBeginTag(HtmlTextWriterTag.Div)
End Sub

Public Overloads Overrides Sub RenderEndTag(ByVal writer As
HtmlTextWriter)
writer.RenderEndTag()
End Sub

Now my custom control child controls are wrapped inside a <div> tag.

All my custom control child controls have "ctl00_ctl00_" because of the
master page

The problem is that the wrapper <div> tag ID does not include
"ctl00_ctl00_".

How can I solve this problem?

Thanks,
Miguel

Use ClientID instead of ID in your code. The ClientID is the unique ID
sent to the web client.

HTH,
Laurent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top