Control ID: ctl00_ctl00

  • Thread starter Thread starter shapper
  • Start date Start date
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
 
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
 
Back
Top