Building controls....sorta newbie!

C

Craig G

i posted this yesterday in the building controls messageboard but got no
reply so i thought id post it on here



Hi,

i have built myself a webusercontrol that contains a single datagrid

the datagrid is based upon a couple of template columns and having add,
edit, update, cancel, delete commands all available within the grid

i have setup up all the OnEditCommand, OnItemCommand HTML etc so that it
fires the corresponding events/methods in the code behind page

at the minute i just have stubbs for each event in the code behind page.

what i was wondering. how would i go about saving this grid as it is, so
that i could then use this as like a base control that i could drop into a
new user control? would i have to create the control on its own or what??

am i making sense?

Cheers,
Craig
 
K

Kevin Spencer

Hi Craig,

If I understand you correctly, you built a UserControl, which is a templated
Control with a Template and CodeBehind. If you want to use Inheritance, your
best bet is to build a Server Control instead. A Server Control has no
template; it's all class code. WebControls and HtmlControls are Server
Controls. The Render() Mathod of a Server Control builds the HTML for it.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
 
C

Craig G

Cheers for that, ill probably be back in a bit with a few custom server
control q's!

Cheers,
Craig
 
K

Kevin Spencer

Check out the articles I've written on building Server Controls at my web
site: http://www.takempis.com.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top