0
통해있는 gridview에 RadioButtonList 선택된 값을 얻을 :이 코드가 foreach는
if (e.CommandName == "Comment")
{
SqlConnection scn = new SqlConnection(ClsPublic.GetConnectionString());
SqlCommand scm = new SqlCommand("UPDATE tblImages SET fComment = @fComment WHERE ([email protected])", scn);
string mytext = "";
foreach (GridViewRow row in GVPictures.Rows)
{
mytext = ((RadioButtonList)row.FindControl("RBComment")).SelectedItem.Text;
}
scm.Parameters.AddWithValue("@fComment", mytext);
scm.Parameters.AddWithValue("@fId", e.CommandArgument);
scn.Open();
scm.ExecuteNonQuery();
scn.Close();
}
그러나,이 코드는 마지막 행이 아닌 내 선택된 행의 값을 반환합니다. 내가 무엇을 할 수 있을지? 선택한 행 값을 얻으려면 어떻게해야합니까?
e? in rowcommand e는 다른 메소드를 반환합니다. –