简体   繁体   中英

Concat selected values from multiple dropdown lists and bind to a field in database

Someone help me please.

Here's the thing, I need to create three dropdown lists each for day, month, year. Once these are selected, after clicking a button, the three selected values need to be concatenated and bound to a date column in a database table.

If its a single control, I know I can just use "<%# Bind("Date") %>" but how do i do this.

I've been searching extensively for a week now.

I tried this http://msdn.microsoft.com/en-us/library/aa581787.aspx but it's not working

This is my first question in this forum so please excuse me if I neglected any etiquette

Thanks, Sam

One not-so-straightforward but easy way to solve this is to have an <asp:Hidden /> field that's actually bound to the date column and it's value is initialized to day+month+year from the dropdowns. The <asp:Hidden /> could be updated when these drop downs are changed. So, when you you are ready to insert or update the datasource, you'll get the value from this <asp:Hidden /> which has the date value that's in-sync with the combo boxes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM