asp.net buttons generated programmatically
I am generating buttons programmatically. They are the answers to a question. A question can have 2..* answers. when a user clicks on an answer his action is recorded in a database. Now, In order to know on which button a user clicked, I decided to create a datagrid with only a CommandField Select column. this will allow me to determine which row was selected in the codebehind.
Problem: Can I bind the text of the CommandField Select? I want the text to be the answer not just the text "Select" on each row.
Do you suggest another solution to my problem?
I need something like how old are you?
0-18 //answer1 (Command Field)
18-21
great开发者_开发百科er than 21
I think most people would use the RadioButtonList or CheckboxList for that sort of thing. If you follow the links, you will find examples of both. I would probably go that route instead of a DataGrid. That's typically for displaying tabular data for viewing/editing purposes. That's just my 2 cents, though.
精彩评论