Click here to Skip to main content
16,022,060 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to display 2 columns namely 'block_code' and 'block_name' in DDL.
I use the follwoing code to display but throws an exception stating:
"Column 'block_codeblock_name' does not belong to table block."

adds1.Add(ds1.Tables[0].Rows[i]["block_code" + "block_name"].ToString().ToLower());

Can anyone guide me so that I would like to display both the columns in my DropdownList(DDL).
Posted

You can cncat your fields..

for ex: "select in_product_id + '|' + vc_product_name as "product_detail" from product

and use this result set in dropdown..

Thanks..
 
Share this answer
 
Rajendran

Try

adds1.Add(ds1.Tables[0].Rows[i]["block_code"].ToString().ToLower() + ds1.Tables[0].Rows[i]["block_name"].ToString().ToLower());


If these 2 are selected from a db table as separate fields then they would be separate fields in dataset also.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900