By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,972 Members | 1,454 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,972 IT Pros & Developers. It's quick & easy.

Display partial information on Dataset

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.