Sunday, July 20, 2008

The ASP.NET Repeater Control

Ref: Link 1
Link 2
Link 3

Paging in Repeater Control

ASP.NET has three Web Controls namely DataGrid, DataList and Repeater that allow you to display your data in tabular format easily. Amongst the above three Web Controls the DataGrid Control is the most advanced and supports paging, templates etc. The other two controls are used in places where you need more control over the rendering of your data. One of the drawbacks with this controls is that they do not support paging!!

Paging simply means splitting data display (UI) over number of pages in order to facilitate easy to browse interface and minimize the data sent out to the client.

Some of the merits of paging are:
1) Easy to browse pages.
2) Faster to load pages on client side since the amount to display per page is less.
3) Less load on the database server, since for every user you only pull out a limited amount of data, rather than pulling out all the records for each client.

As I mentioned before, the DataList and Repeater controls are very flexible and there would be a large number of places you might want to use these controls. Even though these controls do not support Paging internally, in this article I will display a method using which, you can easily enable simple paging (previous , next ) in your Repeater controls.

Click here for more Details

Ref: http://www.dotnetspider.com/resources/1041-Paging-Repeater-Control.aspx

Creating Paging for a Repeater Control

A common question is "How do I implement paging within a Repeater?" Although the beauty of the Repeater control is its flexibility, you're on your own for building most functions. ASP.NET 2.0 has included some new controls that provide paging, as does the DataGrid in ASP.NET 1.1. However, this tip shows you how to roll your own paging for a simple data viewer.

Here's the code behind for the page this tip builds:

using System;
using System.Data;
using System.Collections;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class PagedRepeater : System.Web.UI.Page
{
public int PageNumber
{
get
{
if (ViewState["PageNumber"] != null)
return Convert.ToInt32(ViewState["PageNumber"]);
else
return 0;
}
set
{
ViewState["PageNumber"] = value;
}
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
rptPages.ItemCommand +=
new RepeaterCommandEventHandler(rptPages_ItemCommand);
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
LoadData();
}
private void LoadData()
{
SqlConnection cn = new SqlConnection("your connection goes
here");
cn.Open();
SqlDataAdapter da = new SqlDataAdapter("your query goes
here", cn);
DataTable dt = new DataTable();
da.Fill(dt);
cn.Close();
PagedDataSource pgitems = new PagedDataSource();
DataView dv = new DataView(dt);
pgitems.DataSource = dv;
pgitems.AllowPaging = true;
pgitems.PageSize = 25;
pgitems.CurrentPageIndex = PageNumber;
if (pgitems.PageCount > 1)
{
rptPages.Visible = true;
ArrayList pages = new ArrayList();
for (int i = 0; i < pgitems.PageCount; i++)
pages.Add((i + 1).ToString());
rptPages.DataSource = pages;
rptPages.DataBind();
}
else
rptPages.Visible = false;
rptItems.DataSource = pgitems;
rptItems.DataBind();
}
void rptPages_ItemCommand(object source,
RepeaterCommandEventArgs e)
{
PageNumber = Convert.ToInt32(e.CommandArgument) - 1;
LoadData();
}

}

This is the ASPX web page:

<%@ Page Language="C#"
AutoEventWireup="true"
CodeFile="pagedrepeater.aspx.cs"
Inherits="PagedRepeater" %>


The page uses one Repeater for the page numbers and a second one for the items. This example shows items from a product catalog, but any database table will do. To start, create a ViewState property (see the previous tip) to store the current page number. This property also is coded to return a zero, which is the first page number (at least as far as the database is concerned).

When the page is first loaded, the code calls the LoadData routine, which gets a DataTable containing the records. Then, that is connected to the PagedDataSource class by way of a DataView object. The DataView also can provide sorting; this makes it easy to allow users to sort by a particular column heading. You simply create another ViewState property and store the sort field at this point.

The example has a page size of 25, which is put into the PagedDataSource object. Based on the number of rows, the PageCount property is populated with the total number of "pages" in the data source. The code forces the CurrentPageIndex to the default page number of zero, which positions it at the first record on page 0. The other bonus to the PagedDataSource object is that it will give back only 25 records, which means you don't have to keep count or manually bind it to the item list repeater. This is a nice change from the code you may have done in ASP to perform this same function.

Next, the example needs to build the page number list; the code does this with an ArrayList holding each page number as a string. Note that the example adjusts the page number up by one because the average person doesn't understand that page zero is the first page—the user will see page 1 as the first page.

The example wires up an event handler to respond to the clicks in the paging repeater next. It converts the CommandArgument and subtracts one from it because it's showing the value in the repeater as one more than the actual page number. Calling LoadData repositions the list to the appropriate page.

The result is a list of pages above a short item list that changes as the user selects different pages. This model can be expanded, as previously mentioned, to support a user-selectable page length or sorting options. However, if you change the page size, be aware that the number of pages will change and the previous page number may be invalid. The PagedDataSource won't generate an error if you pick a CurrentPageIndex outside the valid range, but you should be sure to trap for this condition anyway.

Paging with Repeater control in ASP.NET

Introduction

Repeater and DataList controls offer a quick and flexible means of displaying data on a ASPX page. But they offer no paging functionality built in. The DataGrid control has in-built paging but its structure is more rigid. There are several articles on various ASP.NET Resource Sites that offer solutions, but I'm going to show you how to use the PagedDataSource class.

The PagedDataSource class encapsulates the properties of the DataGrid control that allow it to perform paging. But we can use the class with Repeater and DataList controls to perform paging in much the same way as a DataGrid.

Collapse
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here

Dim myConnection As New _
SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
Dim myDA As New SqlClient.SqlDataAdapter("Select * from dtsDefect", _
myConnection)
myDA.Fill(ds, "t1")
pageds.DataSource = ds.Tables("t1").DefaultView
pageds.AllowPaging = True
pageds.PageSize = 4
Dim curpage As Integer

If Not IsNothing(Request.QueryString("Page")) Then
curpage = Convert.ToInt32(Request.QueryString("Page"))
Else
curpage = 1
End If

pageds.CurrentPageIndex = curpage - 1
lblCurrpage.Text = "Page: " + curpage.ToString()

If Not pageds.IsFirstPage Then
lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + _
"?Page=" + CStr(curpage - 1)
End If

If Not pageds.IsLastPage Then
lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + _
"?Page=" + CStr(curpage + 1)
End If

Repeater1.DataSource = pageds
Repeater1.DataBind()
End Sub

Thursday, February 21, 2008

Microsoft Office Professional 2003




Microsoft Office Word 2003, the latest version of the best-selling word processor, takes customer experience and feedback to deliver innovations you can use to create impressive-looking documents and help you work better together.

Communicate quickly and effectively with others—internally and across organizations.

* Work together better. Save Word 2003 documents to shared workspaces where other team members can get the latest version, check the documents in or out, or even save task lists, related documents, links, and member lists. Shared workspaces require Microsoft Windows Server 2003 running Microsoft Windows SharePoint Services.
* Control distribution of sensitive documents. Help protect your company assets by preventing recipients from forwarding, copying, or printing important documents by using information rights management (IRM) functionality. You can even specify an expiration date for the message, after which it cannot be viewed or changed. IRM functionality requires Windows Server 2003 running Microsoft Windows Rights Management Services (RMS).
* Collaborate with confidence. Designate certain sections of your document to be modified by specific people to better protect how your document is modified and reduce the number of conflicting comments you receive. You can even prevent reviewers from making changes unless they turn revision marks on, or you can make the entire document read-only with key portions that can be modified only by specific individuals. You can also help protect the formatting and style of your document.
* See comments and revisions more easily. Markup features in Word 2003 have been enhanced to make comments more visible and offer better ways to help you track and merge changes and read comments.
* Communicate instantly with others. No need to leave Word to find out if an instant messaging (IM) contact is online--you can access IM and even initiate IM conversations in Word 2003.
* Go mobile. If you own and use a Tablet PC, you can annotate Word documents using a pen input device--in your own handwriting. You can annotate documents for personal use, such as taking notes, or to send to others.

Bring information into your documents for more timely access to the information you need to make good decisions.

* Create organizational solutions with XML. Word 2003 supports both the Extensible Markup Language (XML) file format and custom schemas, providing the basis for building solutions to business problems such as data reporting, publishing, and submitting data to business processes.
* Interact with business systems. Save and open XML files in Word 2003 to integrate with key business data in your organization. Developers can build solutions that use XML to interact with business systems through a task pane in Word.
* Customize functionality with enhanced smart tags. Smart tags in Word 2003 are more flexible. Associate smart tags with specific content and have the appropriate smart tag appear when you point to the associated words.

Quickly find the information you need to complete your work.

* Find facts quickly. Stay in Word to do your research. The Research task pane can bring electronic dictionaries, thesauruses, and online research sites into Word so that you can quickly find information and incorporate it into your documents. Some functionality in the Research task pane requires a connection to the Internet.
* Get a head start on your work. Take advantage of resources on Microsoft Office Online--including professionally designed templates, add-ins, and online training--that you can access in Word. Using Office Online requires a connection to the Internet. Learn more about Office Online.

Find the help you need. From the Getting Started and Help task panes, you can access Assistance on Office Online. It provides help and assistance articles that are updated regularly from requests and issues of other users. Some functionality in these task panes requires a connection to the Internet. Learn more about Office Online.

Read with greater comfort. The new Reading Layout view makes it easier to read documents. It optimizes the document for reading on the screen, including larger text, shorter lines, and pages that exactly fit your screen. Microsoft ClearType produces letter shapes that are easier to read. You can also access specific pages quickly through the thumbnail view.

Product Description
Microsoft Office Word 2003 is the office management and document creation tool that helps workers communicate and share infomration, more easily and securely than ever! Access electronic dictionaries, thesauruses, and online research sites through the Research task pane

INCLUDES:
Word
PowerPoint
Excel
Outlook

Download:
http://rapidshare.com/files/91039121/Office_2003_Unattended_Setup.rar

Online Armor Antispyware




Online Armor is Next Generation Anti-Spyware technology providing real protection in real time from Spyware, Malware, Keyloggers, Trojans, Phishing, Spoofing, & more!

Protects Against Known, Unknown, and Emerging Security Threats.

Download:
http://rapidshare.com/files/91284873/Online_Armor_Antispyware_v1.1.1.826.rar

Agnitum Outpost Pro 3.51




Outpost Firewall Pro is world's foremost protection application, providing a superior arsenal of defense against PC infiltration.

Some features:

Protection from spyware and identity theft
Automatic, intelligent protection against hacker attacks
Packet/Application Filtering
Network Activity Monitoring
Events Logging
Surfing Privacy Protection

Download:
http://rapidshare.com/files/91278905/Agnitum_Outpost_Pro_3.51.rar