Hi all
I want to implement paging with data list. i had found many errors. so any one have solution then send it to me. i am sending the code for that control.
<%@ Control language="C#" Inherits="YourCompany.Modules.AuraProductView.ViewAuraProductView" CodeFile="ViewAuraProductView.ascx.cs" AutoEventWireup="true"%>
<%@ Register TagPrefix="dnn" TagName="Audit" Src="~/controls/ModuleAuditControl.ascx" %>
<%--<%@ Register TagPrefix="dnnsc" Namespace="DotNetNuke.UI.WebControls" Assembly="DotNetNuke" %>--%>
<%@ Register TagPrefix="dnntv" Namespace="DotNetNuke.UI.WebControls" Assembly="DotNetNuke" %>
<asp:datalist id="lstContent" datakeyfield="ItemID" runat="server" CssClass="Product" cellpadding="4" RepeatColumns="4" >
<asp:Literal ID="pname" runat="server" Text='<%#Eval("ProductName")%>'>
<%--<img id="showImage" runat="server" alt='<%#Eval("Imagepath") %>' src='../../MyAdmin/Images/<%#Eval("ImagePath") %>' />--%>
<asp:Image id="showimage" runat="server" AlternateText="" ImageUrl='<%#Eval("ImagePath","~/MyAdmin/Images/tb{0}") %>' />
<asp:Literal ID="pdesc" runat="server" Text='<%#Eval("pdescription") %>'>
|
agingControl id="PagingControl1" runat="server">agingControl>
/*
' DotNetNuke® -
http://www.dotnetnuke.com
' Copyright (c) 2002-2006
' by Perpetual Motion Interactive Systems Inc. (
http://www.perpetualmotion.ca )
'
' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
' documentation files (the "Software"), to deal in the Software without restriction, including without limitation
' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
' to permit persons to whom the Software is furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all copies or substantial portions
' of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
' DEALINGS IN THE SOFTWARE.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Web.UI;
using System.Web.UI.WebControls;
using DotNetNuke;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Modules.Actions;
using DotNetNuke.Security;
using DotNetNuke.Services.Exceptions;
using DotNetNuke.Services.Localization;
using DotNetNuke.UI.WebControls;
namespace YourCompany.Modules.AuraProductView
{
/// -----------------------------------------------------------------------------
///
/// The ViewAuraProductView class displays the content
///
///
///
///
///
/// -----------------------------------------------------------------------------
partial class ViewAuraProductView : PortalModuleBase, IActionable
{
#region Private Members
private string strTemplate;
#endregion
#region Public Methods
public bool DisplayAudit()
{
bool retValue = false;
if ((string)Settings["auditinfo"] == "Y")
{
retValue = true;
}
return retValue;
}
#endregion
#region Event Handlers
/// -----------------------------------------------------------------------------
///
/// Page_Load runs when the control is loaded
///
///
///
///
///
/// -----------------------------------------------------------------------------
protected void Page_Load(System.Object sender, System.EventArgs e)
{
try
{
if (!Page.IsPostBack)
{
if (((string)Settings["template"] != null) && ((string)Settings["template"] != ""))
strTemplate = (string)Settings["template"];
else
strTemplate = Localization.GetString("Template.Text", LocalResourceFile);
AuraProductViewController objAuraProductViews = new AuraProductViewController();
List
colAuraProductViews;
//get the content from the AuraProductView table
colAuraProductViews = objAuraProductViews.GetAuraProductViews();
if (colAuraProductViews.Count == 0)
{
//add the content to the AuraProductView table
AuraProductViewInfo objAuraProductView = new AuraProductViewInfo();
objAuraProductView.ModuleId = ModuleId;
objAuraProductView.Content = Localization.GetString("DefaultContent", LocalResourceFile);
objAuraProductView.CreatedByUser = this.UserId;
objAuraProductViews.AddAuraProductView(objAuraProductView);
//get the content from the AuraProductView table
colAuraProductViews = objAuraProductViews.GetAuraProductViews();
}
//********************************************************************************
lstContent.DataSource = colAuraProductViews;
lstContent.DataBind();
}
}
catch (Exception exc) //Module failed to load
{
Exceptions.ProcessModuleLoadException(this, exc);
}
}
protected void lstContent_ItemDataBound(System.Object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
{
string strContent = strTemplate;
string strValue = Null.NullString;
//add content to template
ArrayList objProperties = CBO.GetPropertyInfo(typeof(AuraProductViewInfo));
int intProperty;
foreach (PropertyInfo objPropertyInfo in objProperties)
{
if (strContent.IndexOf("[" + objPropertyInfo.Name.ToUpper() + "]") != -1)
{
strValue = Server.HtmlDecode(DataBinder.Eval(e.Item.DataItem, objPropertyInfo.Name).ToString());
strContent = strContent.Replace("[" + objPropertyInfo.Name.ToUpper() + "]", strValue);
}
}
//assign the content
Label lblContent = (Label)e.Item.FindControl("lblContent");
lblContent.Text = strContent;
}
#endregion
#region Optional Interfaces
/// -----------------------------------------------------------------------------
///
/// Registers the module actions required for interfacing with the portal framework
///
///
///
///
///
///
/// -----------------------------------------------------------------------------
public ModuleActionCollection ModuleActions
{
get
{
ModuleActionCollection Actions = new ModuleActionCollection();
Actions.Add(this.GetNextActionID(), Localization.GetString(ModuleActionType.AddContent, this.LocalResourceFile), ModuleActionType.AddContent, "", "", this.EditUrl(), false, SecurityAccessLevel.Edit, true, false);
return Actions;
}
}
#endregion
}
}
Please help me.