473,395 Members | 1,495 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,395 software developers and data experts.

elegant coding style - checkboxs

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

Jul 30 '06 #1
2 1054
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

JJ wrote:
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
Jul 30 '06 #2
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 %>'/>

"JJ" wrote:
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

Jul 31 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John | last post by:
Where I can find sample code for adding checkboxs in a DataGrid? Thanks
7
by: Oli | last post by:
Hi, I have a form with a textbox... <input type="text" name="textbox1" value="value1" disabled> Obviously that produces a textbox that the user cannot edit. What I want is when the user...
18
by: craig | last post by:
I am curious about how many of you prefer style 1 vs. style 2, and why. Are there names for these style? style 1: method { }
144
by: Natt Serrasalmus | last post by:
After years of operating without any coding standards whatsoever, the company that I recently started working for has decided that it might be a good idea to have some. I'm involved in this...
4
by: Mike Labosh | last post by:
I realize that you people have not seen much of me other than some framework responses I have posted. I am primarily a VB guy (yes, you can laugh) But I have lurked here for several years,...
13
by: benben | last post by:
Is there an effort to unify the c++ coding standard? Especially identifier naming. Not a big issue but it would be annoying to have to incorporate different coding styles simultaneously when...
5
by: Licheng Fang | last post by:
I want to store Chinese in Unicode internally in my program, and give output in UTF-8 or GBK format. After two days of searching and reading, I still cannot find a simple and straightforward way to...
4
by: alf | last post by:
Hi, is there a more elegant way to get o.__class__.__name__. For instance I would imagine name(o). -- alf
17
by: shivasusan | last post by:
Hi! In my program, I have multiple check boxs.(more the 10) But i give rights to select 2 check boxs, If i select more then 2 check boxs, I want to display alert message. Please any one post...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...

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.