1

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

greater than 21

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Ok, radioButtonList with autopostback is what I need. Though, I would like to change the item teamplate, to make the radio button look like a button. Can I do this?
You know, I'm not sure. I've never tried. I would think you would be able to, but that kind of defeats the purpose of them being radio buttons.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.