Hi,
I have a page with a repeater inside a Panel. Inside the repeater, there's a radiobuttonlist and depends on what the user clicks, I have to add new rows to the repeater. The problem is I'm getting this error:
Value cannot be null.
My aspx page is like this:
<asp:Panel runat="server" ID="updPnlQuestionnaire">
<%--<ContentTemplate>--%>
<asp:Repeater ID="rptrQuestion" runat="server" OnItemDataBound="rptrQuestion_OnItemDataBound" OnItemCreated="rptrQuestion_OnItemCreated" ClientIDMode="AutoID">
<ItemTemplate>
<table class='questions-table'>
<tr class='datarow'>
<td><asp:Label ID="lblQuestion" Text='<%# Eval("Question") %>' runat="server"></asp:Label>
<asp:HiddenField ID="hdnQuestionType" runat="server" Value='<%# Eval("QuestionType") %>'/>
<asp:HiddenField ID="hdnQuestionID" runat="server" Value='<%# Eval("QuestionID") %>'/>
</td>
</tr>
</table>
<table class="questions-table">
<tr class="datarow">
<td>
<asp:RadioButtonList ID="rblListAnswers" runat="server" OnSelectedIndexChanged="rblListAnswers_OnSelectedIndexChanged" AutoPostBack="true"></asp:RadioButtonList>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
</asp:Panel>
While in my Item_Created, I'm adding the ajaxsettings:
protected void rptrQuestion_OnItemCreated(object sender, RepeaterItemEventArgs e)
{
RadioButtonList rblListAnswers = (RadioButtonList)e.Item.FindControl("rblListAnswers");
var ajaxManager = RadAjaxManager.GetCurrent(this.Page);
ajaxManager.AjaxSettings.AddAjaxSetting(rblListAnswers, updPnlQuestionnaire);
}
I've read somewhere that adding ClientIDMode="AutoID" solves this problem, but I'm still having this issue. Even adding the ajaxsettings in OnItemDataBound still gives this error.
Any help would be greatly appreciated. Thanks!
I have a page with a repeater inside a Panel. Inside the repeater, there's a radiobuttonlist and depends on what the user clicks, I have to add new rows to the repeater. The problem is I'm getting this error:
Value cannot be null.
Parameter name: page
My aspx page is like this:
<asp:Panel runat="server" ID="updPnlQuestionnaire">
<%--<ContentTemplate>--%>
<asp:Repeater ID="rptrQuestion" runat="server" OnItemDataBound="rptrQuestion_OnItemDataBound" OnItemCreated="rptrQuestion_OnItemCreated" ClientIDMode="AutoID">
<ItemTemplate>
<table class='questions-table'>
<tr class='datarow'>
<td><asp:Label ID="lblQuestion" Text='<%# Eval("Question") %>' runat="server"></asp:Label>
<asp:HiddenField ID="hdnQuestionType" runat="server" Value='<%# Eval("QuestionType") %>'/>
<asp:HiddenField ID="hdnQuestionID" runat="server" Value='<%# Eval("QuestionID") %>'/>
</td>
</tr>
</table>
<table class="questions-table">
<tr class="datarow">
<td>
<asp:RadioButtonList ID="rblListAnswers" runat="server" OnSelectedIndexChanged="rblListAnswers_OnSelectedIndexChanged" AutoPostBack="true"></asp:RadioButtonList>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
</asp:Panel>
While in my Item_Created, I'm adding the ajaxsettings:
protected void rptrQuestion_OnItemCreated(object sender, RepeaterItemEventArgs e)
{
RadioButtonList rblListAnswers = (RadioButtonList)e.Item.FindControl("rblListAnswers");
var ajaxManager = RadAjaxManager.GetCurrent(this.Page);
ajaxManager.AjaxSettings.AddAjaxSetting(rblListAnswers, updPnlQuestionnaire);
}
I've read somewhere that adding ClientIDMode="AutoID" solves this problem, but I'm still having this issue. Even adding the ajaxsettings in OnItemDataBound still gives this error.
Any help would be greatly appreciated. Thanks!