Getting a local variable value using jQuery
===

I have a little problem when trying to get the value of a local int variable on a view, using jQuery. So, I have a the main view, and as you can see in the code below, I use a partial view named "_Result", when I try to get the value of indexPage by handling the click event of a button in the partial view, I get 0, event if I initialize my variable by another value(5 for example). Any idea why ?

Thanks in advance

My view :

    @model System.Data.DataTable
    
    @{var pageIndex = 5;}
    
    <div>
        <div>
            <span>Téléphone ?</span>
            <input id="idTxTel" type="text" name="txTelephone"/>
    
            <input id="idBnSearch" type="submit" value="Chercher" name="bnSearch"/>
        </div>
    
        @Html.Partial("_Result", Model)
    </div>
    
    <script type="text/javascript">
        $(document).ready(function () {
            $("#idBnSearch").click(function () 
            {
    			//Get me the right value
    			alert('@pageIndex');
            });
    
            $("#bnNextPage").live("click", function () 
            {
    			//Get me a wrong value (always 0)
                alert('@pageIndex');
            });
        });
    </script>

My partial view :

    <div id="result">
        <h2>Résultat de la recherche</h2>
        <div>@ViewBag.CountResult entreprises trouvées</div>
    
        @if(Model != null)
        {
            foreach (DataRow row in Model.Rows)
            {
                <h3>@row["CompanyName"]</h3>
            }
        }
        
        <hr />
        <div>
            <span>Page N sur M</span>
             <input id="bnPreviousPage" type="submit" value="Précédant" name="bnPrevious"/>
             <input id="bnNextPage" type="submit" value="Suivant" name="bnNext"/>
        </div>
    </div>