troubleshooting Question

Trim the long text in DevExpress gridview

Avatar of mmalik15
mmalik15 asked on
C#ASP.NET
1 Comment1 Solution2593 ViewsLast Modified:
Hi Experts,
I am using DevExpress gridview and one of the columns has a text that is very long, and I 'd like to show only the first sentence and some dots. Is there a way to do this in a Aspxgridview? Thanks!!

p.s. there is a similar question and solution available in at http://forums.asp.net/t/1157778.aspx
but im looking for a similar thing in Aspxgridview.  I have also attached markup of my Aspxgridivew

<dxwgv:ASPxGridView ID="_logBookEntries" runat="server" 
    AutoGenerateColumns="False" CssFilePath="~/App_Themes/Aqua/{0}/styles.css" 
    CssPostfix="Aqua" KeyFieldName="LogEntryId" 
    onrowcommand="_logBookEntries_RowCommand" 
    onrowinserting="_logBookEntries_RowInserting" 
    onrowupdating="_logBookEntries_RowUpdating" 
    onhtmleditformcreated="_logBookEntries_HtmlEditFormCreated" 
    onstartrowediting="_logBookEntries_StartRowEditing"
    Width="100%" oncancelrowediting="_logBookEntries_CancelRowEditing" 
    onpageindexchanged="_logBookEntries_PageIndexChanged" 
    onrowdeleting="_logBookEntries_RowDeleting" >
    <Templates>
        <EditForm>
            <uc1:LogEntry ID="LogEntryForm" runat="server" />
            <div style="text-align:right; padding:2px 2px 2px 2px">
                 <dxwgv:ASPxGridViewTemplateReplacement ID="UpdateButton" ReplacementType="EditFormUpdateButton" runat="server"></dxwgv:ASPxGridViewTemplateReplacement>
                 <dxwgv:ASPxGridViewTemplateReplacement ID="CancelButton" ReplacementType="EditFormCancelButton" runat="server"></dxwgv:ASPxGridViewTemplateReplacement>                                                
             </div>
        </EditForm>
    </Templates>
    <SettingsBehavior ConfirmDelete="True" />
    <Styles CssFilePath="~/App_Themes/Aqua/{0}/styles.css" CssPostfix="Aqua">
    </Styles>
    <SettingsLoadingPanel Text="" />
    <SettingsPager>
        <AllButton>
            <Image Height="19px" Width="27px" />
        </AllButton>        
        <FirstPageButton>
            <Image Height="19px" Width="23px" />
        </FirstPageButton>
        <LastPageButton>
            <Image Height="19px" Width="23px" />
        </LastPageButton>
        <NextPageButton>
            <Image Height="19px" Width="19px" />
        </NextPageButton>
        <PrevPageButton>
            <Image Height="19px" Width="19px" />
        </PrevPageButton>
    </SettingsPager>
    <Images ImageFolder="~/App_Themes/Aqua/{0}/">
        <CollapsedButton Height="15px" 
            Url="~/App_Themes/Aqua/GridView/gvCollapsedButton.png" Width="15px" />
        <ExpandedButton Height="15px" 
            Url="~/App_Themes/Aqua/GridView/gvExpandedButton.png" Width="15px" />
        <DetailCollapsedButton Height="15px" 
            Url="~/App_Themes/Aqua/GridView/gvDetailCollapsedButton.png" Width="15px" />
        <DetailExpandedButton Height="15px" 
            Url="~/App_Themes/Aqua/GridView/gvDetailExpandedButton.png" Width="15px" />
        <HeaderFilter Height="19px" Url="~/App_Themes/Aqua/GridView/gvHeaderFilter.png" 
            Width="19px" />
        <HeaderActiveFilter Height="19px" 
            Url="~/App_Themes/Aqua/GridView/gvHeaderFilterActive.png" Width="19px" />
        <HeaderSortDown Height="5px" 
            Url="~/App_Themes/Aqua/GridView/gvHeaderSortDown.png" Width="7px" />
        <HeaderSortUp Height="5px" Url="~/App_Themes/Aqua/GridView/gvHeaderSortUp.png" 
            Width="7px" />
        <FilterRowButton Height="13px" Width="13px" />
        <WindowResizer Height="13px" Url="~/App_Themes/Aqua/GridView/WindowResizer.png" 
            Width="13px" />
    </Images>
    <Columns>
        <dxwgv:GridViewDataTextColumn FieldName="SubmittedOn" VisibleIndex="0">
        </dxwgv:GridViewDataTextColumn>
        <dxwgv:GridViewDataTextColumn FieldName="LastUpdated" VisibleIndex="1">
        </dxwgv:GridViewDataTextColumn>
        <dxwgv:GridViewDataTextColumn FieldName="Title" VisibleIndex="2">
        </dxwgv:GridViewDataTextColumn>
        
        <dxwgv:GridViewDataTextColumn FieldName="Description"  VisibleIndex="3" >
            <PropertiesTextEdit EncodeHtml="False">
            </PropertiesTextEdit>
            <DataItemTemplate>
            <%#Eval("Description").ToString().Substring(0, Math.Min(20, Eval("Description").ToString().Length)) + "...."%>
            </DataItemTemplate>
        </dxwgv:GridViewDataTextColumn>
        <dxwgv:GridViewDataTextColumn FieldName="Shared" VisibleIndex="4">
        </dxwgv:GridViewDataTextColumn>
        <dxwgv:GridViewCommandColumn VisibleIndex="5">
            <EditButton Visible="True" Text="View or Edit">
            </EditButton>
            <NewButton Visible="True">
            </NewButton>
            <DeleteButton Text="Delete" Visible="True">
            </DeleteButton>
            <ClearFilterButton Visible="True">
            </ClearFilterButton>
        </dxwgv:GridViewCommandColumn>
    </Columns>
    <StylesEditors>
        <ProgressBar Height="25px">
        </ProgressBar>
    </StylesEditors>
    <ImagesEditors>
        <CalendarFastNavPrevYear Height="19px" 
            Url="~/App_Themes/Aqua/Editors/edtCalendarFNPrevYear.png" Width="19px" />
        <CalendarFastNavNextYear Height="19px" 
            Url="~/App_Themes/Aqua/Editors/edtCalendarFNNextYear.png" Width="19px" />
        <DropDownEditDropDown Height="7px" 
            Url="~/App_Themes/Aqua/Editors/edtDropDown.png" 
            UrlDisabled="~/App_Themes/Aqua/Editors/edtDropDownDisabled.png" 
            UrlHottracked="~/App_Themes/Aqua/Editors/edtDropDownHottracked.png" 
            Width="9px" />
        <SpinEditIncrement Height="6px" 
            Url="~/App_Themes/Aqua/Editors/edtSpinEditIncrementImage.png" 
            UrlDisabled="~/App_Themes/Aqua/Editors/edtSpinEditIncrementDisabledImage.png" 
            UrlHottracked="~/App_Themes/Aqua/Editors/edtSpinEditIncrementHottrackedImage.png" 
            UrlPressed="~/App_Themes/Aqua/Editors/edtSpinEditIncrementHottrackedImage.png" 
            Width="7px" />
        <SpinEditDecrement Height="7px" 
            Url="~/App_Themes/Aqua/Editors/edtSpinEditDecrementImage.png" 
            UrlDisabled="~/App_Themes/Aqua/Editors/edtSpinEditDecrementDisabledImage.png" 
            UrlHottracked="~/App_Themes/Aqua/Editors/edtSpinEditDecrementHottrackedImage.png" 
            UrlPressed="~/App_Themes/Aqua/Editors/edtSpinEditDecrementHottrackedImage.png" 
            Width="7px" />
        <SpinEditLargeIncrement Height="9px" 
            Url="~/App_Themes/Aqua/Editors/edtSpinEditLargeIncImage.png" 
            UrlDisabled="~/App_Themes/Aqua/Editors/edtSpinEditLargeIncDisabledImage.png" 
            UrlHottracked="~/App_Themes/Aqua/Editors/edtSpinEditLargeIncHottrackedImage.png" 
            UrlPressed="~/App_Themes/Aqua/Editors/edtSpinEditLargeIncHottrackedImage.png" 
            Width="7px" />
        <SpinEditLargeDecrement Height="9px" 
            Url="~/App_Themes/Aqua/Editors/edtSpinEditLargeDecImage.png" 
            UrlDisabled="~/App_Themes/Aqua/Editors/edtSpinEditLargeDecDisabledImage.png" 
            UrlHottracked="~/App_Themes/Aqua/Editors/edtSpinEditLargeDecHottrackedImage.png" 
            UrlPressed="~/App_Themes/Aqua/Editors/edtSpinEditLargeDecHottrackedImage.png" 
            Width="7px" />
    </ImagesEditors>
</dxwgv:ASPxGridView>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros