Add download indicator to MVC webpage?

I use MVC3 and display my data in webgrid. I would like to display a download indicator (upload image) displayed during filtering / search. What is the best approach?

My search filter (code):

@using (Html.BeginForm())
{
     <fieldset  id="fieldset1" class="coolfieldset">

        <legend>Search for Towers Watson Subscribers/Contacts</legend>
        <div class="div-table">
        <div class="div-table-row">
            <div class="div-table-col">Reg Date:</div>
            <div class="div-table-col"><input id="regDateFrom" class="datepicker" name="regDateFrom" value="@regDateFrom" type="text" /> to <input id="regDateEnd" class="datepicker" value="@regDateEnd" name="regDateEnd" type="text" /></div>
        </div>
        <div class="div-table-row">
            <div class="div-table-col">Profile Mod Date:</div>
            <div class="div-table-col"><input type="text" id="profileModDateFrom" class="datepicker" value="@profileModDateFrom"  name="profileModDateFrom" /> to <input id="profileModDateEnd" class="datepicker" value="@profileModDateEnd" name="profileModDateEnd" type="text" /></div>
        </div>
        <div class="div-table-row">
            <div class="div-table-col">Last Name:</div>
            <div class="div-table-col"><input type="text" id="lastName" name="lastName" value="@lastName" /></div>
        </div>
          <div class="div-table-row">
            <div class="div-table-col"><input id="search" name="search" type="submit" value="Search" /></div>
            <div class="div-table-col"></div>
        </div>
        </div>      
    </fieldset>
}
{@Html.Partial("List_Ajax", Model)}
+5
source share
1 answer

http://www.ajaxload.info/ allows you to create a nice bootable gif. Create an image and place it in a div as shown below. Then bind the search button with jQuery to display the hidden div when clicked.

Place the next div where you want the download icon to display.

<div id="loadingDiv" style="display:none"><img src="loading.gif"></div>

Then this is in your javascript file

$(document).ready(){
    $('#search').click(function(){
        $('#loadingDiv').show();
    });
});

, , :

function SomeCallBackEvent(){
    $('#loadingDiv').hide();
};
+5

All Articles