Dropdownlist equivalent of "Eval"

R

Ric_C

Greetings all...

I've got an interesting problem that I'm trying to work through and in
need of some help.

I'm trying to get a Microsoft Ajax 1.0 ModalPopupExtender to pass a
parameter to an external WebService using the DynamicContextKey. The
example I've been using is almost completely helpful...however the
author is using a DataList that is locally bound, so he can use the
"Eval("style")" call to get what he wants out of the DataList.

I need to get the SelectedValue of a DropdownList in the same manner,
but since it's not using data binding, Eval just ain't gonna be of any
use.

So, my question is: What can I use to get the value out of the
Dropdown in a manner that is friendly to a server tag?

Here's the example for illustration:
<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender" runat="server"
TargetControlID="LinkButton" PopupControlID="Panel1"
OkControlID="Button1"
BackgroundCssClass="background" DynamicControlID="Panel2"
DynamicContextKey='<%# Eval("style") %>'
DynamicServiceMethod="GetContent" />

I need to replace the <%# Eval("style") %> with something akin to <%#
ddlLessons.SelectedValue.ToString() %>

So far, my attempts include:
1) <%= ddlLessons.SelectedValue.ToString() %> which passes "<%=
ddlLessons.SelectedValue.ToString() %>" to the web service, rather
than the value of the ddl.

2) <% ddlLessons.SelectedValue.ToString() %> which passes "<%
ddlLessons.SelectedValue.ToString() %>" to the web service, rather
than the value of the ddl.

and 3) <%# ddlLessons.SelectedValue.ToString() %> which passes "null"
to the web service.

Variations, including removing the ToString() from the control produce
either "null" being passed to the web service, or it simply won't
compile.

So, does anybody know how I can get the value of the dropdown so I can
pass it along to my web service?

Thanks in advance for the help!

Ric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top