ASP.NET Podcast Show #93 - ASP.NET ListView in Orcas Beta 1 - Video

Original URL:


Download WMV

Download MP4

Show Notes:

  • ASP.NET ListView.
  • ListView as a Grid.
  • ListView as a Container of data.

Source Code:

ASPX Page:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ListView.aspx.cs" Inherits="ListView" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="server">
    <title>ListView Page</title>
    <form id="form1" runat="server">
    <asp:ListView ID="ListView1" runat="server" ItemContainerID="tblData">
        <table border="1">
            <tbody runat="server" id="tblData"></tbody>
        <td><%# Eval("Name") %></td>
    <asp:ListView ID="ListView2" runat="server" ItemContainerID="ddlSelect">
        <select ID="ddlS" name="ddlS">
            <asp:PlaceHolder ID="ddlSelect" runat="server"></asp:PlaceHolder>
        <option><%# Eval("Name") %></option>

Code Behind .cs file:

protected void Page_Load(object sender, EventArgs e)
    DataTable dtData = new DataTable();
    DataRow drData;
    dtData.Columns.Add( "Name", System.Type.GetType("System.String"));
    drData = dtData.NewRow();
    drData["Name"] = "Wally McClure";
    drData = dtData.NewRow();
    drData["Name"] = "Paul Glavich - my trusty sidekick";
    ListView1.DataSource = dtData;
    ListView2.DataSource = dtData;

PS.  Due to a snafu with my DNS Server, the site was inaccessible for a while today.  As a result, I took this post offline and put it back on once the server was back up and going. 

1 Comment

  • First of all, I think ListView is not a good name for this control. It's more like a different take on the repeater. There was one thing in the video that was not exactly clear and that kind of worries me; something about ListView replacing the Repeater. I have nothing against having an extra control, but there's no reason why the Repeater couldn't stay. The Repeater is one of those simple but powerful controls. There's no need to explain why you need a control inside a template and to have that hooked up with an ID (for ListView). It's just simple and the results are very easy to predict. Also not having control over the outputted html (see the span tag around the control) is very bad!


    P.S. maybe TemplatedRepeater would be a better name(?)

Comments have been disabled for this content.