composite controls - Bug in VS.NET 2003 (FR) ?

X

[XtOf].fr

Hello World !

Without answers in my country (FRANCE), I hope that you'll have a response
to my problem !

I'm trying to create a composite control (WebControlLibrary) with VS.NET
ARCHITECT 2003 (FR).

Concerning the personalized properties, redrawing in the User Interface and
on the Web, there's no problems...

But I do not manage to recover one event created dynamically in the
CreateChildControl function !

The following example contains only the basic code for a composite
controls...

----

Protected Overrides Sub Render(ByVal output As
System.Web.UI.HtmlTextWriter)
EnsureChildControls()
MyBase.Render(output)
End Sub

Protected Overrides Sub CreateChildControls()
Dim btnTest As New
System.Web.UI.WebControls.Button
btnTest.ID = "btnTest"
btnTest.Text = "Cliquez ici pour voir !"
Controls.Add(btnTest)
AddHandler btnTest.Click, AddressOf test_click
End Sub

Protected Sub test_click(ByVal source As Object,
ByVal e As EventArgs)
DirectCast(FindControl("btnTest"),
System.Web.UI.WebControls.Button).Text = "Bravo !"
End Sub

---

When one clicks on the button, my code is executed and the button is well
redrawed (something like userscontrols) but the function test_click is never
called !!!!

I made the test on Windows 2000 professionnal (FR) and Windows XP Pro (FR).
I also made the test with CSharp... and : NOTHING!

It's also the same if you use a label, a linkbutton or I do not know what
anything else !

On the other hand, I did not test any other method than 'Code Behind'.

Moreover, the example of chapter 11 - vbcompositesnippet- of the french
version of book 'Creating Web applications...' (Microsoft Press France)
preparing with examination MCSD.NET does not function either...

Is it a Microsoft .NET Developpers's Team known bug ?

If so, is there a service pack available?

Thanks you for your help...

Regards,

[ XtOf ]
 
T

Teemu Keiski

Hi,

does this control implement INamingContainer interface? If doesn't, put it
to implement that. It is needed for correct postback data routing in a
composite control.
 
X

[XtOf].fr

Hi Teemu,

Thank you for your invaluable assistance for me !

However, don't you find abnormal that VS.NET 2003 doesn't implement
automatically INamingContainer when it create a New composite based on his
WebControlLibrary's Model?

But, the important thing is that it works now!

Regards,

[XtOf].fr

Teemu Keiski said:
Hi,

does this control implement INamingContainer interface? If doesn't, put it
to implement that. It is needed for correct postback data routing in a
composite control.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist


"[XtOf].fr" <x{StopSpam}tof[dot]fr[at]net{StopSpam}cour{StopSpam}rier> wrote
in message news:uwML%[email protected]...
Hello World !

Without answers in my country (FRANCE), I hope that you'll have a response
to my problem !

I'm trying to create a composite control (WebControlLibrary) with VS.NET
ARCHITECT 2003 (FR).

Concerning the personalized properties, redrawing in the User Interface and
on the Web, there's no problems...

But I do not manage to recover one event created dynamically in the
CreateChildControl function !

The following example contains only the basic code for a composite
controls...

----

Protected Overrides Sub Render(ByVal output As
System.Web.UI.HtmlTextWriter)
EnsureChildControls()
MyBase.Render(output)
End Sub

Protected Overrides Sub CreateChildControls()
Dim btnTest As New
System.Web.UI.WebControls.Button
btnTest.ID = "btnTest"
btnTest.Text = "Cliquez ici pour voir !"
Controls.Add(btnTest)
AddHandler btnTest.Click, AddressOf test_click
End Sub

Protected Sub test_click(ByVal source As Object,
ByVal e As EventArgs)
DirectCast(FindControl("btnTest"),
System.Web.UI.WebControls.Button).Text = "Bravo !"
End Sub

---

When one clicks on the button, my code is executed and the button is well
redrawed (something like userscontrols) but the function test_click is never
called !!!!

I made the test on Windows 2000 professionnal (FR) and Windows XP Pro (FR).
I also made the test with CSharp... and : NOTHING!

It's also the same if you use a label, a linkbutton or I do not know what
anything else !

On the other hand, I did not test any other method than 'Code Behind'.

Moreover, the example of chapter 11 - vbcompositesnippet- of the french
version of book 'Creating Web applications...' (Microsoft Press France)
preparing with examination MCSD.NET does not function either...

Is it a Microsoft .NET Developpers's Team known bug ?

If so, is there a service pack available?

Thanks you for your help...

Regards,

[ XtOf ]
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top