Click here to Skip to main content
15,890,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have one dropdiwnlist i want to show data in table format on selection changing of dropdownlist please help me? i m using mvc4 with razor.
i want to add this code in javascript:
"
C#
<div class="table-responsive">
            <table id="UserDetails" class="table table-striped table-bordered table-hover">
            <thead>
                <tr>
                    <th style="width:10%;"></th>
               
                    <th>Contact Number</th>
                    <th>Email</th>
                    
                    
                </tr>
            </thead>
            <tbody>
                @foreach (configuration_utility.Models.User user in Model)     
                {                 
                    <tr>
                        <td>
                            <div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">
                                <a class="orange" href="@Url.Action(" add=", " user=")" data-rel="tooltip" title="Add user">
                                    class="icon-plus-sign bigger-130" href="@Url.Action(" data-rel="tooltip" title="Edit user">
                                </a>
                               @* <a class="red" önclick=" DeleteConfirm();" data-rel="tooltip" title="Delete User">*@
                                     <a class="red" href="@Url.Action(" deleteuser=", " user=", new { username = user.UserName })" önclick="return DeleteConfirm();" data-rel="tooltip" title="Delete user">
                                    ^__i class="icon-trash bigger-130">
                                </a>
                            </a></div>
                           
                       @* </td>*@
                      
                        <td>@user.Contact</td>
                        <td>@user.Email </td>
                       
                      
                    </tr>
                }
            </tbody>
        </table>
    </div>"
Posted
Updated 12-Mar-14 22:43pm
v5

Here's an article explaining the basics of how to do it. Simple Implementation of MVC Cascading Ajax Drop Down[^]
 
Share this answer
 
Add an action result to controller that retunrs json data which displays on table. Use Jquery Ajax or jquery getjson method to call above action result on drop down list value change. And append the json data to your table.
check the following sample link for reference
link[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900