Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Composite Custom Controls - The Event Horizon

Reply
Thread Tools

Composite Custom Controls - The Event Horizon

 
 
Mr Newbie
Guest
Posts: n/a
 
      11-06-2005
Hi,

Im doing something really stupid here, But I cant see the wood for the
trees. This is some of the code for my custom composite control. It renders
fine and the buttons do cause a Post to occur. But the Click Handlers are
not are never receiving a click event. I note that the name of the control
is _ctl0 or 1 etc.

<span id="MyDamnButton1" style="width:192px;Z-INDEX: 101; LEFT: 16px;
POSITION: absolute; TOP: 24px"><input type="submit" name="_ctl0"
value="Submit Me" /><input type="submit" name="_ctl1" value="Submit Me 2"
/></span>

What could I have done wrong ?

------------------------

Protected btnSubmit As New System.Web.UI.WebControls.Button
Protected btnSubmit2 As New System.Web.UI.WebControls.Button

Protected Overrides Sub CreateChildControls()
btnSubmit.Text = "Submit Me"
btnSubmit2.Text = "Submit Me 2"
Controls.Add(btnSubmit)
Controls.Add(btnSubmit2)

AddHandler btnSubmit.Click, AddressOf Me.Click1Handler
AddHandler btnSubmit2.Click, AddressOf Me.Click1Handler2
End Sub


Private Sub Click1Handler(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Dim a As Int16 = 0

End Sub

Private Sub Click1Handler2(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Dim a As Int16 = 0
End Sub

--
Best Regards

The Inimitable Mr Newbie º¿º


 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      11-06-2005
Hi Mr. N,

As I answered this in either the Framework newsgroup, or the Visual
Studio.Net newsgroup (can't remember which at the moment) fully, I'll trust
you to look there for the details. But because I'm a good sport, I'll give
you the Reader's Digest Condensed version here (again, and shame on you!):

Add an OnLoad override to the Control, and call EnsureChildControls() in
that.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.

"Mr Newbie" <> wrote in message
news:u$...
> Hi,
>
> Im doing something really stupid here, But I cant see the wood for the
> trees. This is some of the code for my custom composite control. It
> renders
> fine and the buttons do cause a Post to occur. But the Click Handlers are
> not are never receiving a click event. I note that the name of the control
> is _ctl0 or 1 etc.
>
> <span id="MyDamnButton1" style="width:192px;Z-INDEX: 101; LEFT: 16px;
> POSITION: absolute; TOP: 24px"><input type="submit" name="_ctl0"
> value="Submit Me" /><input type="submit" name="_ctl1" value="Submit Me 2"
> /></span>
>
> What could I have done wrong ?
>
> ------------------------
>
> Protected btnSubmit As New System.Web.UI.WebControls.Button
> Protected btnSubmit2 As New System.Web.UI.WebControls.Button
>
> Protected Overrides Sub CreateChildControls()
> btnSubmit.Text = "Submit Me"
> btnSubmit2.Text = "Submit Me 2"
> Controls.Add(btnSubmit)
> Controls.Add(btnSubmit2)
>
> AddHandler btnSubmit.Click, AddressOf Me.Click1Handler
> AddHandler btnSubmit2.Click, AddressOf Me.Click1Handler2
> End Sub
>
>
> Private Sub Click1Handler(ByVal sender As System.Object, ByVal e As
> System.EventArgs)
> Dim a As Int16 = 0
>
> End Sub
>
> Private Sub Click1Handler2(ByVal sender As System.Object, ByVal e As
> System.EventArgs)
> Dim a As Int16 = 0
> End Sub
>
> --
> Best Regards
>
> The Inimitable Mr Newbie º¿º
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
databound custom controls vs composite databound custom controls rodchar ASP .Net 0 11-26-2007 03:51 PM
Composite vs non composite Controls Mike ASP .Net Web Controls 4 03-11-2005 05:47 AM
Event Horizon SE? br2001@webtv.net DVD Video 7 04-08-2004 04:05 AM
Event Horizon SE nosf3ratu DVD Video 35 03-03-2004 12:14 PM
Composite control with dynamic composite controls sleigh ASP .Net 1 02-12-2004 06:24 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57