在ASP.NET C#中将对象转换为单选按钮列表 [英] convert object into radiobuttonlist in asp.net C#

查看:71
本文介绍了在ASP.NET C#中将对象转换为单选按钮列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将对象转换为RadioButtonList

how to convert an object into RadioButtonList

推荐答案

如果您的对象属于RadioButtonList 类型,则只需将其转换为RadioButtonList

RadioButtonList onew = (RadioButtonList)ob;

如果它不是object类型,则不能.
If your object is of type RadioButtonList you can simply cast it into a RadioButtonList

RadioButtonList onew = (RadioButtonList)ob;

If it is not of type object, you cannot.


假定它是一个以RadioButtonList开头或从RadioButtonList派生的单选按钮列表,然后对其进行转换.如果不是,那你就不能.
Assuming it is a radio buttonlist to start with, or devived from a RadioButtonList, then cast it. If it isn''t, then you can''t.
RadioButtonList rbl = myObject as RadioButtonList;
if (rbl != null)
   {
   ...
   }





谢谢您的重放,我使用了它,但是具有空值"myobject"的"rbl"包含RadioButtonList的ID"

啊!您应该说这是网络-会有所帮助.

查看 Control.FindControl方法 [





"Thank you for your replay ,i use this but the ''rbl'' having null value ''myobject'' contain ID of RadioButtonList"

Ah! You should have said this was web - it would have helped.

Look at the Control.FindControl Method[^]


这篇关于在ASP.NET C#中将对象转换为单选按钮列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆