Friday, September 27, 2013

Show nice css jquery notification when data is saved using ajax

 showNotification("Success!", "Deduction Detail Saved !", "notice", "br");

// displays Growl notifications
function showNotification(title, msg, type, location) {
    switch (type) {
        case "error":
            $.growl.error({ title: title, message: msg, location: location });
            break;
        case "notice":
            $.growl.notice({ title: title, message: msg, location: location });
            break;
        case "warning":
            $.growl.warning({ title: title, message: msg, location: location });
            break;
        default:
            $.growl.notice({ title: title, message: msg, location: location });
            break;
    }

You also need to reference jQuery Growl jQuery and Growl CSS in your js section .

You can in your ajax call as following  :

$.ajax("yourpagename.aspx/webmethodname", {
            type: 'POST',
            contentType: 'application/json; charset=utf-8',
            data: JSON.stringify({ objDeduction: deductionPageState }),
            dataType: 'json'
        })
        .done(function(data) {
            if (data.d) {
                clearDeductionPage();
                hideLoader();
                showNotification("Success!", "Deduction Detail Saved !", "notice", "br");
                callback(data);
            } else {
                    getRecentErrors(function(data) {
                    hideLoader();
                    showNotification("Error!", "Error in Saving Deduction Details !\n" + data.d.Message, "error", "br");
                });
            }
        })
        .fail(function(xhr, err, msg) {
            hideLoader();
            handleError(xhr, err, msg);
        });


CODE EXCEPTION MONSTERS







Wednesday, September 11, 2013

load log *.txt file in asp.net page using jquery

 

  $('
').load('mytextFile.txt', function (textStr) {
            var htmlStr = $(this).html(textStr).text();
            $(this).html(htmlStr);
        }).appendTo('form');



Tuesday, September 10, 2013

ask for saving new records once clicked on submit



    Untitled Page
   
   

   

   

       
       

       
           
           
           
           
       

       

       
   

   

protected void btnsubmit_Click(object sender, EventArgs e)
        {
            Response.Write("button_clicked");
            string str = "Are you sure, you want to Approve this Record?";
            this.ClientScript.RegisterStartupScript(typeof(Page), "Popup", "ConfirmApproval('" + str + "');", true);
        } 


       
       

       
           
           
           
           
       

       

       
   
 

  function ConfirmApproval(objMsg) {
            if (confirm(objMsg)) {
                $('.txtCheck').attr('disabled', 'disabled');
                $('.ddlCheck').attr('disabled', 'disabled');
                return true;
            }
            else {
                alert("redirected");
                return false;
            }
        } 

Monday, September 9, 2013

best comment in source code

// 
// Dear maintainer:
// 
// Once you are done trying to 'optimize' this routine,
// and have realized what a terrible mistake that was,
// please increment the following counter as a warning
// to the next guy:
// 
// total_hours_wasted_here = 42
// 


//When I wrote this, only God and I understood what I was doing
//Now, God only knows

http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered

Sunday, September 8, 2013

why make self as this reference in knockout.js

Import Data using INFILE in mysql

LOAD DATA local INFILE 'E://31october//SP//sp_files_sample1//400k sp00 6-19 E.csv'
INTO TABLE  tblspmaster
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
ESCAPED BY '\\'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(sp);

Export data using outfile in mysql

SELECT *
INTO OUTFILE 'E:\31october\SP\Export\10000000.csv'
FIELDS
  TERMINATED BY ','
  OPTIONALLY ENCLOSED BY '"'
  ESCAPED BY '\\'
  LINES TERMINATED BY '\n'
FROM tblspmaster
WHERE CSN BETWEEN 0 AND 10000000


ASP.NET Core

 Certainly! Here are 10 advanced .NET Core interview questions covering various topics: 1. **ASP.NET Core Middleware Pipeline**: Explain the...