Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7161843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:38:09+00:00 2026-05-28T13:38:09+00:00

Tell me please, why this sample code doesn’t work on ASP.NET MVC? http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listcontrol.onselectedindexchanged.aspx Thank

  • 0

Tell me please, why this sample code doesn’t work on ASP.NET MVC?

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listcontrol.onselectedindexchanged.aspx

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:38:10+00:00Added an answer on May 28, 2026 at 1:38 pm

    That code does not work, because asp.net mvc does not have knowledge of controls, used in asp.net webforms (ListControl is one of those controls). WebForms controls rely on ViewState and javascripts generated by webforms framework. Asp.net mvc has no concept of viewstate, neither does it generate any default javascript for page.

    If you want to trigger action from client side in asp.net mvc, you could write pure html and javascript(using jquery for simplicity). 
    In controller

    //action to invoke dynamically
    public ActionResult GetSomeData(int id)
    {
       return Content("id is " + id);
    }
    

    And in view

    <select id="myselect">
         <option value="1">One</option>
         <option value="2">Two</option>
    </select>
    <script>
       $(function(){
          $('#mySelect').change(function(){
              $.get('@Url.Action("GetSomeData")', {id: $(this).val()}, function(data) {
                  alert(data);
              });
          });
       });
    </script>
    

    This should alert ‘id is 1’ and ‘id is 2’ accordingly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone please tell me why this doesn't work? I'm trying to show and
Can you please tell me what kind of construct in C# is this. Code
I'm hell bent on making this work with NAudio, so please tell me if
an anyone look at this simple code (?) and tell me what's wrong please?
Can anyone please tell me how do I make this script run in IE
I set up this test page up on my server. Please tell me why
I've recently written this with help from SO. Now could someone please tell me
I can't seem to get this text to align vertically. Can someone please tell
Please tell me why my window doesn't render. Below is the javascript that i
I tried this and got the output as: void Please explain the following Code:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.