Solved

gridview column width setting not working.

Posted on 2007-03-20
2
239 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
creating a flowchart from an algorithm 5 30
Align Buttons next to each other 2 25
ASP.NET Web Form Variables being reset 2 26
Asp.net mvc entity issue 6 31
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

911 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

26 Experts available now in Live!

Get 1:1 Help Now