I attach event with radiobuttonlist
in code behind page, radiobuttonlist is inside a
listview
.When I run program it generates an error :
"object referance not set to instant of object"
.aspx code:
<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 Code
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";
}