GridView Headers dont fit in Edit Mode

I have an application and I am using a gridview.
I am having a problem with the format of the gridview when I edit any of my rows. The row grows so much that my last header and control don’t fit in the grid.
I have not idea of what could be causing this.
 My gridview used to work fine before when I had textboxes in my EditItemTemplates. The only changed I made is that where I used to have a textbox, I put now an AjaxControlToolKit.combobox and  a hiddenfield.
I am attaching screen shots of before and after to help to explain the problem.
I am also attaching one section of the code. This is where I declare my new combobox control.

Any help would be appreciated.

Thanks in advance,

<asp:TemplateField HeaderText="Package" SortExpression="Level1">                                                                     
                                <cc1:ComboBox ID="cmbEditLV1" runat="server" 
                                         style="display: inline;" 
                                        DropDownStyle="DropDownList" AppendDataBoundItems="True" 
                                    AutoPostBack="True" MaxLength="0" DataSourceID="SqlDataSource3" 
                                    DataTextField="Level1" DataValueField="Level1" 
                                    SelectedValue='<%# Bind("Level1") %>' >
                                <asp:Label ID="lbLV1" runat="server" Text='<%# Bind("Level1") %>'></asp:Label>
                                <%--<asp:TextBox ID="txtFooterLV1" runat="server" OnTextChanged="TextBox1_TextChanged" Width="50px"></asp:TextBox>--%>
                                <cc1:ComboBox ID="cmbLV1" runat="server" AutoPostBack="True" 
                                        MaxLength="0" style="display: inline;" 
                                        ontextchanged="cmbLV1_TextChanged" AppendDataBoundItems="True" 

Open in new window

Who is Participating?
David RobitailleConnect With a Mentor Analyst ProgrammerCommented:
Do you think it could be related to the fact that even when the grid is rendered, it is wider than the previous version? that a passibility
you could also try to put the gridview out of the table. or in a new page if you use a master page...
I also nothe that is a <ContentTemplate>  tag remaining. do you use a update panel or something? thay render as Div and that could causes problem... try putting the whole table in the updatepanel if that the case....
David RobitailleAnalyst ProgrammerCommented:
it`s look more like a problem with the Style that is applied to the gridview. (with themes, style or tags)
Could you post the gridview declaration and any CSS/ .skin file that is applied to the gridview?
THEtechadminAuthor Commented:
Hi davrob60,
Thanks for your response.
I am posting here the gridview declaration and also the declaration for the table that frames the gridview.
I dont have a css file linked to the gridview though.
Again, the only changes that I made was to sustitute the text boxes by comboboxes and  hiddenfields. The comboboxes have the same width than the previous textboxes.
I just noticed thought, comparing the textboxes version with my new version, that when the page loads, the gridview of the new version is wider than the previous one (about 1 "). I was wondering if that extra inch is what is causing the problem, but I really can't figure it out.
Any help would be greatly appreciated,

Thanks very much,

   <table style="width: 1161px; height: 425px" id="TABLE1" onclick="return TABLE1_onclick()">
            <td style="font-weight: bold; font-size: large; width: 420px; color: #6a5acd; font-family: Arial; height: 23px;">
                WBS Administration</td>
            <td colspan="2" style="height: 23px">            
        <tr style="vertical-align: top">
            <td colspan="3" style="height:1756px">                 <asp:UpdatePanel ID="UpdatePanel7" runat="server">
                <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" 
                    AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSource1" ForeColor="#333333"
                    GridLines="None" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" Style="font-size: small;
                    font-family: Arial; margin-right: 0px;" Width="877px" PageSize="50" 
                    DataKeyNames="ID" ShowFooter="True" OnRowCommand="GridView1_RowCommand" 
                    OnRowDeleting="GridView1_RowDeleting" OnRowUpdating="GridView1_RowUpdating" 
                    OnDataBound="GridView1_DataBound" OnRowCreated="GridView1_RowCreated" 
                    onrowupdated="GridView1_RowUpdated" onrowdatabound="GridView1_RowDataBound">
                    <PagerSettings Mode="Numeric" />
                    <FooterStyle BackColor="SlateBlue" Font-Bold="True" ForeColor="White" />
//*****controls declarations here.***** 

Open in new window

The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

David RobitailleAnalyst ProgrammerCommented:
the problem is in the first line style="width: 1161px;
that will block the gridview of becoming any bigger that this when you go in edit mode.
no, forget that, the problem is in the GridView, you set the Width="877px".
Or, it may be both...
THEtechadminAuthor Commented:
What you say makes sense and I tried before. However, now that you said it I tried again, just to make sure I did it right.
I tried:
1- Taking both widths out
2- Taking just the gridview width out
None of this approaches worked.
Do you think it could be related to the fact that even when the grid is rendered, it is wider than the previous version? What do you think could be the reason for this width difference when I kept the same widh for all the controls?

Thanks a million,

THEtechadminAuthor Commented:
The problem was the UpdatePanel. I took the grid out of it and the problem was solved.

Thanks very much for your help
All Courses

From novice to tech pro — start learning today.