How to store selected radio button in datagrid of wpf

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • weizz
    New Member
    • Jul 2011
    • 6

    How to store selected radio button in datagrid of wpf

    Hi All,

    I have a datagrid which display all the questions for the users to answer.Each question is accompany by 4 radio buttons with the options agree, strongly agree, disagree, strongly disagree.The design of the datagrid is as below:


    Questions Agree StronglyAgree Disagree StronglyDisagre e

    Ques1 o o o o
    Ques2 o o o o
    Ques3 o o o o
    :
    :
    :

    o represent Radio button


    All the radio buttons under the column of agree is define under one data template,this apply to the column of strongly agree, disagree, strongly disagree as well.

    How do I read through datagrid so that I could know whether which radio button is being selected?

    How do I store the selected radio button back to remote database?

    Please guide me. Thanks in advance.
  • GaryTexmo
    Recognized Expert Top Contributor
    • Jul 2009
    • 1501

    #2
    There should be a Rows property. This is a collection of all the rows in your data grid. Each of these rows should have an index for the column, which will contain the data in that row/column index.

    Have a look and see what's contained within a cell. I don't know what will be the case when you have radio buttons... if it's just a radio button inside the cell (ie, Cell[col].Value is a RadioButton object) or if it's something else. Inspect it with breakpoints in the debugger and/or do a GetType() call on it to see what it is. That will give you some idea of what you can do.

    Once you have this, you can write the values to wherever you like.

    Comment

    Working...