S
shapper
Hello,
I have a custom control named Parent where I used the following:
Protected Overrides Sub CreateChildControls()
...
MyBase.Controls.Add(MyTextBox)
MyBase.CreateChildControls()
Me.ChildControlsCreated = True
End Sub
Public Overloads Overrides Sub RenderBeginTag(ByVal writer As
HtmlTextWriter)
If Me.ClientID <> Nothing Then _
writer.AddAttribute(HtmlTextWriterAttribute.Id, Me.ClientID)
If Me.CssClass <> Nothing Then _
writer.AddAttribute(HtmlTextWriterAttribute.Class,
Me.CssClass)
writer.RenderBeginTag(HtmlTextWriterTag.Div)
End Sub
Public Overloads Overrides Sub RenderEndTag(ByVal writer As
HtmlTextWriter)
writer.RenderEndTag()
End Sub
Now I created a new control named Child which inherits from Parent.
In this control I need to do two things:
1. Add a new control, a label.
2. Make CssClass = "MyChildCssClass" IF Me.CssClass = Nothing.
I am having problems with making this happen.
I tried to create CreateChildControls and RenderBeginTag in my Child
control that inherits from my Parent control but something is going
on.
I am not able to "merge" the control adding and attributes from my
Parent control and my Child control.
How should I do this?
Thanks,
Miguel
I have a custom control named Parent where I used the following:
Protected Overrides Sub CreateChildControls()
...
MyBase.Controls.Add(MyTextBox)
MyBase.CreateChildControls()
Me.ChildControlsCreated = True
End Sub
Public Overloads Overrides Sub RenderBeginTag(ByVal writer As
HtmlTextWriter)
If Me.ClientID <> Nothing Then _
writer.AddAttribute(HtmlTextWriterAttribute.Id, Me.ClientID)
If Me.CssClass <> Nothing Then _
writer.AddAttribute(HtmlTextWriterAttribute.Class,
Me.CssClass)
writer.RenderBeginTag(HtmlTextWriterTag.Div)
End Sub
Public Overloads Overrides Sub RenderEndTag(ByVal writer As
HtmlTextWriter)
writer.RenderEndTag()
End Sub
Now I created a new control named Child which inherits from Parent.
In this control I need to do two things:
1. Add a new control, a label.
2. Make CssClass = "MyChildCssClass" IF Me.CssClass = Nothing.
I am having problems with making this happen.
I tried to create CreateChildControls and RenderBeginTag in my Child
control that inherits from my Parent control but something is going
on.
I am not able to "merge" the control adding and attributes from my
Parent control and my Child control.
How should I do this?
Thanks,
Miguel