易截截图软件、单文件、免安装、纯绿色、仅160KB

ASP.NET关于强制转换问题 - .NET技术 / ASP.NET

3个radioButton
 一个Button
一个label
C# code:

protected void Button1_Click(object sender, EventArgs e)
{
string str = null;
RadioButton rdo=(RadioButton)sender;

if (rdo.Checked == true)
{
str = rdo.Text;

}
Label1.Text = str;

}


报错:无法将类型为“System.Web.UI.WebControls.Button”的对象强制转换为类型“System.Web.UI.WebControls.RadioButton”。 

ASP.NET不能像我用C#做form那样强制转换的么?
两种不同的类型哦!!
不能转换!!

if (this.radiobuttonid.Checked == true)


不能转换

这个真不行,就好像你把字符串“哈哈”转换成数字一样,没法转

buxing........



引用
if (this.radiobuttonid.Checked == true)


同意..为什么要转呢........

引用
if (this.radiobuttonid.Checked == true)

UP

不明白你想做啥 你不是可以直接获取到 radiobuttonid吗?

晕,没见过这么转换的。。。

想实现什么逻辑?

不能 你先用一个字符串接收radiobuttonid的值,然后再将这个字符串转换成object类型的

不能

好像以前写过,Asp.Net中单选按钮组可以实现吧
{{


相关问答:

关于ASP批量打印 - Web 开发 / ASP

我想打印数据库里面读取出来的多条数据内容,实现批量打印
先导入excel或者word,然后在打印
或者购买web打印控件

使用acitvex打印。如果不需要选择属性,设置属性,就不需要商业的了。

<style media= ......

在asp.net里面脚本出错 - .NET技术 / ASP.NET

function CheckOpwd(){//验证用户名
var pwd=document.all.txtOpwd;

var div1=document.getElementById("divPwd");

if (pwd.value=="")
{
......

ASP.NET表格弄得痛苦死了 - .NET技术 / ASP.NET

调整了这里,那里出问题。
有没有什么好的方法,像调整对话框一样????
找个专门做页面的

在dreamweaver里调。。。也可以直接控制HTML代码

确实痛苦 感同身受呀

哈哈 坚决路过。

用DW吧,VS搞设计 ......

如何用ASP读取 XML - Web 开发 / ASP

<?xml version="1.0"?>
<root>
<status>433</status>
<msg>这个是汉字</msg>
<serialno>123</serialno>
</root>
如何用ASP读取 status值 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号