How to: add column to datagrid (not bound to dataset)

U

uknees

Hi there,

I have a dataset which i want to have some of the columns bound to the
datagrid. I have all that columnstyle thingy going... except that I
want to have a column that displays a checkbox (DatagridBoolColumn)
of which the data is not taken from the dataset.

so... how can i have a datagrid that contains some columns that are
bound to a dataset and a column not bound?

Please help. Thanks
 
M

Miha Markic

Hi unkness,

You'll have to create your datasource.
As a simplier solution, why don't you add a column to DataTable?

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

uknees said:
Hi there,

I have a dataset which i want to have some of the columns bound to the
datagrid. I have all that columnstyle thingy going... except that I
want to have a column that displays a checkbox (DatagridBoolColumn)
of which the data is not taken from the dataset.

so... how can i have a datagrid that contains some columns that are
bound to a dataset and a column not bound?

Please help. Thanks



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
U

uknees

I tried adding this to my datatable.

ds.Tables("Bom").Columns.Add("Select", GetType(Boolean), False)

and now, the problem i am having is that when i click on the checkbox
:
-on the 1st row, it works fine
-2nd row will return an error saying that the 'Select' column is
readonly.

so, I added the code to allow this boolean Column.readonly = false

and it still returns the same error

any idea why?
 
R

Ron Allen

uknees,
Don't add the expression parameter (False) to your column. All you want
is the name and type. If you want to add a default value you can then do
ds.Tables("Bom").Columns("Select").DefaultValue = False
after creating the column. Adding False for the expression value makes the
column value always False and will not allow it to be changed.

Ron Allen
uknees said:
I tried adding this to my datatable.

ds.Tables("Bom").Columns.Add("Select", GetType(Boolean), False)

and now, the problem i am having is that when i click on the checkbox
:
-on the 1st row, it works fine
-2nd row will return an error saying that the 'Select' column is
readonly.

so, I added the code to allow this boolean Column.readonly = false

and it still returns the same error

any idea why?



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---
 
U

uknees

Hi Ron,

I have done what you have suggested.
ds.Tables("Bom").Columns("Select").DefaultValue = False

but, 2 questions though
- why is the checkbox greyed?
I have already set the columnstyle's AllowNull property to false.
-All the checkboxes have been checked. why?
 

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

Top