elegant coding style - checkboxs

J

JJ

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
 
J

JJ

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
 
G

Guest

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 %>'/>
 

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

Members online

Forum statistics

Threads
474,085
Messages
2,570,597
Members
47,219
Latest member
Geraldine7

Latest Threads

Top