Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > gridview with checkbox ?

Reply
Thread Tools

gridview with checkbox ?

 
 
Jarod
Guest
Posts: n/a
 
      01-17-2006
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

 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      01-17-2006
Jarod,

Use ItemDataBound event to do something like (metacode):

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

Eliyahu

"Jarod" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
 
Jarod
Guest
Posts: n/a
 
      01-17-2006
> Use ItemDataBound event to do something like (metacode):
>

The problem is there is nothing like ItemDataBound event
I mean GridView not a dataGrid.
Jarod
 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      01-17-2006
RowDataBound

Eliyahu

"Jarod" <(E-Mail Removed)> wrote in message
news:%23%(E-Mail Removed)...
>> Use ItemDataBound event to do something like (metacode):
>>

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



 
Reply With Quote
 
Jarod
Guest
Posts: n/a
 
      01-17-2006
> RowDataBound
>


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

 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      01-17-2006
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>> RowDataBound
>>

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



 
Reply With Quote
 
Jarod
Guest
Posts: n/a
 
      01-17-2006
> 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

 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      01-18-2006
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>> 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



 
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
ASPNET CheckBox and a CheckBox in a TemplateField Jason Huang ASP .Net 0 06-29-2007 12:35 AM
DataGrid and embeded Checkbox..How to find if checkbox clicked =?Utf-8?B?RG90TmV0RGV2?= ASP .Net 1 10-06-2006 04:11 PM
disable checkbox list checkbox Vikram ASP .Net 1 01-25-2006 02:59 PM
Howto bind CheckBox to the datagrid/ Then update the database field when the checkbox is clicked. Joey Pang ASP .Net Datagrid Control 4 06-13-2005 02:29 AM
Text on Checkbox below the checkbox tshad ASP .Net 0 04-14-2005 11:26 PM



Advertisments