Dropdownlist equivalent of "Eval"

Discussion in 'ASP .Net Web Controls' started by Ric_C, Feb 23, 2007.

  1. Ric_C

    Ric_C Guest

    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
    Ric_C, Feb 23, 2007
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric Newton
    Replies:
    3
    Views:
    9,342
    Brock Allen
    Apr 4, 2005
  2. DataBinder.Eval and Eval.

    , Jun 16, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    517
    Karl Seguin [MVP]
    Jun 16, 2006
  3. Alex van der Spek

    eval('07') works, eval('08') fails, why?

    Alex van der Spek, Jan 8, 2009, in forum: Python
    Replies:
    6
    Views:
    1,397
    Bruno Desthuilliers
    Jan 8, 2009
  4. Liang Wang
    Replies:
    8
    Views:
    121
    Ben Morrow
    Feb 2, 2008
  5. Marc Girod

    to eval or not to eval?

    Marc Girod, Apr 19, 2011, in forum: Perl Misc
    Replies:
    2
    Views:
    145
    Marc Girod
    Apr 19, 2011
Loading...

Share This Page