I want to ask something about radio buttons in a web page. I'm using c#.net. Let's assume that I have a table with 5 rows and 3 columns. I put a radiobutton in each cell of this table. So we have 15 radio buttons. The user should select exactly one choice in each column, and at most one choice in each row. I tried radiobuttonlist in each row. But in this case the user can select more than one choice in a column. Or the user can not give up a selection in a row. I think that I need to write a client-side script. But I could not figure out this problem in a practical way. I wish I had a control that solves this problem.
The radiobutton list in each row seems like a good approach because it handles one of your constraints: at most one choice in each row.
To handle the other constraint (exactly one choice in each column) you need to make a handler that's called whenever the selection state of a radio button changes, then check this constraint in the handler. If it's violated (i.e. more than one choice in a column) you can give the user an error message or change their previous selection in that column.
When they're done (e.g. they press the OK button), then you can check to see if every column has a selection.
hey guys ! can you guide me ,how can i write code in good ways!? well lemme explain whats my problem ! i thought writing codes is most simple part of developing ,but after some project which i did ,i found that need to change my coding style ! as you know for one porpuse is many way to achieve ! but i found always choose worst way ! well is any book or reference to teach me how i choose best way? at least better way! very thanks
Bugs tend to appear in unclear code. They're harder to find there too. Maintenance of unclear code is more expensive. Unclear code is unreliable.
Try to make your methods short. As a method grows in size, its complexity increases faster than linear. If a method is becoming too large, break it up into 3-5 subroutine calls.
Start with designing the GUI. This will guide the rest of the development.
Don't feel bad if the approach you took was the worst one, because you'll learn from this experience. All programmers go through this. Try to summarize what you've learned in a simple rule you can follow to avoid this problem in the future.
Algorithm selection is a more complex topic. A course (or book) on data structures will also cover the most common algorithms used on these structures. These are also graduate courses specifically on algorithms.
(If you haven't already studied data structures, you should. It's one of the more important areas that you'll use on all but the most trivial programs.)
I always start with the data model design. I've found that starting with the GUI tends to influence bad practices in the data model or breaks even breaks it to the point where you need to toss it out and start from scratch.