Wednesday, September 17, 2008

Using ListView control in custom code

SPListView.aspx

<%@ Page Language="C#" MasterPageFile="~/_layouts/application.master" 
Inherits="SPListView, ListView, Version=1.0.0.0, Culture=neutral, PublicKeyToken=566105bsandeepbe" %>

<%@ Register Assembly="Microsoft.SharePoint, Version=12.0.0.0,
Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.WebControls" TagPrefix="sharepoint" %>

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<sharepoint:ListView ID="SPListView" runat="server" />
</asp:Content>


SPListView.cs
using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;

public partial class SPListView : LayoutsPageBase
{
protected ListView SPListView;

protected void Page_Load(object sender, EventArgs e)
{
SPListView.ListId = Request.QueryString["ListId"];
}
}

0 comments: