this is my code:

sdsNamaSales.SelectCommand = "SELECT ID, NAMA FROM REF_SALES_OFFICER WHERE" +
                                     " SOF_TYPE = '" + ddlJenisSales.SelectedValue + "' AND KOT_ID = '" + ddlKota.SelectedValue + "'";
        // insert nama sales manual
        ddlNamaSales.Items.Clear();
        ddlNamaSales.DataSource = sdsNamaSales;
        ddlNamaSales.DataTextField = "NAMA";
        ddlNamaSales.DataValueField = "ID";
        ddlNamaSales.DataBind();
        ddlNamaSales.Items.Insert(0, new ListItem("--PILIH--", "--PILIH--"));

i want to set value ID in ddlNamaSales.DataTextField = "NAMA", now ddlNamaSales.DataTextField = "ID - NAMA"

You could add an extra field to your query to create the display value:
"SELECT ID, NAMA, CAST(ID AS nvarchar) + ' - ' + CAST(NAMA AS nvarchar) AS DisplayValue FROM REF_SALES_OFFICER WHERE..."
Then assign DisplayValue to your control.

>how to get two value in dropdownlist in asp.net c#

Have a look at sample,

void page_load() {
   if(!IsPostBack) {
         DataTable dt=new DataTable();
         dt.Columns.Add("ProdID",typeof(int));  
         dt.Columns.Add("ProdName");

         dt.Rows.Add(1,"Pen");
         dt.Rows.Add(2,"Pencil");

         DropDownList1.DataSource=dt;
         DropDownList1.DataTextField="ProdName";
         DropDownList1.DataValueField="ProdID";

         DropDownList1.DataBind(); 
   }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.