By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,876 Members | 1,191 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,876 IT Pros & Developers. It's quick & easy.

gridview with checkbox ?

P: n/a
Hey
I have gridView with a checkbox and I bind it to a dataset. In dataset is a
column called "Assigned" and it contains 0 or 1. When I tried to bound it I
got error and I check in details that there is no way to convert string to
boolean. So how to force him to convert it ?
Jarod

Jan 17 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Jarod,

Use ItemDataBound event to do something like (metacode):

myCheckBox.Checked = (value of column "Assigned" == 1)

Eliyahu

"Jarod" <bl*****@NOSPAM.gazeta.pl> wrote in message
news:eF**************@TK2MSFTNGP09.phx.gbl...
Hey
I have gridView with a checkbox and I bind it to a dataset. In dataset is
a column called "Assigned" and it contains 0 or 1. When I tried to bound
it I got error and I check in details that there is no way to convert
string to boolean. So how to force him to convert it ?
Jarod

Jan 17 '06 #2

P: n/a
> Use ItemDataBound event to do something like (metacode):

The problem is there is nothing like ItemDataBound event :(
I mean GridView not a dataGrid.
Jarod
Jan 17 '06 #3

P: n/a
RowDataBound

Eliyahu

"Jarod" <bl*****@NOSPAM.gazeta.pl> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
Use ItemDataBound event to do something like (metacode):

The problem is there is nothing like ItemDataBound event :( I mean
GridView not a dataGrid. Jarod

Jan 17 '06 #4

P: n/a
> RowDataBound


RowDataBound is fired after binding. So if there is a wrong data to bound
you will get error before event.
Jarod

Jan 17 '06 #5

P: n/a
Jarod,

You don't have to bind to wrong data. Leave the checkbox unbound and just
set it's Checked property in the event.

Eliyahu

"Jarod" <bl*****@NOSPAM.gazeta.pl> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
RowDataBound


RowDataBound is fired after binding. So if there is a wrong data to bound
you will get error before event.
Jarod

Jan 17 '06 #6

P: n/a
> You don't have to bind to wrong data. Leave the checkbox unbound and just
set it's Checked property in the event.


If you don't bind you won't have data. In the RowDataBound event you can
take data from the bounded control if you didn't bind you won't have any
data. Maybe you can share some code to show what you mean ?
Jarod

Jan 17 '06 #7

P: n/a
I mean you do bind the GridView, i.e. do set the DataSource and DataMember
property and call the DataBind method. But don't bind the checkbox control,
i.e. don't set the Checked property with a databind expression.

Eliyahu

"Jarod" <bl*****@NOSPAM.gazeta.pl> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
You don't have to bind to wrong data. Leave the checkbox unbound and just
set it's Checked property in the event.


If you don't bind you won't have data. In the RowDataBound event you can
take data from the bounded control if you didn't bind you won't have any
data. Maybe you can share some code to show what you mean ?
Jarod

Jan 18 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.