Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 972835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:11:08+00:00 2026-05-16T03:11:08+00:00

I am using EntityDataSource control to display Data in Grid, I want to use

  • 0

I am using EntityDataSource control to display Data in Grid, I want to use the same EntityDataSource to display all data as well as per the search, the problem is I can do only one thing either can use it to search or to get whole data

here is my .aspx page

<asp:EntityDataSource ID="InvestorsSource" runat="server" 
    ConnectionString="name=Entities" 
    DefaultContainerName="Entities" EnableFlattening="False" 
    EntitySetName="Investors" EntityTypeFilter="Investor"  

    Select="it.[InvestorId], it.[InvestorName], it.[Summary], it.[Logo], it.[EmailAddress], it.[PhoneNumber], it.[Website]" 
    AutoGenerateWhereClause="True" OrderBy="it.[InvestorName]">
    <WhereParameters>
        <asp:FormParameter FormField="txtSearchInvestor" Name="investorName" Type="String" />
    </WhereParameters>
</asp:EntityDataSource>
<asp:TextBox ID="txtSearchInvestor" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Go" onclick="Button1_Click" />
<p>
    <asp:GridView ID="gvInvestors" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" 
        DataSourceID="InvestorsSource">
        <Columns>
            <asp:BoundField DataField="InvestorId" HeaderText="InvestorId" ReadOnly="True" 
                SortExpression="InvestorId" />
            <asp:BoundField DataField="InvestorName" HeaderText="InvestorName" 
                SortExpression="InvestorName" ReadOnly="True" />
            <asp:BoundField DataField="Summary" HeaderText="Summary" 
                SortExpression="Summary" ReadOnly="True" />
            <asp:BoundField DataField="EmailAddress" HeaderText="EmailAddress" 
                SortExpression="EmailAddress" ReadOnly="True" />
            <asp:BoundField DataField="PhoneNumber" HeaderText="PhoneNumber" 
                SortExpression="PhoneNumber" ReadOnly="True" />
            <asp:BoundField DataField="Website" HeaderText="Website" 
                SortExpression="Website" ReadOnly="True" />
        </Columns>
    </asp:GridView>
</p>

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T03:11:09+00:00Added an answer on May 16, 2026 at 3:11 am

    I setup a page using the Northwind DB and using the Employees table. There is a TextBox control and Button controls just like your code to filter the data. When the TextBox is empty, all records are displayed. When a EmployeeID is entered into the TextBox, and the ‘Filter’ button is clicked, only the employee with the EmployeeID is displayed(if present in the data). I think this is the kind of behavior you are asking for. Here is the markup:

    <form id="form1" runat="server">
    <div>
    
        <asp:EntityDataSource ID="EntityDataSource1" runat="server" 
            ConnectionString="name=NWEntities" DefaultContainerName="NWEntities" 
            EntitySetName="EmployeeSet" EntityTypeFilter="Employee" AutoGenerateWhereClause="true"
            Select="it.[EmployeeID], it.[LastName], it.[FirstName], it.[Title], it.[TitleOfCourtesy], it.[BirthDate]">
            <WhereParameters>
                <asp:FormParameter FormField="txtFilter" Name="EmployeeID" Type="Int32" />
            </WhereParameters>
        </asp:EntityDataSource>
        <asp:TextBox ID="txtFilter" runat="server" />
        <asp:Button runat="server" Text="Filter" />
        <asp:GridView ID="gvEmployees" runat="server" DataSourceID="EntityDataSource1" AutoGenerateColumns="true" />
    </div>
    </form>
    

    Edit: The question has been raised as how part of a value could be entered into the filter text box to get all the values that start with the entered value. You could use the LIKE SQL operator and the users would need to be told that the “%” character is the wildcard. I changed the filter to the FirstName field. Here are the changes to the above code:

    In the EntityDataSource tag:

    AutoGenerateWhereClause="false"
    
    Where="it.[FirstName] LIKE @FirstName"
    

    In the WhereParameters tag:

    <asp:FormParameter FormField="txtFilter" Name="FirstName" Type="String" DefaultValue="%" />
    

    Now, when “n%” is entered into the filter textbox, all records with a FirstName value that starts with “n” will be displayed. Any valid LIKE clause could now be used.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use to render data using EntityDataSource, and I use to store customer image
How do I handle sorting in RadGrid (or any other Grid) using EntityDataSource on
Using Android TelephonyManager an application can obtain the state of data activity over the
I'm using EntityDataSource with DetailsView in my ASP.NET application. I want to get identity
Using PyObjC , you can use Python to write Cocoa applications for OS X.
Using HTML 5, I want to play multiple sounds simultaneously. how can I do
I want to implement an apperance as this article mentioned using nested ListView control.
Using a populated Table Type as the source for a TSQL-Merge. I want to
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
Using the Redis info command, I am able to get all the stats of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.