Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
protected void Button1_Click(object sender, EventArgs e)
   {
       foreach (GridViewRow gvrow in GridView1.Rows)
       {
            string sid = gvrow.Cells[0].Text;
           RadioButtonList rbAtt = (RadioButtonList)GridView1.Rows[selectedIndex].FindControl("rbAtt");
           con.Open();
           SqlCommand cmd = new SqlCommand("InsertAttendence", con);
           cmd.CommandType = CommandType.StoredProcedure;
           cmd.Parameters.AddWithValue("@StudentId", sid);
           if (dlAtt.SelectedItem.Text=="Morning")
           {
               cmd.Parameters.AddWithValue("@Morning", rbAtt.SelectedValue);
           }
           else
           {
               cmd.Parameters.AddWithValue("@Morning", DBNull.Value);
           }
           if (dlAtt.SelectedItem.Text=="Evening")
           {
               cmd.Parameters.AddWithValue("@Evening", rbAtt.SelectedValue);
           }
           else
           {
               cmd.Parameters.AddWithValue("@Evening", DBNull.Value);
           }

           cmd.ExecuteNonQuery();
           con.Close();
       }

   }

I got the error at radio button insertion any one Could you pls help me...
Posted
Updated 26-Apr-12 22:46pm
v2
Comments
Sandeep Mewara 27-Apr-12 5:03am    
What error?

1 solution

try to use rbAtt.Text hope this helps

Best of luck...........
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900