473,767 Members | 1,587 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1065
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)((DataRowV iew)Container.D ataItem)["MyField"])==12?true:fals e %>'/>

"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
2792
by: John | last post by:
Where I can find sample code for adding checkboxs in a DataGrid? Thanks
7
1285
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 puts a tick in a checkbox next to the textbox for the textbox to become active.
18
2549
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
6938
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 initiative. Typically I find that coding standards are written by some guy in the company who has a way of coding that he likes and then tries to force everybody else to write code the way he likes it, not for any rational reason, but simply for the...
4
1512
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, picking up little crumbs of C# wisdom. Perhaps it's just my style, but what's this annoying behavior of the IDE and how do I stop it: C# seems to want me to write all my code like this:
13
2061
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 using more than one library. The standard library seems to have everything lower-cased while a lot of other libraries do their own way. Ben
5
6496
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 do the code conversions. In particular, I want portability of the code across platfroms (Windows and Linux), and I don't like having to refer the user of my code to some third party libraries for compiling. Some STL references point to the...
4
3178
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
2714
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 me modle program. Please very very urgent.... any only help me... By Susan.
0
9575
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9407
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10014
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9960
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6656
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5280
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5425
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3534
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2808
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.