I need to set the width of gridview columns in edit mode. Visual Studio 2005

Posted on 2007-10-15
Medium Priority
Last Modified: 2013-11-26
I need to set the width of gridview columns in edit mode.

I have a gridview that works well. However the column in edit mode are much wider that necessary.
I am not using templates?

Do I need to use edit templates? If so, then please supply a hint or reference for setting the edit column widths and data format for decimal and string values.

Question by:Dovberman
  • 2
LVL 96

Accepted Solution

Bob Learned earned 500 total points
ID: 20077213
You need to set the width for the column in the edit template.


Author Comment

ID: 20077752
Yes, but how?

This is my code for the template columns.
They are still as wide as before.

<asp:GridView ID="grdPurchases" runat="server" AutoGenerateColumns="False" DataKeyNames="BuyTransID"
            DataSourceID="dscPurchases" AllowPaging="True" AllowSorting="True">
                <asp:CommandField ShowEditButton="True" ShowSelectButton="True" />
                <asp:TemplateField HeaderText="Broker Acct" SortExpression="BrokerAccount">
                        <asp:TextBox ID="txtBrokerAccount" runat="server" Text='<%# Bind("BrokerAccount") %>'>
                    <ItemStyle HorizontalAlign="Left" Width="20px" Wrap="False" />
                <asp:TemplateField HeaderText="BuyQty" SortExpression="BuyQty">
                        <asp:TextBox ID="txtBuyQty" runat="server" Text='<%# Bind("BuyQty") %>'></asp:TextBox>
                    <ItemStyle Width="10px" />
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("BuyQty") %>'></asp:Label>

Author Comment

ID: 20079581
Please close this question.
I have not received a workable answer.
Meanwhile, I figured it out myself.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

850 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