Advertisement
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: |
.aspx file
<div class="StatusMessage">
<asp:Label ID="PageMessage" runat="server"></asp:Label>
</div>
<asp:DataPager ID="ProductListPagerSimple" runat="server" PagedControlID="ProductList" PageSize="5">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False"
ShowPreviousPageButton="False" />
<asp:NumericPagerField />
<asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" ShowNextPageButton="False"
ShowPreviousPageButton="False" />
</Fields>
</asp:DataPager>
<asp:DataPager ID="ProductListPager" runat="server" PagedControlID="ProductList" PageSize="5">
<Fields>
<asp:TemplatePagerField>
<PagerTemplate>
Jump to a specific page:
<asp:DropDownList runat="server" ID="PageJump" AutoPostBack="true"
onselectedindexchanged="PageJump_SelectedIndexChanged">
</asp:DropDownList>
</PagerTemplate>
</asp:TemplatePagerField>
</Fields>
</asp:DataPager>
<asp:DataPager ID="ProductListPagerCombo" runat="server" PagedControlID="ProductList" PageSize="5">
<Fields>
<asp:NextPreviousPagerField FirstPageText="<<" ShowFirstPageButton="True"
ShowNextPageButton="False" ShowPreviousPageButton="False" />
<asp:NumericPagerField />
<asp:NextPreviousPagerField LastPageText=">>" ShowLastPageButton="True"
ShowNextPageButton="False" ShowPreviousPageButton="False" />
</Fields>
</asp:DataPager>
<br />
Change Pagesize
<asp:DropDownList ID="ddlChangePagesize" runat="server">
<asp:ListItem Selected="True">5</asp:ListItem>
<asp:ListItem>7</asp:ListItem>
<asp:ListItem>10</asp:ListItem>
<asp:ListItem>12</asp:ListItem>
<asp:ListItem>15</asp:ListItem>
<asp:ListItem>22</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="Button1" runat="server" OnClick="RePage" Text="Change Pagesize" /> <br />
<br />
<asp:ListView ID="ProductList" runat="server" DataSourceID="SqlDataSource1">
<LayoutTemplate>
<h3>Product Listing</h3>
<blockquote>
<asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>
</blockquote>
</LayoutTemplate>
<ItemSeparatorTemplate>
<hr />
</ItemSeparatorTemplate>
<ItemTemplate>
<h4><%#Eval("Naslov") %></h4>
Available at <%#Eval("PostText")%> <br />
dodano : <%#Eval("Created")%>
</ItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DataAccessQuickStart %>"
SelectCommand="SELECT [IdPost], [UserID], [IdLang], [Created], [Naslov], [PostText], [Brojac], [ActivePost] FROM [ac_Posts] WHERE (([IdLang] = @IdLang) AND ([UserID] = @UserID)) ORDER BY [IdPost] DESC">
<SelectParameters>
<asp:Parameter DefaultValue="1" Name="IdLang" Type="Int32" />
<asp:Parameter DefaultValue="1" Name="UserID" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
----------------------------------------------------------------------------------------
.aspx.vb file
Protected Sub ProductList_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles ProductList.DataBound
Dim currentPage As Integer = (ProductListPager.StartRowIndex / ProductListPager.PageSize) + 1
Dim totalPages As Integer = ProductListPager.TotalRowCount / ProductListPager.PageSize
PageMessage.Text = String.Format("You are viewing page {0} of {1}", currentPage, totalPages)
'Populate the DropDownList if needed
Dim ddl As DropDownList = CType(ProductListPager.Controls(0).FindControl("PageJump"), DropDownList)
If ddl.Items.Count = 0 Then
'Add a list item for each page
For i As Integer = 1 To totalPages
ddl.Items.Add(i.ToString())
Next
'Set the DDL to the appropriate page value
ddl.Items.FindByValue(currentPage.ToString()).Selected = True
End If
End Sub
Protected Sub PageJump_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Dim PageJumpDDL As DropDownList = CType(sender, DropDownList)
Dim pageNo As Integer = Convert.ToInt32(PageJumpDDL.SelectedValue)
Dim startRowIndex As Integer = (pageNo - 1) * ProductListPager.PageSize
ProductListPager.SetPageProperties(startRowIndex, ProductListPager.PageSize, True)
End Sub
|
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
|
Loading Advertisement... |