我在代码隐藏页附上事件与radiobuttonlist
访问控制,RadioButtonList的是
listview
。当我里面运行程序会生成一个错误: “对象全球化志愿服务青年未设置为即时物体”的如何在.aspx页面
的.aspx代码:
<asp:ListView ID="ListView1" runat="server" >
<ItemTemplate>
<tr><td>
<asp:RadioButtonList ID="radiobuttonlist4" runat="server" AutoPostBack="true"
RepeatDirection="Horizontal"
OnSelectedIndexChanged="selected" Width="240px">
<asp:ListItem Value="agree"></asp:ListItem>
<asp:ListItem Value="disagree"></asp:ListItem>
<asp:ListItem Value="strongagree"></asp:ListItem>
<asp:ListItem Value="strongdisagree"></asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
</ItemTemplate>
</asp:ListView>
.aspx.cs代码
assessdal s = new assessdal();
ListView1.DataSource = s.showop1();
ListView1.DataBind();
RadioButtonList list= ListView1.FindControl("radiobuttonlist4") as RadioButtonList;
list.SelectedIndexChanged += new EventHandler(handle);
public void handle(object sender, EventArgs e)
{
Label2.Text = "y";
}
请格式化您的代码,哪个listview的模板是RadioButtonList? –
soory,在.aspx代码中有radiobuttonlist控件,在复制代码时,它被错过了。 – user1405508
@ user1405508:为什么不正确地编辑你的问题?所以其他人可以帮助! –