I'm trying to use a asp repeater for the first time. I used the following tutorial as a guide: http://www.sitepoint.com/asp-net-repeater-con
My problem is that the asp repeater is not showing on the page. not even the header or footer.
As seen below I have a data table that is populated with a SqlDataReader. I bound the table to the asp repeater.
Function called after a button click event that does an ajax call to my code behind:
function getRangeList() {
var vardateRange = { dateStart: $("#dateStart").val(), dateEnd: $("#dateEnd").val(), MethodName: 'getRangeList' }
var options =
{
url: '<%=ResolveUrl("~/Default.aspx") %>',
async: true,
data: vardateRange,
dataType: 'text',
type: 'POST',
success: function() {
alert("test");
}
}
$.ajax(options);
}
C# code:
protected void getRangeList()
{
using (SqlConnection connRangeList = new SqlConnection(this.strOwanConnString))
{
SqlCommand cmdRangeList = new SqlCommand("[some_sp]", conn1);
cmd1.CommandType = CommandType.StoredProcedure;
cmd1.Parameters.Add("@somevalue", SqlDbType.VarChar).Value = x;
conn1.Open();
SqlDataReader dt1 = cmd1.ExecuteReader();
repeater1.DataSource = dt1;
repeater1.DataBind();
}
}
aspx page:
<asp:Repeater ID="repeater1" runat="server">
<HeaderTemplate>
Test<table border="1">
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%#DataBinder.Eval(Container.DataItem, "patientID")%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
I'm assuming I have a very basic misconception of the functions and call I'm making. Please help me clear this up. Thanks.