Width of whole page extends when 'Edit' is selected - UpdateMethod RRS feed

  • Question

  • User341213469 posted

    Hi guys!

    My web forms's UpdateMethod in GridView controller which when I click on the 'Edit' button, it automatically extends the width of my whole page resulting in having the user to horizontally scroll it.

    What I mean is the Fields boxes actually are too long which causes the problem for me.

    Does anyone have a solution to this problem?

    <asp:GridView runat="server" ID="productsGrid"
            ItemType="ProjectOne.Models.Product" DataKeyNames="ProductID"
            UpdateMethod="productsGrid_UpdateItem" DeleteMethod="productsGrid_DeleteItem"
            AllowSorting="true" AllowPaging="true" PageSize="4"
            AutoGenerateEditButton="true" AutoGenerateDeleteButton="true"
                <asp:DynamicField DataField="ProductID" />
                <asp:DynamicField DataField="ProductName" />
                <asp:DynamicField DataField="ProductDescription" />
                <asp:DynamicField DataField="Quantity" />
                <asp:DynamicField DataField="PriceEach" />
                <asp:DynamicField DataField="TransactDate" />
                <asp:DynamicField DataField="SoP" />
                <asp:DynamicField DataField="ProductCode" />

    Thanks in advance!

    Sunday, November 24, 2013 12:30 PM


All replies

  • User1563932795 posted

    You can set the ControlStyle-Width. Something like this:

                <asp:DynamicField DataField="ProductID" ControlStyle-Width="10" />
                <asp:DynamicField DataField="ProductName" ControlStyle-Width="10" />
                <asp:DynamicField DataField="ProductDescription" ControlStyle-Width="10" />
                <asp:DynamicField DataField="Quantity" ControlStyle-Width="10" />
                <asp:DynamicField DataField="PriceEach" ControlStyle-Width="10" />
                <asp:DynamicField DataField="TransactDate" ControlStyle-Width="10" />
                <asp:DynamicField DataField="SoP" ControlStyle-Width="10" />
                <asp:DynamicField DataField="ProductCode" ControlStyle-Width="10" />

    Sunday, November 24, 2013 3:51 PM
  • User-933407369 posted

    hi alan_ogz83,

    you had posted the similar thread(http://forums.asp.net/t/1952824.aspx?UpdateMethod+extends+the+width+of+the+whole+page+in+GridView+I+need+to+set+it+smaller+Help+) before, had you tried it out ?

    Wordwrap have problem when the text is too long (without space in text), my solution is using css: hidden text if it's too long.

    This is sample code:

                        <asp:TemplateField HeaderText="Parameter path">
                                <div class="paraGraphtext">
                                    <asp:Label ID="lblId" runat="server" Text='<%# Eval("tableField") %>'></asp:Label>


                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;

    Please refer to the link below:


    Hope it helps you. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 26, 2013 2:41 AM