ToBe

ToBe

  • NA
  • 164
  • 92.5k

get values for radio button and checkox

Apr 10 2013 9:39 AM
Dear All 

I have an editform in my webapplication 


and I need to retrive the value of the Radio button and the checkboxes saved in my database 

for examlpe I have one radiobutton has 4 options : good - bad - v.good - excellent 

and one checkbox has 4 items : art - account - marketing ..... and so on 

and I'm saving in my Main Table The ID's of the selected value for both radiobutton and checkbox 

so for the saving the radiobutton :int state = int.Parse(rdblstate.SelectedValue.ToString());

and for saving the checkbox i'm using a for loop  to save it in a seperate table like this 

for (i = 0; i < chkbox1.Items.Count; i++)
            {
                if (chkbox1.Items[i].Selected == true)
                {

                   
                     cmd = new SqlCommand("sp_ADD_Type", con);
                     cmd.CommandType =CommandType.StoredProcedure;
                     cmd.Parameters.AddWithValue("@ID_TYPE",yy);
                     cmd.Parameters.AddWithValue("@TYPE",chkbox1.Items[i].Text);
                   
                    cmd.Connection = con;
                    cmd.ExecuteNonQuery();
                }

I'm saving in my main table only the ID e.g good-->1 bad-->2 and so on 

I want now to show the checked value in the edit form also for the checked box checked .


please help me on doing it 

Answers (2)