Newbie GridView question

D

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:

<asp:panel ID="panelGV" runat="server">
<asp:GridView ID="GridView1" runat="server" DatasourceID="sqldataABC" >
<Columns>
<asp:TemplateField HeaderText="Function" >
<EditItemTemplate>
<asp:TextBox ID="functionTB" runat="server" text="'<%# Bind("Function")
%>'/>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="FunctionLbl" runat="server" text="'<%# Bind("Function") %>'/>
</ItemTemplate>
</asp:TemplateField>
..
..
..
</Columns>
</asp:GridView>

If anyone has any suggestion/advice I'd appreciate it.

thank you.
 
I

Ignacio Machin ( .NET/ C# MVP )

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 cella
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:

<asp:panel ID="panelGV" runat="server">
<asp:GridView ID="GridView1" runat="server" DatasourceID="sqldataABC" >
<Columns>
<asp:TemplateField HeaderText="Function" >
<EditItemTemplate>
<asp:TextBox ID="functionTB" runat="server" text="'<%# Bind("Function")
%>'/>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="FunctionLbl" runat="server" text="'<%# Bind("Function") %>'/>
</ItemTemplate>
</asp:TemplateField>
.
.
.
</Columns>
</asp:GridView>

If anyone has any suggestion/advice I'd appreciate it.

thank you.

Hi,

You could use a TemplatedColumn and putting a control that with a
hover display the entire string in a DIV por example. Take a look at
the RowCreated event.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top