1
votes

I created with ASP.NET Dynamic Data Entities Web App and ADO.NET Entity Data Model an dynamic application to modify an sql table.

But how can i modify in gridView column width?? The columns are big but the data will be cut.

Table column width screenshot

In *.edmx file the MaxLength is set to 300.

 <Property Name="foreign_data" Type="nvarchar" Nullable="false" MaxLength="300" /> 

The grid view in Lists.aspx looks like:

             <asp:GridView ID="GridView1" runat="server" DataSourceID="GridDataSource" EnablePersistedSelection="true"
            AllowPaging="True" AllowSorting="True" CssClass="DDGridView"
            RowStyle-CssClass="td" HeaderStyle-CssClass="th" CellPadding="6" 
            PageSize="15">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:DynamicHyperLink runat="server" Action="Edit" Text="Bearbeiten"
                        />&nbsp;<asp:LinkButton runat="server" CommandName="Delete" Text="Löschen"
                            OnClientClick='return confirm("Sind Sie sicher das Sie diesen Datensatz löschen möchten?");'
                        />&nbsp;<asp:DynamicHyperLink runat="server" Text="Details" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>

            <PagerStyle CssClass="DDFooter"/>        
            <PagerTemplate>
                <asp:GridViewPager runat="server" />
            </PagerTemplate>
            <EmptyDataTemplate>
                There are currently no items in this table.
            </EmptyDataTemplate>
        </asp:GridView>

So how can i control the lenght. By the way, every field is cut after 22 chars! I search the whole solution but no more MaxLength values found. If I set MaxLength Value in gridView it doesen't work.

2
Just a random stab, but is your DB column length 22? - Steve's a D
no column length is 300. if i want to edit/insert/showDetails the field has/shows full lenght - GermanSniper
strange, it has to be somewhere else then... your gridview is absolutely correct - Steve's a D

2 Answers

4
votes

Ok I solved it. I've modified the field template (text.ascx.cs) from

private const int MAX_DISPLAYLENGTH_IN_LIST = 25;

to an higher value....

0
votes

Maybe you entered some "maxlength" Attribute cause both of your values are 22 characters Long.

something like this maybe?

<asp:TextBox ID="txtmyValue" MaxLength="10" runat="server" ..../>

Did you got "BoundField"'s so maybe you should replace them with "TemplateField"'s instead so you can control whats going on:

<asp:TemplateField HeaderText="my text value">
    <ItemTemplate>
        <asp:TextBox ID="txtmyValue" MaxLength="40" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "YOUR_BOUND_ITEM_NAME") %>'></asp:TextBox>
    </ItemTemplate>
</asp:TemplateField>