Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Button's click - pass values to the conroller method
Message
De
12/10/2012 16:58:01
 
 
Information générale
Forum:
ASP.NET
Catégorie:
MVC
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01554918
Message ID:
01554921
Vues:
45
I do not understand what you're trying to do here.

You have an autosearch box, but also a search button? Why do you have both?

>Hi everybody,
>
>I am trying the following idea:
>
>I want to invoke a controller's method on button's click and pass values from the control defined in that same view (but I am not using a form):
>
>So, right now I have this code
>
>
> <label for="clientName">Client Name: </label>
>        <input type =  "text" size =25 data-autocomplete="@Url.Action("QuickSearch", "Client")"  name ="searchClientName" />
>        <div> 
>
>              
>          @*  <input type="button" value="Find / Refresh" id="ClientsSearch" data-url="@Url.Action("Client", "Client")" />*@
>          <input type="button" value="Find / Refresh" id="ClientsSearch" onclick="location.href=@Url.Action("Client", "Client")" />
>
>
>My idea is to somehow pass new route values to the action this way:
>
>          <input type="button" value="Find / Refresh" id="ClientsSearch" onclick="location.href=@Url.Action("Client", "Client", new {searchClientName =)" />
>
>and here after = I need to somehow pass that searchClientName input box value.
>
>So, I understand I can not do this inline, so I suspect I have to do this in java-script jquery and this is what I have as a sample:
>
>$(function () {
>    $('#ClientsSearch').click(function () {
>    
>// Here I somehow want to set the location.href - or what is the right way to send it here to controller and pass parameters correctly using that other control name?
>      
>//        $('#flexClients').flexOptions({ url: '/Client/Client/' }).flexReload();
>        //$.ajax({
>        //    url: $(this).data('url'),
>        //    type: 'GET',
>        //    cache: false,
>        //    success: function (result) {
>        //        $('#ClientsResults').html(result);
>        //    }
>        //});
>        return false;
>    });
>});
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform