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 9276331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:49:28+00:00 2026-06-18T16:49:28+00:00

I Want To bind my dropdownlist with two value using some separator just [like

  • 0

I Want To bind my dropdownlist with two value using some separator just [like ‘-‘ or ‘/’] in .net 3.5.

 qry = "SELECT CityName, MasterState.StateName FROM MasterCity INNER JOIN "+
              "MasterState ON MasterCity.StateID = MasterState.StateID order by CityName";

DropCity.DataMember = "DeafultView";
//DropCity.DataTextField = "CityName";
//DropCity.DataValueField = "CityName";
DropCity.DataTextFormatString = "{0} - {1}";
DropCity.DataTextField = "CityName,StateName";
DropCity.DataSource = dt;
DropCity.DataBind();
DropCity.Items.Insert(0, "-Select-");**

I did it but it gives error

DataBinding: ‘System.Data.DataRowView’ does not contain a property with the name ‘CityName,StateName’.”}

How can i do 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-18T16:49:30+00:00Added an answer on June 18, 2026 at 4:49 pm
    DropCity.DataTextField = "CityName,StateName";
    

    DataTextField will look for column CityName,StateName and it doesn’t exist.

    May be you can change your query like this

    qry = "SELECT CityName, CityName + '-' + MasterState.StateName as CityState
        FROM MasterCity INNER JOIN "+
              "MasterState ON MasterCity.StateID = MasterState.StateID order by CityName";
    
        DropCity.DataTextField = "CityState"; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using dropdown in ASP.net to display image along with value <asp:DropDownList ID=ddBanner
I bind two columns into a dropdown using SQL like this string query =
I am using ASP.Net MVC 2 and have trouble getting a DropDownList to bind
I want to bind two column from database into dropdownlist. Here's my code: SqlConnection
I want to get some value from dropdown's selected index change and bind them
I want to bind the value to dropdownlist, the value is retrieved from database.
If I have a dropdownlist I know I can.. SelectedValue='<%#Bind(AgencyID)%>' I want to do
I want to bind a string value to a text box but only if
I want to bind to a value in a dictionary property of an object.
I want to show image in the dropdown using asp.net c#, I got the

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.