<asp:RadioButton ID="rdoSmalImage" Text="小图上传" runat="server" Checked="True" GroupName="types" AutoPostBack="True" />
<asp:RadioButton ID="rdoBigImage" runat="server" Text="原图上传" GroupName="types" AutoPostBack="True" /> asp页面中有两个单选按钮,后台if (rdoSmalImage.Checked)
type = 0;
else
type = 1;我选中哪个if里面都是true
<asp:RadioButton ID="rdoBigImage" runat="server" Text="原图上传" GroupName="types" AutoPostBack="True" /> asp页面中有两个单选按钮,后台if (rdoSmalImage.Checked)
type = 0;
else
type = 1;我选中哪个if里面都是true
解决方案 »
- 网页传参如何过滤错误的输入?
- 關於JQuery的ajax和asp.net MVC 提供的ajaxform,知道的進來講講
- .NET后台生成js字符串 !!!!!!!!高手 come in!!!
- asp.net嵌套自定义控件和嵌套aspx文件有何区别
- lucene.net.documents.field并不包含UNstored的定义
- 刚完成的.NET作品,大家评评 :)
- 在线求解,GridView控件里一行里加入按钮,点了没反映?
- 百思不得其解,超级巨难题,再发一帖?
- 请教:在ASPNET中,我用另一个类来检测SQL是否能链接成功.但是..
- 发送html格式邮件市怎么回事?
- 用二进制存图片 急……
- 请教一个问题
每次点击两个单选中的其中一个都会回传,即刷新当前页面,而rdoSmalImage默认checked=“true”,每次刷新都是为checked肯定会是true啊,不信你用
if (rdoBigImage.Checked)
type = 0;
else
type = 1;
绝对都是false。
lz可以把AutoPostBack="True”改为表单提交啊。
protected void Button1_Click(object sender, EventArgs e)
{
if (rdoSmalImage.Checked)
Label1.Text = "0";
else
Label1.Text = "1"; <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
<asp:RadioButton ID="rdoSmalImage" Text="小图上传" runat="server" Checked="True" GroupName="types" AutoPostBack="True" />
<asp:RadioButton ID="rdoBigImage" runat="server" Text="原图上传" GroupName="types" AutoPostBack="True" />这么测试没问题啊
{}
type = rdoBigImage.Checked?0:1;
{}
type = rdoBigImage.Checked?0:1;
{}
type = rdoBigImage.Checked?0:1;
单选按钮的name要一致才可以
还有就是不建议使用服务器端的控件
{}
估计能解决你的问题
{}
肯定是这个原因