ahmed salah

ahmed salah

  • 1.2k
  • 547
  • 66.7k

When search on column have numbers and character not search for text ?

Aug 28 2023 8:57 PM

I work on asp.net dev express gridview . I face issue when search on gridview column department code 

it accept filter by numbers but text not accept filter .

as Example

column Depart code have value 101HRE

if i search for 101 give me result value 101HRE

if i search for HRE not give me result  101HRE but give me empty result

why it accept search by numbers and not accept search by text this is my question 

full code details

<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="SickLeaveDashboard.aspx.cs" Inherits="UCHRADMIN.SickLeaveDashboard" %>

<%@ Register Assembly="DevExpress.Web.v19.1, Version=19.1.16.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

                    <dx:ASPxGridView ID="ASPxGridView1" Width="100%" runat="server" AutoGenerateColumns="False" SettingsExport-FileName="Leave Type DashBoard" DataSourceID="SqlDataSource1" KeyFieldName="ID" ClientInstanceName="grid"  Theme="PlasticBlue" >
                        <SettingsPager PageSize="10">
                        </SettingsPager>
                        
                        <SettingsExport EnableClientSideExportAPI="true"/>
                        <SettingsEditing EditFormColumnCount="1" Mode="PopupEditForm">
                        </SettingsEditing>
                        <Settings ShowFilterRow="True"  ShowGroupPanel="True" />
                        <SettingsPopup>
                            <EditForm Modal="True" ShowShadow="True" VerticalAlign="WindowCenter" HorizontalAlign="WindowCenter">
                            </EditForm>
                        </SettingsPopup>
                          <Toolbars>
            <dx:GridViewToolbar>
                <SettingsAdaptivity Enabled="True" EnableCollapseRootItemsToIcons="True" />
                <Items>
                    <dx:GridViewToolbarItem Command="ExportToXls" />
                </Items>
            </dx:GridViewToolbar>
        </Toolbars>
                        <Columns>
                    
                            <dx:GridViewDataTextColumn FieldName="Emp No" Visible="True" ReadOnly="True" VisibleIndex="1">
                                <EditFormSettings Visible="False" />
                            </dx:GridViewDataTextColumn>
                            <dx:GridViewDataTextColumn FieldName="Emp Name"  VisibleIndex="2" PropertiesTextEdit-ValidationSettings-RequiredField-IsRequired="true">
                            </dx:GridViewDataTextColumn>
                             <dx:GridViewDataTextColumn  FieldName="Dept Code" VisibleIndex="3" PropertiesTextEdit-ValidationSettings-RequiredField-IsRequired="true">
                            </dx:GridViewDataTextColumn>
                            <dx:GridViewDataTextColumn FieldName="Dept Name" VisibleIndex="4" PropertiesTextEdit-ValidationSettings-RequiredField-IsRequired="true">
                            </dx:GridViewDataTextColumn>
                             <dx:GridViewDataTextColumn FieldName="With Attachment" VisibleIndex="5" PropertiesTextEdit-ValidationSettings-RequiredField-IsRequired="true">
                            </dx:GridViewDataTextColumn>
                             <dx:GridViewDataTextColumn FieldName="Without Attachment"  VisibleIndex="6" PropertiesTextEdit-ValidationSettings-RequiredField-IsRequired="true">
                            </dx:GridViewDataTextColumn>
                           
                            
                        
                             <dx:GridViewDataTextColumn FieldName="Year"  VisibleIndex="7" PropertiesTextEdit-ValidationSettings-RequiredField-IsRequired="true">
                            </dx:GridViewDataTextColumn>
                           
                        </Columns>
                    </dx:ASPxGridView>
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
                        OldValuesParameterFormatString="original_{0}"
                        SelectCommand="SELECT 
    r.EmpNo AS [Emp No], 
    EmpName AS [Emp Name], 
    cast(REPLACE(REPLACE(m.DEPT, ' ', ''), CHAR(13)+CHAR(10), '')  as varchar(100)) AS [Dept Code], 
    cast(b.MCDL01  as nvarchar(200)) AS [Dept Name],
    SUM(CASE WHEN (r.AttachmentFileName IS NOT NULL) THEN 1 ELSE 0 END) AS [With Attachment],
    SUM(CASE WHEN (r.AttachmentFileName = '' or r.AttachmentFileName IS NULL ) THEN 1 ELSE 0 END) AS [Without Attachment],
    YEAR(r.FromDate) AS [Year]
	into #y
FROM 
    [dbo].[tblRequest] r
INNER JOIN 
    [dbo].[vEmployeeMaster] m ON m.EMPNO = r.EmpNo
INNER JOIN 
    [dbo].[vBusinessUnitMaster] b ON MCMCU = m.DEPT
WHERE 
    r.RequestType IN ('SLP', 'SLH', 'SLU') --and m.DEPT like '%101%'
GROUP BY 
    r.EmpNo, EmpName, m.DEPT, YEAR(r.FromDate), b.MCDL01
ORDER BY r.EmpNo, EmpName

select * from #y" >

                    </asp:SqlDataSource>
                </div>
            </div>
        </div>
    </div>
</asp:Content>

Image show issue 


Answers (1)