Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Help in composite control

Reply
Thread Tools

Help in composite control

 
 
Faizan Ahmed
Guest
Posts: n/a
 
      12-20-2004
Hello all,
I've been stuck in this problem for a couple of days now and could'nt get
any closer to the solution.. any help will be highly appreciated..

I have a server control that i derived from DataGrid control. This custom
control also has a Microsoft IE Toolbar control which contains some toolbar
buttons

The declaration of the class is :
Public Class EnhancedBrowse

Inherits DataGrid

Protected WithEvents mFooterToolbar As New
Microsoft.Web.UI.WebControls.Toolbar


The code in the OnInit method is
Protected Overrides Sub OnInit(ByVal e As System.EventArgs)

dim table As New HtmlControls.HtmlTable

table.Attributes.Add("runat", "server")

Dim tRow As New HtmlControls.HtmlTableRow

Dim td As New HtmlControls.HtmlTableCell

tRow.Attributes.Add("runat", "server")

td.Attributes.Add("runat", "server")

tRow.Controls.Add(td)

mHeaderToolbar.AutoPostBack = True

mHeaderToolbar.Attributes.Add("runat", "server")

AddHandler mHeaderToolbar.ButtonClick, New EventHandler(AddressOf
mHeaderToolbar_ButtonClick)

AddToolbarButtons(mHeaderToolbar, mHeaderToolbarCollection) ' This is a
method that creates buttons in the toolbar

mHeaderToolbar.Attributes.Add("id", "mHeaderToolBar")

td.Controls.Add(mHeaderToolbar)

table.Rows.Add(tRow)

Me.Controls.Add(table)

End Sub


All the events raised by the grid are captured in this control's class, but
the button click of the toolbar control is not captured in the parent
control.

I have to capture the event of the toolbar buttons and do some processing on
the grid's data.

If i add an attribute like
mHeaderToolbar.Attributes.Add("onButtonClick","MyH andler"), it does not
raises the event... i've tried overriding the OnBubbleEvent()
method of my control but it does not get events of the toolbar. some one
please help me out...

~Dejavou








 
Reply With Quote
 
 
 
 
John Saunders
Guest
Posts: n/a
 
      12-20-2004
"Faizan Ahmed" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello all,
> I've been stuck in this problem for a couple of days now and could'nt get
> any closer to the solution.. any help will be highly appreciated..
>
> I have a server control that i derived from DataGrid control. This custom
> control also has a Microsoft IE Toolbar control which contains some
> toolbar
> buttons

....
> All the events raised by the grid are captured in this control's class,
> but
> the button click of the toolbar control is not captured in the parent
> control.


Just as an experiment, if you add a normal Button control, are you able to
capture the events of the Button? If so, then perhaps the problem is the
Toolbar and not your control.

John Saunders


 
Reply With Quote
 
 
 
 
Faizan Ahmed
Guest
Posts: n/a
 
      12-20-2004
Thanks for replying,
I've tried to add the button in the same way as the toolbar and initially it
did'nt work, It raised some error with the control tree and view state. I
then turned my custom control's EnableViewState property to false and then
it worked, i.e. now a normal button is raising events in my control.
Still i think this is not the problem with the Toolbar. Any ways... can you
suggest any thing if i insist on using this toolbar?... and what other
options i have if i leave this toolbar, are there any other free source
toolbar controls you know off? and one more question .. y i had to turn the
EnableViewState property to false, to get the event of the button's click??

Thansks again for your help.

Regards
Faizan Ahmed

"John Saunders" <johnwsaundersiii at hotmail.com> wrote in message
news:#(E-Mail Removed)...
> "Faizan Ahmed" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hello all,
> > I've been stuck in this problem for a couple of days now and could'nt

get
> > any closer to the solution.. any help will be highly appreciated..
> >
> > I have a server control that i derived from DataGrid control. This

custom
> > control also has a Microsoft IE Toolbar control which contains some
> > toolbar
> > buttons

> ...
> > All the events raised by the grid are captured in this control's class,
> > but
> > the button click of the toolbar control is not captured in the parent
> > control.

>
> Just as an experiment, if you add a normal Button control, are you able to
> capture the events of the Button? If so, then perhaps the problem is the
> Toolbar and not your control.
>
> John Saunders
>
>



 
Reply With Quote
 
John Saunders
Guest
Posts: n/a
 
      12-20-2004
"Faizan Ahmed" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Thanks for replying,
> I've tried to add the button in the same way as the toolbar and initially
> it
> did'nt work, It raised some error with the control tree and view state. I
> then turned my custom control's EnableViewState property to false and then
> it worked, i.e. now a normal button is raising events in my control.
> Still i think this is not the problem with the Toolbar. Any ways... can
> you
> suggest any thing if i insist on using this toolbar?... and what other
> options i have if i leave this toolbar, are there any other free source
> toolbar controls you know off? and one more question .. y i had to turn
> the
> EnableViewState property to false, to get the event of the button's
> click??


I don't know why EnableViewState should have affected anything, unless
you're adding the Button dynamically but not adding it on the initial
request and each postback.

In the absence of the Microsoft toolbar, you could write one of your own. My
favorite controls book ("Developing Microsoft® ASP.NET Server Controls and
Components" from Microsoft Press, by Nikhil Kothari and Vandana Datye
(http://www.microsoft.com/mspress/books/5728.asp)) has an example of a
ButtonBar control. I have used this as the starting point for my own
"toolbar-style" controls.

John Saunders


 
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
Composite vs non composite Controls Mike ASP .Net Web Controls 4 03-11-2005 05:47 AM
Losing Composite Control property that another Composite Control ... Chad ASP .Net Building Controls 0 02-01-2005 09:01 PM
Possible to create a composite control that has a child control that is a validator that validates the composite control itself? Jonathan Eric Miller ASP .Net Building Controls 2 07-22-2004 10:58 PM
Composite control with dynamic composite controls sleigh ASP .Net 1 02-12-2004 06:24 PM
Using Table control in a custom composite control. Control does not render properly in design time. jb_in_marietta@yahoo.com ASP .Net 0 07-01-2003 09:26 PM



Advertisments