I have a ListView that's inside a UpdatePanel, UpdateMode = Conditional:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table>
<tr>
<td>
<asp:ListView ID="SearchListView" runat="server">
<LayoutTemplate>
<div id="scrollDiv" onscroll="SaveScrollPosition();">
<table>
<tr>
...
</tr>
</table>
</div>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td align="right">
<asp:LinkButton ID="lblUnitItem" runat="server" CommandName="Select"></asp:LinkButton>
</td>
</tr>
</ItemTemplate>
<SelectedItemTemplate>
<tr>
<td align="right">
<asp:LinkButton ID="lblUnitItem" runat="server" CommandName="Select"></asp:LinkButton>
</td>
</tr>
</SelectedItemTemplate>
</asp:ListView>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
Selecting a list item cause the whole page reloading instead of partial page refresh. I bound the listview to the datasource in the method "FillSearchListView", and implemented the "OnSearchListViewItemCommand" and "OnSearchListViewSelectedIndexChanging" events:
protected void OnSearchListViewSelectedIndexChanging(object sender, ListViewSelectEventArgs e)
{
((ListView)sender).SelectedIndex = e.NewSelectedIndex;
FillSearchListView();
}
protected void OnSearchListViewItemCommand(object sender, ListViewCommandEventArgs e)
{
switch (e.CommandName)
{
case "Select":
ListViewDataItem dataItem = (ListViewDataItem)e.Item;
this.CurrentId = decimal.Parse((string)e.CommandArgument);
break;
}
}
Any ideas why this isn't working? Thanks.