Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

elegant coding style - checkboxs

1 view
Skip to first unread message

JJ

unread,
Jul 30, 2006, 9:34:19 AM7/30/06
to
Hi,

I have a group of checkboxs in the beginning of each row of a table.
Each row has other controls in it. When I get a set of values back from
the database and one of the values is of course what checkbox sould be
checked. I am wondering how u guys would code the rest of the fields in
the row to be databound. Now i'm not asking how u databind to a
control, I know how to do this. I'm asking would u put your code in a
select statement on checkbox value and then put each row of controls
names in between a case? or maybe a set of ifs ... I don't want to do
that personnally. So i'm asking if anybody has come up with a better
solution since i'm sure this is common situation in programming.

Thanks,
JammingJ

JJ

unread,
Jul 30, 2006, 1:28:27 PM7/30/06
to
Sometimes u just have to realize that the original design of webpage if
coming up with ugly code for it, should alert the designer to redesign
the page in a more elegant manner. For instance instead of what I
described in earlier post I should use only a dropdownlist control with
a collection of different types of Credit Cards. Then include only one
textbox control for Number, Expiration and Authorization code. For past
CC transactions drop a gridview on page to list the above controls.
What do u guys think?

JammingJ

David Jessee

unread,
Jul 31, 2006, 10:36:02 AM7/31/06
to
if you're binding to a Datatable...and the value you're checkin is an int:

<asp:Checkbox checked='<%# (
(int)((DataRowView)Container.DataItem)["MyField"])==12?true:false %>'/>

0 new messages