R
robk
Hi,
I'm working on app - doing some surveys.
From db I created dataset with two tables ("Questions"). From fisrt table
I'm binding
questions to datagrid (with their IDs in hidden column).
OnItemDataBound I'm creating DataView (from second table...):
....
DataView _ans = dsQuestionaire1.Tables["Answers"].DefaultView;
_ans.RowFilter = "ID_Ans='" + e.Item.Cells[0].Text + "'";
....
From this point I'm creating new RadioButtonlist rbl:
....
rbl.DataTextField = "Answer";
rbl.DataValueField = "ID_Ans";
rbl.ID = "rbl" + rbl_num.ToString(); //unique ID
rbl_num++;
rbl.DataSource = _odgovori;
rbl.DataBind();
e.Item.Cells[1].Controls.Add(rbl);
....
With my Button1_Click I'm trying to (access those) get selected values from
radiobuttons
....
DataGridItem dgi;
for(int i = 0; i <= DataGrid1.Items.Count -1 ; i++)
{
dgi = DataGrid1.Items;
RadioButtonList rbl = (RadioButtonList) dgi.Cells[1].Controls[1]; //*comment
string selOdg = rbl.SelectedValue;
....
*I figoured that there is no control in that cell. This also brings out an
error.
Could you please point me to some solutions.
Thanks a lot.
I'm working on app - doing some surveys.
From db I created dataset with two tables ("Questions"). From fisrt table
I'm binding
questions to datagrid (with their IDs in hidden column).
OnItemDataBound I'm creating DataView (from second table...):
....
DataView _ans = dsQuestionaire1.Tables["Answers"].DefaultView;
_ans.RowFilter = "ID_Ans='" + e.Item.Cells[0].Text + "'";
....
From this point I'm creating new RadioButtonlist rbl:
....
rbl.DataTextField = "Answer";
rbl.DataValueField = "ID_Ans";
rbl.ID = "rbl" + rbl_num.ToString(); //unique ID
rbl_num++;
rbl.DataSource = _odgovori;
rbl.DataBind();
e.Item.Cells[1].Controls.Add(rbl);
....
With my Button1_Click I'm trying to (access those) get selected values from
radiobuttons
....
DataGridItem dgi;
for(int i = 0; i <= DataGrid1.Items.Count -1 ; i++)
{
dgi = DataGrid1.Items;
RadioButtonList rbl = (RadioButtonList) dgi.Cells[1].Controls[1]; //*comment
string selOdg = rbl.SelectedValue;
....
*I figoured that there is no control in that cell. This also brings out an
error.
Could you please point me to some solutions.
Thanks a lot.