开发者

ListView with DataPager problem VB.Net / ASP.NET

I've been hunting down this problem for days, so far I have tried many popular methods, absolutely nothing, my listview just dissapears after I rebind it. I am binding a List(Of KeyValuePair(Of String, Integer)), for the indexing functionality, to ListView. When I first bind it, it works nicely, it shows all the key, and value pairs in the required limits of DataPager, but when I turn to pager, the listview dissapears.

Heres what happens when PagePropertiesChanging on ListView is called.

Me.DataPager1.SetPageProperties(e.StartRowIndex, e.MaximumRows, False)
userInterface.DataPagerReBind(ListView1)

And the actual ListView

<asp:ListView ID="ListView1" runat="server" EnableTheming="True" OnPagePropertiesChanging="ListView1_PagePropertiesChanging">
    <LayoutTemplate>
      <table cellpadding="2" width="640px" border="1" ID="tbl1" runat="server">
        <tr id="Tr2" runat="server" style="background-color: #98FB98">
          <th id="Th1" runat="server">Test point name</th>
          <th id="Th2" runat="server">Number of failed Test points</th>
        </tr>
        <tr runat="server" id="itemPlaceHolder" />
      </table>
    </LayoutTemplate>
    <ItemTemplate>
      <tr id="Tr1" runat="server">
        <td>
          <asp:Label ID="VendorIDLabel" runat="server" Text='<%# Eval("key") %>' />
        </td>
        <td>
          <asp:Label ID="AccountNumberLabel" runat="server" Text='<%# Eval("value") %>' />
        </td>
      </tr>
    </ItemTemplate>
</asp:ListView>
<asp:DataPager ID="DataPager1" runat="server" PageSize="10" PagedControlID="ListView1" >
    <Fields>
        <asp开发者_如何转开发:NextPreviousPagerField
            ButtonType="Link" 
            ShowFirstPageButton="True"
            ShowNextPageButton="False" 
            ShowPreviousPageButton="False" />
        <asp:NumericPagerField />
        <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" 
            ShowNextPageButton="False" ShowPreviousPageButton="False" />
    </Fields>
</asp:DataPager>

And userInterface.DataPagerRebind just rebinds the listview to the original list. Can anyone help? I've realy gone lost here, this has troubling me for soo long, the listview just dissapears when I use the pager. Thank you.

Definition for userInterface.DataPagerReBind:

Sub DataPagerReBind(ByRef listView1 As ListView)
    listView1.DataSource = TestList
    listView1.DataBind()
End Sub


 protected void DataPager1_PreRender(object sender, EventArgs e)
    {
       //Assign the updated datasource to your listview again
       //Bind the listview.

    }

This is C# code so try to use the pager prerender event in vb.net

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜