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

  • SEARCH
  • Home
  • 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 8730089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:56:59+00:00 2026-06-13T08:56:59+00:00

I am binding a DropDownList, I have FirstName in the 1st column and LastName

  • 0

I am binding a DropDownList, I have FirstName in the 1st column and LastName as a DDL in the second column

protected void GridView1_RowDataBound1(object sender, GridViewRowEventArgs e)
{ 
    DataTable myTable = new DataTable();
    DataColumn productIDColumn = new DataColumn("FirstName");
    DataColumn productNameColumn = new DataColumn("LastName");

    myTable.Columns.Add(productNameColumn);
    DataSet ds = new DataSet();

    ds = get();
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        var categoryID = (e.Row.Cells[0].Text);
        var expression = "FirstName "+categoryID;

        DropDownList ddl = (DropDownList)e.Row.FindControl("DropDownList1");

        DataRow[] rows = ds.Tables[0].Select(expression);
        foreach (DataRow row in rows)
        {
            DataRow newRow = myTable.NewRow();
            newRow["UserId"] = row["UserId"];
            newRow["LastName"] = row["LastName"];
            myTable.Rows.Add(newRow);
        }

        ddl.DataSource = myTable;
        ddl.DataTextField = "LastName";
        ddl.DataValueField = "UserId";
        ddl.DataBind();
    }
}

I am getting an error like Filter expression 'FirstName ' does not evaluate to a Boolean term at DataRow[] rows = ds.Tables[0].Select(expression);

Can anyone help me with this??

  • 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-06-13T08:57:00+00:00Added an answer on June 13, 2026 at 8:57 am

    Your expression doesn’t make any sense. I would expect something along the lines of:

    var expression = "FirstName = 'John'";
    

    or

    var expression = "CategoryId = 42";
    

    Check out the docs for the Select method: http://msdn.microsoft.com/en-us/library/det4aw50.aspx

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

Sidebar

Related Questions

I have a function protected void bindCurrencies(DropDownList drp) { drp.DataSource = dtCurrencies; drp.DataTextField =
I am binding my dropdownlist with Enum I have following enum and code for
I have a dropdownlist in my Gridview and I am binding a datasource to
I have an observable array binding to a dropdownlist. The dropdownlist is populated on
I have a dropdownlist in asp.net mvc which is bound using the normal binding
The Dropdownlist data binding using throw common function. In this have a problem in
I have 2 DropDownList controls on my form, the second of which uses the
I have a dropdownlist like this <asp:dropdownlist runat=server autopostback=true onselecteditemindexchanged=fire_event ID=DDL/> and on codebehind
I have a dropdownlist which i'm binding to DataTable. ddlItems.DataSource = dt; ddlItems.DataBind(); in
When binding values to controls I have plenty of this: Text='<%# Bind(StartDate, {0:dd.MM.yyyy}) %>'

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.