Question

Asked on 2011-05-10 at 04:48:48ID: 27360749

Need an else statement

by: lrbrister500

Rating9.1Excellent

My JavaScript abilities are rudimentary at best.

In the attached code, I need an else statement for the following section  so that if "mymessage" is not equal to "LT" and/or arrValues is NOT IN the array...a "Invalid Selection" message is returned.

if (mymessage == "LT" && (arrValues.contains(afsSourceDetail))) {
                    args.set_cancel(!confirm("Are you sure you want to split taxes? afsSource: " + afsSource + " afsid: " + afsid));
                selectedRows.clear;

function OnClientItemClickingCollapse(sender, args) {
            var item = args.get_item();
            var grdAFS = $find("<%=grdAvailableForSale.ClientID %>");
            var MasterTable = grdAFS.get_masterTableView();
            var selectedRows = MasterTable.get_selectedItems();
            if (item.get_text() == "Collapse") {
                if (selectedRows.length == 1) {
                    alert("Only 1 Row Selected!");
                }
                else {
                    args.set_cancel(!confirm("Are you sure you want to collapse these items?"));
                    selectedRows.clear;
                }
            }
            else if (item.get_text() == "SplitTaxes") {
                vdataItemIndex = $find("<%=grdAvailableForSale.MasterTableView.ClientID%>").get_selectedItems()[0];
                var afsid = vdataItemIndex.get_cell("afsid").innerHTML;
                var afsSource = vdataItemIndex.get_cell("afsSource").innerHTML;
                var afsSourceDetail = vdataItemIndex.get_cell("afsSourceDetail").innerHTML;
                var mymessage = afsSource.substring(0, 2)
                //arrValues = ["ALL", "P01", "P02", "P03", "P04", "P05"]
//                if (mymessage == "LT") {
//                    args.set_cancel(!confirm("Are you sure you want to split taxes? afsSource: " + afsSource + " afsid: " + afsid));
//                }
                arrValues = ["ALL", "P01", "P02", "P03", "P04", "P05"]
                if (mymessage == "LT" && (arrValues.contains(afsSourceDetail))) {
                    args.set_cancel(!confirm("Are you sure you want to split taxes? afsSource: " + afsSource + " afsid: " + afsid));
                selectedRows.clear;
                }
            }
        }
                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:

Select allOpen in new window

Related Solutions

Solution

Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.

About this Solution

View This Solution - Start Your 30 Day Free Trial
Zone
general
Tags
Participating Experts
2
Solution Grade
A

Replies

 by: pratima_mcs

Posted on 2011-05-10 at 04:52:52ID: 36812555

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: CodeCruiser

Posted on 2011-05-10 at 04:53:36ID: 36812556

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: lrbrister

Posted on 2011-05-10 at 04:59:14ID: 36812557

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: CodeCruiser

Posted on 2011-05-10 at 04:59:51ID: 36812558

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: pratima_mcs

Posted on 2011-05-10 at 05:00:44ID: 36812559

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: lrbrister

Posted on 2011-05-10 at 05:06:34ID: 36812560

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

Log In

Forgot your password?Sign up

Top Experts

  1. mplungjan

    1,840

    0 points yesterday

    Profile

BrowseAre you an Expert?