Click here to Skip to main content
15,887,683 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Countdown timer Pin
dusty_dex22-Mar-13 9:56
dusty_dex22-Mar-13 9:56 
Questionprint list view Pin
atul_pune21-Mar-13 23:41
atul_pune21-Mar-13 23:41 
QuestionJquery Event in Ajax Loaded Table Only Works Once Pin
kruegs3521-Mar-13 10:10
kruegs3521-Mar-13 10:10 
AnswerRe: Jquery Event in Ajax Loaded Table Only Works Once Pin
Marco Bertschi22-Mar-13 1:38
protectorMarco Bertschi22-Mar-13 1:38 
GeneralRe: Jquery Event in Ajax Loaded Table Only Works Once Pin
kruegs3522-Mar-13 1:57
kruegs3522-Mar-13 1:57 
GeneralRe: Jquery Event in Ajax Loaded Table Only Works Once Pin
kruegs3522-Mar-13 2:40
kruegs3522-Mar-13 2:40 
GeneralRe: Jquery Event in Ajax Loaded Table Only Works Once Pin
Marco Bertschi22-Mar-13 5:16
protectorMarco Bertschi22-Mar-13 5:16 
QuestionProblem with WebMethod when it is called from Jquery Pin
Nafiseh Salmani20-Mar-13 12:50
Nafiseh Salmani20-Mar-13 12:50 
Here is my code:

JavaScript
$('.Status').click(function() {
              var divparent = $(this).closest('.tabs-content');
              var ruleid = divparent.attr('data-ruleid');
              var statusid;
              if (divparent.hasClass('inactive')) {
                  $(this).closest('.tabs-content').removeClass('inactive');
                  statusid = 1;
              }
              else {
                  console.log('active');
                  $(this).closest('.tabs-content').addClass('inactive');
                  statusid = 0;
              }

              $.ajax({ type: "POST", Url: "NewRules.aspx/SaveStatus",
                  data: "{strStatus:'" + statusid + "',strRuleID:'" + ruleid + "'}",
                  contentType: "application/json;charset=utf-8",
                  dataType: "json"
              });

          });



and here is the WebMethod:

C#
[WebMethod]
        public static string SaveStatus(string strStatus,string strRuleID)
        {
            int status = int.Parse(strStatus);
            long RuleID;
            if (long.TryParse(strRuleID, out RuleID))
            {

                UploadScheduleDisplay display = UpSchDisp.Where(d => d.Id == RuleID).FirstOrDefault() as UploadScheduleDisplay;

                if (display != null)
                {
                    //pause or active the display
                    if (display.IsPaused)
                    {
                        display.Resume();
                    }
                    else
                    {
                        display.Pause();
                    }
                    //command will delete/add the rule from/to the module
                    CommandUtils.SendNewCommandAudit(CommandTypeEnum.ProgramUploadScheduleRules, 0, unitid,
                        1, 0, cmd_changeStatus, WebMethodLogin);
                }
            }
            else
            { //RuleID is not Valid 
                return "";
            }
            return RuleID.ToString() + "  " +status.ToString();
</pre>

The Jquery click works, but it never goes to WebMethod, do you have any idea what is wrong with my code?

Thanks


modified 21-Mar-13 17:41pm.

AnswerRe: Problem with WebMethod when it is called from Jquery Pin
jkirkerx20-Mar-13 16:40
professionaljkirkerx20-Mar-13 16:40 
GeneralRe: Problem with WebMethod when it is called from Jquery Pin
Nafiseh Salmani20-Mar-13 18:41
Nafiseh Salmani20-Mar-13 18:41 
GeneralRe: Problem with WebMethod when it is called from Jquery Pin
jkirkerx21-Mar-13 6:16
professionaljkirkerx21-Mar-13 6:16 
GeneralRe: Problem with WebMethod when it is called from Jquery Pin
Nafiseh Salmani21-Mar-13 11:40
Nafiseh Salmani21-Mar-13 11:40 
GeneralRe: Problem with WebMethod when it is called from Jquery Pin
jkirkerx21-Mar-13 11:52
professionaljkirkerx21-Mar-13 11:52 
GeneralRe: Problem with WebMethod when it is called from Jquery Pin
Nafiseh Salmani21-Mar-13 12:15
Nafiseh Salmani21-Mar-13 12:15 
GeneralRe: Problem with WebMethod when it is called from Jquery Pin
jkirkerx22-Mar-13 7:12
professionaljkirkerx22-Mar-13 7:12 
QuestionHow do you debug a single ASPX file? Pin
Xarzu20-Mar-13 11:51
Xarzu20-Mar-13 11:51 
AnswerRe: How do you debug a single ASPX file? Pin
jkirkerx20-Mar-13 12:49
professionaljkirkerx20-Mar-13 12:49 
GeneralRe: How do you debug a single ASPX file? Pin
Xarzu20-Mar-13 16:38
Xarzu20-Mar-13 16:38 
GeneralRe: How do you debug a single ASPX file? Pin
jkirkerx20-Mar-13 17:20
professionaljkirkerx20-Mar-13 17:20 
GeneralRe: How do you debug a single ASPX file? Pin
Xarzu21-Mar-13 7:57
Xarzu21-Mar-13 7:57 
GeneralRe: How do you debug a single ASPX file? Pin
jkirkerx21-Mar-13 10:16
professionaljkirkerx21-Mar-13 10:16 
QuestionHow to open an existing excel file (not in the browser) in a new window from ASP.NET 3.5 with C# Pin
bnath00120-Mar-13 7:27
bnath00120-Mar-13 7:27 
AnswerRe: How to open an existing excel file (not in the browser) in a new window from ASP.NET 3.5 with C# Pin
dusty_dex20-Mar-13 9:52
dusty_dex20-Mar-13 9:52 
AnswerRe: How to open an existing excel file (not in the browser) in a new window from ASP.NET 3.5 with C# Pin
Bernhard Hiller20-Mar-13 23:47
Bernhard Hiller20-Mar-13 23:47 
GeneralRe: How to open an existing excel file (not in the browser) in a new window from ASP.NET 3.5 with C# Pin
dusty_dex21-Mar-13 5:27
dusty_dex21-Mar-13 5:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.