Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


getting DropDownList Value from ListView InsertItemTemlate

getting DropDownList Value from ListView InsertItemTemlate

getting DropDownList Value from ListView InsertItemTemlate


Is there a way to get the value from a DropDownList into the InsertParameters of a ListView SqlDataSource. I know that Bind() and Eval() don't work even though this works for other elements like TextBox.

For example


<asp:DropDownList ID="voucher_type_idDropDownList" runat="server" DataSourceID="SqlDataSourceVoucherType" DataTextField="voucher_type_name" DataValueField="voucher_type_id" EnableViewState="true" AppendDataBoundItems="True" SelectedValue='<%# Bind("voucher_type_id")%>'>
<asp:ListItem Selected="True" Value="0" Text="Select Voucher Type"></asp:ListItem>

throws an error

So is there a way to do this in a similar way that you would for a TextBox?

Failing that, what code would I need to access this value and add it to my ListView data source InsertParameters?

In case you are wondering, I have been searching all day for an answer but as yet have not found anything.

Thanks in advance for any help.

Web Development Manager

RE: getting DropDownList Value from ListView InsertItemTemlate

I have no idea how to do this in the markup as I never user the datasource controls. I am very against them for just this reason. Whenever you need to do something a bit differently or more complicated, they just become a PITA.
You should just simply set the value of the parameter in the code behind of the SQLDataSource. Use the Selecting event.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close