Asp.net MVC appliction showing popup message after updating user

Posted by kumar on Stack Overflow See other posts from Stack Overflow or by kumar
Published on 2010-05-25T02:02:08Z Indexed on 2010/05/25 2:11 UTC
Read the original article Hit count: 358

Filed under:
|
|

This is my Update Json method..

public JsonResult Update(StudentInfo e)
        {
            var cache = CacheFactory.GetCacheManager();
            var Status= false;
            for (int i = 0; i <= cache.Count; i++)
            {
                var x = (StudentInfo )cache.GetData("a" + i);
                if (x != null)
                {

                    Status= common.UpdateStudent(e.Student);  
                }
            }
            return Json(Status); 
        }

this is my veiw..

<% using (Html.BeginForm("Update", "home", FormMethod.Post)) 
   { %>
<%= Html.ValidationSummary(true)%>

my scripts..

<script type="text/javascript">
    $(document).ready(function() {
        $('#btnSelectAll').click(function() {
            $('#btnSelect').click(function() {
                $('#input[type=checkbox]').attr('checked', 'checked');
            });

            function validate_excpt(formData, jqForm, options) {

                var form = jqForm[0];

                return true;

            }

            // post-submit callback 
            function showResponse(responseText, statusText, xhr, $form) {

                if (responseText[0].substring(0, 16) != "System.Exception") {
                    $('#error-msg- span:last').html('<strong>Update successful.</strong>');
                } else {
                    $('#error-msg- span:last').html('<strong>Update failed.</strong> ' + responseText[0].substring(0, 48));
                }
                $('#error-msg-').removeClass('hide');

                $('#gui-stat-').html(responseText[1]);
            }
            // post-submit callback
            $('#exc-').ajaxForm({
                target: '#error-msg-',
                beforeSubmit: validate_excpt,
                success: showResponse,
                dataType: 'json'
            });

            $('.button').button();
        });
        $('.button').button();
        $("input[id^='exc-flwup-']").datepicker({
            duration: '',
            showTime: true,
            constrainInput: true,
            stepMinutes: 30,
            stepHours: 1,
            altTimeField: '',
            time24h: true,
            minDate: 0
        });
        $('#ui-timepicker-div').bgiframe();
    });
</script>

I am getting popupmessage when Jsonresult Update method has done..but I am seeing that user is updating perfectly..

popup window saying something like you have choosed to open if I open that I am getting string as True in the file..

is that above code I am doing something wrong?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about jQuery