Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
This should be simple?
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
MVC
Titre:
This should be simple?
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01554743
Message ID:
01554743
Vues:
82
Hi everybody,

I am trying a relatively simple thing (I believe), but I can not make it to work :(

I have a view which works fine. I made this view to be a partial view:
@model CardNumbers.Objects.Client

<div style="padding-left:150px; padding-top:50px; padding-bottom:50px;" id="ClientsResults">
<table id="flexClients" style="display:none">
</table>
</div>
<div style="display:none">
<form id="sform">
<input type="hidden" id="fntype" name="fntype">
<input type="hidden" id="Id" name="Id">
<label for="Number">Client No: </label>
<input type="number" id="Number" name="Number" class="numericOnly" />
<label for="Name">Client Name: </label>
<input type =  "text" size =25 id="Name" name ="Name" /><br />
<label for="Contact11">Contact 1: </label>
<input type =  "text" size =25 id="Contact1" name ="Contact1" /><br />
<div class="float-right">
<input type="button" value="Submit" onclick="addFormData();$('#flexClients').flexOptions({ url: '/Client/Client/'}).flexReload();clearAll();$('#sform').dialog('close');">
<input type="button" value="Cancel" onclick="clearAll();$('#sform').dialog('close');" /></div>
</form>
</div>
There is code in CardNumbers.js file that activates this flexClients grid.

I want this view to be called from the main Index view which is currently this:
@model CardNumbers.Objects.Client

@{
    ViewBag.Title = "Clients";
}

<h2>Clients</h2>

<br />


    <fieldset>
        <legend>Search</legend>
        <label for="clientNo">Client No: </label>
        <input type="number" name="searchClientNo" class="numericOnly" /><br />
        <label for="clientName">Client Name: </label>
        <input type =  "text" size =25 data-autocomplete="@Url.Action("QuickSearch", "Client")"  name ="searchClientName" />
        <div>
  @*        @using (Ajax.BeginForm("Search", "Client",
    new AjaxOptions
    {
        HttpMethod = "GET",
        InsertionMode = InsertionMode.Replace,
        UpdateTargetId = "ClientsResults"
      
    }))
    
{
              *@
            <input type="button" value="Find / Refresh" id="ClientsSearch" data-url="@Url.Action("Client", "Client")" />
            @*}*@
        </div>
    </fieldset>
    


<br />
<div style="padding-left:150px; padding-top:50px; padding-bottom:50px;" id="ClientsResults">
@*@{Html.RenderPartial("_Client", Model); }*@
</div>
Finally, I attempt to associate ClientsSearch button click to show this partial view this way:
$(function () {
    $('#ClientsSearch').click(function () {
        $.ajax({
            url: $(this).data('url'),
            type: 'GET',
            cache: false,
            success: function (result) {
                $('#ClientsResults').html(result);
            }
        });
        return false;
    });
});
Now, when I click on the button I see nothing - the clients grid is not shown.

Do you know what should I change in the above to make it work the way I want?

Thanks a lot in advance.
If it's not broken, fix it until it is.


My Blog
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform