• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 253
  • Last Modified:

gridview column width setting not working.

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
carmodyk
Asked:
carmodyk
1 Solution
 
Edwin_CCommented:
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
 
carmodykAuthor Commented:
Just the answer I was looking for.  You rock!!
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now