newbie question regarding Gridview
am 01.04.2008 23:26:53 von Durango2008
Hello I have a form that uses a Gridview to display data obtained from the
database.
The problem I am having is that the data I receive is tremendous amount of
text.
Each cell basically gets elongated vertically and hence the page streches
due to this large amount of data.
My solution is to create uniform sized cells where when you click the cell a
multi-line textbox at the bottom will display the full data for the user to
read through.
My problem is the sizing of each cell.
I am trying to set the width and height of the TemplateField so that each
cell can be resized to a smaller size, but it does not seem to be working.
I have also tried resizing the control items (asp:label, asp:textbox) that
reside within the TemplateField items, but still not change.
Here is a simplified version of code that shows what my Gridview looks like:
%>'/>
'/>
..
..
..
If anyone has any suggestion/advice I'd appreciate it.
thank you.
Re: newbie question regarding Gridview
am 02.04.2008 02:09:21 von Todd_Calhoun
Hi. Use textboxes for the ItemTemplate as well. So you'll be using textboxes
for all your data, whether you want to edit it or just display it. Textboxes
are one-line only, and if you use css to set the width, they even truncate
the contents to fit the width of the textbox. The problem of appearance can
be overcome by using css to make the textbox look like a normal cell. Change
the border-type to solid, change the background-color and the font, make the
textbox readonly, and even onselectstart="return false" so you can't
highlight the contents. Depending on the browser, table cells and spans may
not be as good as textboxes in terms of keeping a fixed size.
If you want, you could also set the title/Tooltip to the same as the
contents (like Windows Explorer does if the column is not wide enough for
the text). Hope this helps. If anything's unclear, just say
Justin Dutoit
"Durango2008" wrote in message
news:yMxIj.9061$Rq1.8209@nlpi068.nbdc.sbc.com...
> Hello I have a form that uses a Gridview to display data obtained from the
> database.
> The problem I am having is that the data I receive is tremendous amount of
> text.
> Each cell basically gets elongated vertically and hence the page streches
> due to this large amount of data.
> My solution is to create uniform sized cells where when you click the cell
> a multi-line textbox at the bottom will display the full data for the user
> to read through.
>
> My problem is the sizing of each cell.
> I am trying to set the width and height of the TemplateField so that each
> cell can be resized to a smaller size, but it does not seem to be working.
> I have also tried resizing the control items (asp:label, asp:textbox) that
> reside within the TemplateField items, but still not change.
>
> Here is a simplified version of code that shows what my Gridview looks
> like:
>
>
>
>
>
>
>
> %>'/>
>
>
>
> %>'/>
>
>
> .
> .
> .
>
>
>
> If anyone has any suggestion/advice I'd appreciate it.
>
> thank you.
>
>