Solved

gridview column width setting not working.

Posted on 2007-03-20
2
238 Views
Last Modified: 2008-01-09
Hello experts,

I'm trying to keep data from one column expanding when it gets data.  I've tried setting the column.ItemStyle.Width and the column.HeaderStyle.Width as well, but no go.  I'm wondering if it is possible to set a length on a gridview column where if it gets data like:
"blah, blah, blah" I can actually cut it off to "blah, blah, b" without the column adjusting itself.  Any thoughts?

0
Comment
Question by:carmodyk
2 Comments
 
LVL 16

Accepted Solution

by:
Edwin_C earned 500 total points
ID: 18762086
You can use a templatefield like

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" >
            <Columns>
 <asp:TemplateField>
                    <ItemTemplate>
                        <div style="overflow: hidden; width: 20px">
                            <asp:Label ID="code" runat="server" Text='<%# Eval("myFieldName") %>'></asp:Label>
                        </div>
                    </ItemTemplate>
                </asp:TemplateField>
 </Columns>
        </asp:GridView>
0
 
LVL 6

Author Comment

by:carmodyk
ID: 18765238
Just the answer I was looking for.  You rock!!
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now