Personal Blog of Mustafa Basgun

Displaying Long Texts Inside ListView Control

with one comment

I really like the flexibility of data presentation with the ListView, and that is the reason why I have been posting about it so much lately. This post is actually a short tip about how to display long texts inside the ListView, which can be easily implemented to the GridView and Repeater controls as well.

I have created a sample Access database with a table named as “QAs” having ID, Question and Answer fields in it. You can find this database file in the download.

Let’s assume that this table is wanted to displayed as:

Then, Answer data should be placed in a Panel control with a fixed Height and Width values in both ItemTemplate and AlternatingItemTemplate templates:

Download

Sample code for this short tip is available in here.

Advertisements

Written by Mustafa Basgun

January 11, 2008 at 5:00 PM

One Response

Subscribe to comments with RSS.

  1. GridView version of this code with a TemplateField would be:

    <asp:TemplateField HeaderText=”Answer”>
    <ItemTemplate>
    <asp:Panel ID=”pnlAnswerText” Height=”90px” Width=”450px” ScrollBars=”Vertical” Runat=”Server”>
    <asp:Label ID=”Answer” runat=”server”><%# Eval(“Answer”) %></asp:Label>
    </asp:Panel>
    </ItemTemplate>
    </asp:TemplateField>

    JB

    January 12, 2008 at 12:58 PM


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: