我是初学者。单选按钮无法正常工作。我不知道有什么问题
protected void RadioButton1_CheckedChanged1(object sender, EventArgs e)
{
if (RadioButton1.Checked == true)
{
Label1.Text = "Upload our video file";
RadioButton2.Checked = false;
}
else
{
Label1.Text = "Upload our image file";
RadioButton1.Checked = false;
}
}
public void upload()
{
SqlCommand cmd = new SqlCommand("insert into video_info(Name,path,user_name,email,comment)values(@Name,@path,@user_name,@email,@comment)", con);
cmd.Parameters.AddWithValue("@Name", txt_file.Text);
cmd.Parameters.AddWithValue("@path", "video/" + fileuplod.FileName);
cmd.Parameters.AddWithValue("@user_name", use_name.Text);
cmd.Parameters.AddWithValue("@email", email.Text);
cmd.Parameters.AddWithValue("@comment", comment.Text);
fileuplod.SaveAs(Server.MapPath("~/video/" + fileuplod.FileName));
cmd.ExecuteNonQuery();
}
protected void submit_Click(object sender, EventArgs e)
{
upload();
}
}
我想要做什么。我有两个单选按钮。图像和视频。假设用户选择图像。然后所有细节都将保存在图像表上,或者如果用户单击视频。所有细节都转到 image_database。
可能是我的逻辑错了。