473,396 Members | 1,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Display partial information on Dataset

Hi,

Suppose there is a column in the dataset that is a very large field (say
varchar(500)) and i want to display partial information with (....) so that
the user can click on it to view for more.
(I dont want to truncate any info in the dataset...)
How can display partial information in a datagrid?

Thanks,
Stephen
May 23 '06 #1
2 3743
Well you can use some UI tricks there but it depends on how you display your
dataset. For example, if your dataset has a table with a large field bound
to a GridView then you can use GridView's RowDataBound event and put some
code that visually trims your data. Here is a sample considering a GridView
which has some simple bound fields (place it in RowDataBound event handler
method of a GridView):
//Assuming your GridView displays two fields Title and FirstName
// in that order.

if(e.Row.RowType == DataControlRowType.DataRow)
{
//e is the GridRowEventArgs and Cells[1] is the FirstName field of a
//particular row. And assume any FirstName has minimum length of
//2 characters
e.Row.Cells[1].Text = e.Row.Cells[1].Text.Substring(0, 2);
// So you trimmed down your FirstName field to 2 characters.
}

It's not the best way but solution depends on the scenario you are working
on.
"Stephen" <st********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi,

Suppose there is a column in the dataset that is a very large field (say
varchar(500)) and i want to display partial information with (....) so
that
the user can click on it to view for more.
(I dont want to truncate any info in the dataset...)
How can display partial information in a datagrid?

Thanks,
Stephen

May 23 '06 #2
Thanks kerem,

I found another solution I used
<%# DataBinder.Eval(Container.DataItem,
"Description").ToString().Substring(0, length) & "..." %>
in Itemtemplate

Appreciate your input....
and I think I need to graduate to V2.0 and VS2005 i guess...everyone talks
about gridview..

Stephen

"Kerem OZMAN" <tm*@home.com> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Well you can use some UI tricks there but it depends on how you display your dataset. For example, if your dataset has a table with a large field bound
to a GridView then you can use GridView's RowDataBound event and put some
code that visually trims your data. Here is a sample considering a GridView which has some simple bound fields (place it in RowDataBound event handler
method of a GridView):
//Assuming your GridView displays two fields Title and FirstName
// in that order.

if(e.Row.RowType == DataControlRowType.DataRow)
{
//e is the GridRowEventArgs and Cells[1] is the FirstName field of a
//particular row. And assume any FirstName has minimum length of
//2 characters
e.Row.Cells[1].Text = e.Row.Cells[1].Text.Substring(0, 2);
// So you trimmed down your FirstName field to 2 characters.
}

It's not the best way but solution depends on the scenario you are working
on.
"Stephen" <st********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi,

Suppose there is a column in the dataset that is a very large field (say
varchar(500)) and i want to display partial information with (....) so
that
the user can click on it to view for more.
(I dont want to truncate any info in the dataset...)
How can display partial information in a datagrid?

Thanks,
Stephen


May 23 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

43
by: nospam | last post by:
I got three (3) files (1) Untitled.aspx (2) Untitled.aspx.1.cs (3) Untitled.aspx.2.cs These three files must be used together to make file #1, Untitled.aspx, page work via J.I.T. when the...
18
by: Alpha | last post by:
Hi, I'm working on a Windows applicaton with VS 2003 on windows 2000. I have a listbox that I have binded to a dataset table, "source" which has 3 columns. I would like to display 2 of those...
1
by: yma | last post by:
Hi, I tried to use a listbox to display a column in MS Access 2000 nwind.mdb by using ole DataAdapter, Connection and dataset controls. But I got "It is already opened exclusively by another...
7
by: fisab | last post by:
I apologise in advance for such a basic question, but I'm hoping someone will take the time to answer my question. In my code I define a Dataset : Partial Class Default_aspx Dim dsExcel As...
0
by: M. David Johnson | last post by:
I cannot get my OleDbDataAdapter to update my database table from my local dataset table. The Knowledge Base doesn't seem to help - see item 10 below. I have a Microsoft Access 2000 database...
2
by: Billy | last post by:
In .Net 2, when I have created a strongly typed dataset of a SQL table and then 'viewed' the code from the RHM menu. I am taken to the new partial class; as expected, but why do I have a partial...
2
by: krajah | last post by:
Need Help Here....... I'm using visual C#: How to insert the value that user have entered combobox and click button.The value will sent into database.This is in form1. In form2,if click button...
2
by: Peted | last post by:
Hi, im moving a project from vs2005 to vs 2008. is doing so i have come across a compiler error regarding partial classes that i dont understand if anyone can explain it to me please the...
4
by: =?Utf-8?B?VG9yZW4gVmFsb25l?= | last post by:
Hi, I have an XML file that I was hoping to use as a database Here is the code that I have copied that should display the data namespace File_Generation_System { public partial class vrholds :...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.