Im using the jquery datatables plugin, and its great, until I make a change using a repeater ItemCommand. It seems to only hold the data for the first page of the plugin.. ie. page 1 and not the 2, 3, 4.... * pages.. The wierd thing is the drop down values remain in the drop down, but the selected value of the drop down defaults to position 0 (both are generated and assigned via sql dataset)..
Here is my code..
<pre> protected void testRepeater_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "category")
{
var arguments = (string)e.CommandArgument;
var arg = arguments.Split(new[] { ';' });
Session["PersonId"] = arg[0];
Session["CategoryId"] = arg[1];
int personID = Converter.ToInteger(arg[0]);
int categoryId = Converter.ToInteger(arg[1]);
using (TrialProvider tp = new TrialProvider())
{
tp.UpdateCategory(CategoryId, PersonID);
}
}
}
protected void categoryList_DataBinding(object sender, System.EventArgs e)
{
DropDownList categoryList = (DropDownList)(sender);
using (TrialProvider tp = new TrialProvider())
{
DataSet ds = tp.GetAllTrialCategories();
foreach (DataRow dr in ds.Tables[0].Rows)
{
categoryList.Items.Add(new ListItem(Converter.ToString(dr["Category"]), Converter.ToString(dr["CategoryId"])));
categoryList.SelectedValue = Eval("CategoryId").ToString();
}
}
}
Here is my client side code..
<pre><asp:Repeater ID="testRepeater" runat="server">
<HeaderTemplate>
<table id="test-table" class="display">
<thead>
<td>First Name</td>
<td>Surname</td>
<td>Date of Birth</td>
<td>State</td>
<td>Postcode</td>
<td>Email</td>
<td>Category</td>
</thead>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%# DataBinder.Eval(Container, "DataItem.FirstName") %></td>
<td><%# DataBinder.Eval(Container, "DataItem.Surname") %></td>
<td><%# DataBinder.Eval(Container, "DataItem.DOB", "{0:d/M/yyyy}") %></td>
<td><%# DataBinder.Eval(Container, "DataItem.State") %></td>
<td><%# DataBinder.Eval(Container, "DataItem.Postcode") %></td>
<td><%# DataBinder.Eval(Container, "DataItem.Email") %></td>
<td>
<asp:DropDownList ID="categoryList"
CommandName="category"
CommandArgument='<%# Eval("PersonId") + ";" + Eval("CategoryId") %>'
runat="server"
AutoPostBack="true"
OnDataBinding="categoryList_DataBinding"></asp:DropDownList>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater
>