473,410 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

gridview with checkbox ?

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
7 5868
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
> 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
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
> 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
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
> 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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: MasterChief | last post by:
I have a customer that likes the gridview but instead of using the standard Delete command for each row he wants to be able to put a checkbox next to the row so he can chose multiple records and...
1
by: postings | last post by:
Hi I have problems with autopostback and the gridview control. Please continue reading. The code below turns a row red when a tickbox is ticked in edititemtemplate. Note autopostback on the...
1
by: Bill44077 | last post by:
I am dynamically adding a checkbox in a gridview and I find there are several things that I cannot figure out how to address. 1. The width of the checkbox column is very wide. I've tried adding...
0
by: Mike P | last post by:
I am trying to edit a gridview while using paging, but whenever I try to edit a row on a page other than page 1, I get an error. Here is my gridview and my code : <asp:GridView ID="GridView1"...
1
by: mercercreek | last post by:
This one should be easy. Hope someone has a clue. Simple Scenario: Gridview with mulitple rows, each row with a checkbox. The user checks boxes of her choice. Clicks a button on the form (not in...
1
by: Neven Klofutar | last post by:
Hi, I have a questin regarding GridView, Template column and Checkbox in it. I'm working on a project that has several "client" applications entering data into DB, and one "admin" application...
12
by: dixonjm | last post by:
Hi, I am new to gridviews, so any help would be most appreciated. Here is my problem:- I have a form with a GridView and a button. My gridview is bound to a collection (12000 items) (PageSize...
0
by: sharonrao123 | last post by:
hello all, I have a parent gridview company and in this one a nested gridview people, Is it possible to allow the user to select one row or multiple rows from the people gridview using a check box...
1
Frinavale
by: Frinavale | last post by:
I'm working on an ASP.NET application using VB.NET for server side code. I have a GridView listing a bunch of stuff. Above the GridView I have a checkbox named "ChkBx_SelectAll". If this...
0
by: dotnetrookie | last post by:
Hi This is my 1st post.I have two checkbox columns in gridview binded through item template. The checkboxes are Category and Subcategory. I have actually removed the duplicate values in the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.