?
Solved

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

Posted on 2007-10-15
3
Medium Priority
?
744 Views
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.

Thanks,
0
Comment
Question by:Dovberman
  • 2
3 Comments
 
LVL 96

Accepted Solution

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

Bob
0
 

Author Comment

by:Dovberman
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">
            <Columns>
                <asp:CommandField ShowEditButton="True" ShowSelectButton="True" />
                <asp:TemplateField HeaderText="Broker Acct" SortExpression="BrokerAccount">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtBrokerAccount" runat="server" Text='<%# Bind("BrokerAccount") %>'>
                        </asp:TextBox>
                    </EditItemTemplate>
                    <ItemStyle HorizontalAlign="Left" Width="20px" Wrap="False" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="BuyQty" SortExpression="BuyQty">
                    <EditItemTemplate>
                        <asp:TextBox ID="txtBuyQty" runat="server" Text='<%# Bind("BuyQty") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemStyle Width="10px" />
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("BuyQty") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
0
 

Author Comment

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

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