Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Composite control problem !!!

Reply
Thread Tools

Composite control problem !!!

 
 
Mircea Pleteriu
Guest
Posts: n/a
 
      06-25-2004
Hi all,

I have a composite control which only consists in a datagrid control for
beginning.

I create the datagrid control within the EnsureChildControls method and set
the AutoGeneratedColumns to false

My control exposes a method AddColumn(DataColumn column) which adds the
specified column to the
datagrid's columns collection.

My control also exposes a property named DataSource which exposes the
datagrid's DataSource property.

So, the user is able to add columns and set the datasource.

I override the DataBind method of the control
Inside the method I create a new template column consisting in a CheckBox
control and add it as the first column of the datagrid.
After that I call the DataBind on the daragrid control.

That's all about the custom control.

Now about the page that hosts the control.

The page only consits in my custom control and a button which when it is
pressed it should write to the output stream the indexes of the checked
items (the fist column being a checkbox).

In the Page_Load method I create more columns of type BoundColumn and add
them to the custom control. Also, I set the DataSource to point to a filled
in DataSet object after which I invoke the DataBind on my custom control.

Everything is fine.. the grid is displayed and the user can check items in
the grid.

When the button on the page is pressed I invoke a method of my control which
ensures that the controls exists calling EnsureChildControls and then
iterates through
the items of the grid and make a list of the checked items.

The BIG PROBLEM is that the collection of items is always EMPTY !!!!!

Do you have any idea why? Do you know any other solution to get the checked
items?

Thanks for help,
Mircea









 
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