Not Able to trigger event in Composite Control

K

King Kong

i have a datagrid and toolbar and have integrated them in my composite
control(inherited datagrid)
toolbar items are shown as for e.g
<HeaderToolBarItems>
<iewc:ToolbarButton Text="werwer"></iewc:ToolbarButton>
<iewc:ToolbarButton Text="werwer"></iewc:ToolbarButton>
<iewc:ToolbarButton Text="werwer"></iewc:ToolbarButton>
<iewc:ToolbarButton Text="werwer"></iewc:ToolbarButton>
<iewc:ToolbarButton Text="werwer"></iewc:ToolbarButton>
<iewc:ToolbarButton Text="werwer"></iewc:ToolbarButton>
</HeaderToolBarItems>

Now i want to get the toolbar click event that i m not able to trigger from
the code i want to give developers facility to trigger event in aspx file if
they click this toolbar
all controls are been rendered here toolbar and datagrid both
Any Ideas how to have event from this kinda composite control. i can overide
all type of datagrid events but not my IE toolbar

Regards
Moid Iqbal
 
J

John Saunders

King Kong said:
i have a datagrid and toolbar and have integrated them in my composite
control(inherited datagrid)
toolbar items are shown as for e.g
<HeaderToolBarItems>
<iewc:ToolbarButton Text="werwer"></iewc:ToolbarButton>
<iewc:ToolbarButton Text="werwer"></iewc:ToolbarButton>
<iewc:ToolbarButton Text="werwer"></iewc:ToolbarButton>
<iewc:ToolbarButton Text="werwer"></iewc:ToolbarButton>
<iewc:ToolbarButton Text="werwer"></iewc:ToolbarButton>
<iewc:ToolbarButton Text="werwer"></iewc:ToolbarButton>
</HeaderToolBarItems>

Now i want to get the toolbar click event that i m not able to trigger
from
the code i want to give developers facility to trigger event in aspx file
if
they click this toolbar
all controls are been rendered here toolbar and datagrid both
Any Ideas how to have event from this kinda composite control. i can
overide
all type of datagrid events but not my IE toolbar

Surely your composite control can receive events raised by its child
controls. So your composite should be able to receive events from each of
the ToolbarButton controls. In the event handlers for those events, our
control can raise an event of its own. The users of your composite control
will be able to receive such an event:

public event EventHandler ToolbarButtonClicked;

protected virtual void OnToolbarButtonClicked(EventArgs e)
{
if (ToolbarButtonClicked != null)
{
ToolbarButtonClicked(this, e);
}
}

private void ChildToolbarButtonClicked(object sender, EventArgs e)
{
OnToolbarButtonClicked(e);
}


Of course, you'll want to provide the users of your control with information
on which button was clicked, so you'll want to extend the EventArgs class to
pass that information to them.

I hope that helps,
John Saunders
 
F

Faizan Ahmed

Hello all,

That is the problem, we expect to get the button's click event, in the
parent control but we cant. Infact if the toolbar is used as a seperate
control the buttons do post back on the page and raises the event but when
the same toolbar is used in a Control which derives from datagrid, the click
of the buttons do nothing. Even the page is not posted back. We've tried
Autopostback=true, it did'nt help. We tried
ToolBarButton.Attributes.Add(''onButtonClick','myHandler') on each button
when rendering the toolbar but then it tries to look for the implementation
of the function myHandler on the client side.

Please people any and all the help will be highly appreciated.

Regards
 

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,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top