zoukankan
html css js c++ java
asp.net 使用radiobuttonlist的困惑 使用关键词New创建实例
折腾了一天了,精疲力尽了已经。贴到这里求救,救命啊!
页面部分:
<
body
>
<
form id
=
"
form1
"
runat
=
"
server
"
>
<
div
>
<
asp:RadioButtonList ID
=
"
RadioButtonList1
"
runat
=
"
server
"
>
</
asp:RadioButtonList
></
div
>
<
asp:Button ID
=
"
Button1
"
runat
=
"
server
"
OnClick
=
"
Button1_Click
"
Text
=
"
Button
"
/>
</
form
>
</
body
>
</
html
>
cs部分方案一:
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(
!
IsPostBack)
{
this
.RadioButtonList1.Items.Add(
new
ListItem(
"
test1
"
,
"
test1
"
));
this
.RadioButtonList1.Items.Add(
new
ListItem(
"
test2
"
,
"
test2
"
));
}
}
protected
void
Button1_Click(
object
sender, EventArgs e)
{
Response.Write(
this
.RadioButtonList1.SelectedItem.Value);
}
cs部分方案二:
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(
!
IsPostBack)
{
this
.RadioButtonList1.Items.Add(
new
ListItem(
"
test1
"
,
"
test1
"
));
this
.RadioButtonList1.Items.Add(
new
ListItem(
"
test2
"
,
"
test2
"
));
}
}
protected
void
Button1_Click(
object
sender, EventArgs e)
{
RadioButtonList rbl
=
new
RadioButtonList();
rbl
=
(RadioButtonList)Page.FindControl(
"
RadioButtonList1
"
);
Response.Write(rbl.SelectedItem.Value);
}
尝试阿尝试 ,无尽的尝试,最终还是一个“请使用关键词New创建实例”,已经无语了,高手路过,请抽时间帮帮小弟,现在都共产主义社会了,总该有点共产主义精神吧?
查看全文
相关阅读:
函数——返回值不止一个的情况(解一元二次方程)
排序方法:去掉最高最低分求平均分 函数
丢羊 递归
网吧充值 函数+Swich+ArrayList版
对战游戏自己简单版+大神版
简单Struct+ArrayList选择买东西:购物车思路
推箱子 复杂版(多个箱子)
stuct+ArrayList的for用法
Struct+ArrayList冒泡排序。例
c# 穷举
原文地址:https://www.cnblogs.com/bk/p/771049.html
最新文章
接口、委托、事件
WPF中的X命名空间
WPF样式
WPF布局
国内外DNS服务器地址
AspCms标签
图表
报表
实现百度搜索页面网页遍历
数据库 约束 分离 备份 还原 附加
热门文章
4.27 数据库 水果进存消 函数
4.26 数据库 函数
4.25 数据库 仓库例题
4.24 数据库 日期函数 表连接 处理字符串
4.22 数据库 课堂作业 老师,学生,成绩,课程
4.21 数据库 聚合函数
数据库 关键 排序,去重,分组,外键
c# 类 时间
c# 穷举法 百鸡
函数快速排序
Copyright © 2011-2022 走看看