Beginner Looking For Help

C

cmay

I am looking for some help with this problem I am experiencing.

What I want to do, is extend the dataset, but include a button above it that
I can click, and handle the postback of that click w/ in my custom server
control code.

So, my class inherits from the dataset, and has a button defined within it
at the class level.

I found that if wrote out the button with:
me.cmdbutton.RenderControl(output)
then the postback would not be caught.

However, if I add the button to the controls collection like:
Me.Controls.add(me.cmdbutton)

then the click event is caught.

However, I want to be able to place my button in a specific location,
basically with the following HTML:

TABLE
TR
TD
MyButtonShouldGoHere
/TD
/TR
TR
TD
DataSetShouldGoHere
/TD
/TR
/TABLE

I am able to do this easily when I render the control with the
HTMLTextWriter (which seems to turn off the ability to catch the button click
event), but I don't see a way to do it w/ the method of adding the button to
the controls collection.

So, can anyone tell me, what methodology I need to follow in order to extend
the datagrid to add a button, but also keep the ability to put the button
where I want it in the custom control heirarchy?
 
M

Matt

Are you implementing the INamingContainer interface? And have you
tried overriding CreateChildControls() instead of worrying about
rendering?
 
C

cmay

The short answer to your questions are:
1) No
2) No

I guess that establishes that I am not going about this the right way.
Do you know of any examples out there that use the
INamingContainer/CreateChildControls to achieve what I am looking for?
A quick google search turned up a lot about creating template controls,
but that doesn't seem to be what I want.

I'm guessing that if I were to override the createChildcontrols, I
wouldn't inherit from the datagrid but rather add a datagrid to my
control via the CreatechildControls?

If I were to still inherit from the datagrid, and I used the
CreateChildControls, where would those controls endup in relation to
the datagrid itself?
 

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,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top