aspx
$(document).ready(function () {
try {
if ("<%=ItemcountRepeater%>" > 0) {
var label_text = $('#ctl00_CustomerMainContent_e2wItemLayout1_lbl1_ShowingItemCount').text(); //Get the text
label_text = label_text.replace("&1", "<%=ItemcountRepeaterPagerValue%>");
label_text = label_text.replace("&2", "<%=ItemcountRepeater%>");
// $('#ctl00_CustomerMainContent_e2wItemLayout1_lbl1_ShowingItemCount').text(label_text.replace("&1", "<%=ItemcountRepeaterPagerValue%>"));
// $('#ctl00_CustomerMainContent_e2wItemLayout1_lbl1_ShowingItemCount').text(label_text.replace("&2", "<%=ItemcountRepeater%>"));
//alert("<%=ItemcountRepeaterPagerValue%>");
// var str = "Showing " + "<%=ItemcountRepeaterPagerValue%>" + " of " + "<%=ItemcountRepeater%>" + " results";
$("#ctl00_CustomerMainContent_e2wItemLayout1_lbl1_ShowingItemCount").text(label_text);
} else {
$("#ctl00_CustomerMainContent_e2wItemLayout1_lbl1_ShowingItemCount").text("");
}
}
catch (err) {
$("#ctl00_CustomerMainContent_e2wItemLayout1_lbl1_ShowingItemCount").text("");
}
});
<asp:Label ID="lbl1_ShowingItemCount" runat="server" Text="Showing 1-30 of 200 results"></asp:Label>
<asp:Repeater ID="pagerTop" runat="server" EnableTheming="False" OnItemDataBound="Pager_ItemDataBound">
<ItemTemplate>
<asp:LinkButton ID="btnPage" CommandName="Page" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "pagerValue") %>'
Text='<%# DataBinder.Eval(Container.DataItem, "pagerText") %>' runat="server"></asp:LinkButton>
</ItemTemplate>
</asp:Repeater>
aspx.cs
public int ItemcountRepeater = 1;
public string ItemcountRepeaterPagerValue = "";
public string strShoppingCatalogDisplayItems = "";
protected void Pager_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
if (ItemcountRepeater < Convert.ToInt32(strShoppingCatalogDisplayItems))
{
ItemcountRepeaterPagerValue = "1-" + ItemcountRepeater;
}
else
{
int paging = Convert.ToInt32(Session["spageIndex"].ToString().Trim()) + 1;
int totalitems = 0;
if (ItemcountRepeater > Convert.ToInt32(strShoppingCatalogDisplayItems))
{
totalitems = (paging * Convert.ToInt32(strShoppingCatalogDisplayItems));
if (ItemcountRepeater < totalitems)
{
ItemcountRepeaterPagerValue = (((paging - 1) * Convert.ToInt32(strShoppingCatalogDisplayItems)) + 1) + "-" + ItemcountRepeater;
}
else
{
int result = ((paging - 1) * Convert.ToInt32(strShoppingCatalogDisplayItems));
result = 0 + 1;
ItemcountRepeaterPagerValue = result + "-" + totalitems;
}
}
}
if (ItemcountRepeater < 1)
{
ItemcountRepeaterPagerValue = "0";
}
}
//Datatable load
if (dtDisplay.Rows.Count > 0)
{
ItemcountRepeater = dtDisplay.Rows.Count;
if (ItemcountRepeater < Convert.ToInt32(strShoppingCatalogDisplayItems))
{
ItemcountRepeaterPagerValue = "1-" + ItemcountRepeater;
}
if (ItemcountRepeater > Convert.ToInt32(strShoppingCatalogDisplayItems))
{
}
}
//load default value from defined parameters
if (!string.IsNullOrEmpty(ConfigParameters.GetParameterValue("ShoppingCatalogDisplayItems"))) {
strShoppingCatalogDisplayItems = ConfigParameters.GetParameterValue("ShoppingCatalogDisplayItems").Trim();
ddlListPerPage.SelectedValue = strShoppingCatalogDisplayItems;
}
else
{
strShoppingCatalogDisplayItems = "30";
ddlListPerPage.SelectedValue = "30";
}
$(document).ready(function () {
try {
if ("<%=ItemcountRepeater%>" > 0) {
var label_text = $('#ctl00_CustomerMainContent_e2wItemLayout1_lbl1_ShowingItemCount').text(); //Get the text
label_text = label_text.replace("&1", "<%=ItemcountRepeaterPagerValue%>");
label_text = label_text.replace("&2", "<%=ItemcountRepeater%>");
// $('#ctl00_CustomerMainContent_e2wItemLayout1_lbl1_ShowingItemCount').text(label_text.replace("&1", "<%=ItemcountRepeaterPagerValue%>"));
// $('#ctl00_CustomerMainContent_e2wItemLayout1_lbl1_ShowingItemCount').text(label_text.replace("&2", "<%=ItemcountRepeater%>"));
//alert("<%=ItemcountRepeaterPagerValue%>");
// var str = "Showing " + "<%=ItemcountRepeaterPagerValue%>" + " of " + "<%=ItemcountRepeater%>" + " results";
$("#ctl00_CustomerMainContent_e2wItemLayout1_lbl1_ShowingItemCount").text(label_text);
} else {
$("#ctl00_CustomerMainContent_e2wItemLayout1_lbl1_ShowingItemCount").text("");
}
}
catch (err) {
$("#ctl00_CustomerMainContent_e2wItemLayout1_lbl1_ShowingItemCount").text("");
}
});
<asp:Label ID="lbl1_ShowingItemCount" runat="server" Text="Showing 1-30 of 200 results"></asp:Label>
<asp:Repeater ID="pagerTop" runat="server" EnableTheming="False" OnItemDataBound="Pager_ItemDataBound">
<ItemTemplate>
<asp:LinkButton ID="btnPage" CommandName="Page" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "pagerValue") %>'
Text='<%# DataBinder.Eval(Container.DataItem, "pagerText") %>' runat="server"></asp:LinkButton>
</ItemTemplate>
</asp:Repeater>
aspx.cs
public int ItemcountRepeater = 1;
public string ItemcountRepeaterPagerValue = "";
public string strShoppingCatalogDisplayItems = "";
protected void Pager_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
if (ItemcountRepeater < Convert.ToInt32(strShoppingCatalogDisplayItems))
{
ItemcountRepeaterPagerValue = "1-" + ItemcountRepeater;
}
else
{
int paging = Convert.ToInt32(Session["spageIndex"].ToString().Trim()) + 1;
int totalitems = 0;
if (ItemcountRepeater > Convert.ToInt32(strShoppingCatalogDisplayItems))
{
totalitems = (paging * Convert.ToInt32(strShoppingCatalogDisplayItems));
if (ItemcountRepeater < totalitems)
{
ItemcountRepeaterPagerValue = (((paging - 1) * Convert.ToInt32(strShoppingCatalogDisplayItems)) + 1) + "-" + ItemcountRepeater;
}
else
{
int result = ((paging - 1) * Convert.ToInt32(strShoppingCatalogDisplayItems));
result = 0 + 1;
ItemcountRepeaterPagerValue = result + "-" + totalitems;
}
}
}
if (ItemcountRepeater < 1)
{
ItemcountRepeaterPagerValue = "0";
}
}
//Datatable load
if (dtDisplay.Rows.Count > 0)
{
ItemcountRepeater = dtDisplay.Rows.Count;
if (ItemcountRepeater < Convert.ToInt32(strShoppingCatalogDisplayItems))
{
ItemcountRepeaterPagerValue = "1-" + ItemcountRepeater;
}
if (ItemcountRepeater > Convert.ToInt32(strShoppingCatalogDisplayItems))
{
}
}
//load default value from defined parameters
if (!string.IsNullOrEmpty(ConfigParameters.GetParameterValue("ShoppingCatalogDisplayItems"))) {
strShoppingCatalogDisplayItems = ConfigParameters.GetParameterValue("ShoppingCatalogDisplayItems").Trim();
ddlListPerPage.SelectedValue = strShoppingCatalogDisplayItems;
}
else
{
strShoppingCatalogDisplayItems = "30";
ddlListPerPage.SelectedValue = "30";
}
No comments:
Post a Comment