尝试编辑或单击复选框时,嵌套的gridview关闭

时间:2017-11-30 20:36:44

标签: asp.net

我的剧本:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/ipc.h>
#include <fcntl.h>
#include <sys/msg.h>
#include <sys/types.h>
#include "msg.h"
void main(int argc, char *argv[]){
    int msgQid;
    int flg = IPC_CREAT | 0644;
    key_t k;
    message_buf sndbuf;
    message_buf rdbuf;
    size_t buf_lng;
    k= atoi(argv[2]);
    if(argc == 3){
        if(k>1){
            if(strcmp(argv[1],"-c")==0 || strcmp(argv[1],"-C")==0){
                //Create Message Queue
                if((msgQid=msgget(k, flg))<0){
                    perror("msgget: EXITING...\n");
                    exit(EXIT_FAILURE);
                }
                else{
                    printf("Queue Created: %d\n",msgQid);
                }
                exit(0);
            }
            else if(strcmp(argv[1],"-d")==0 || strcmp(argv[1],"-D")==0){
                //Delete Message Queue
                flg=0666;
                if((msgQid=msgget(k, flg))==-1){
                    printf("Message Queue Does Not Exist\n");
                    exit(EXIT_FAILURE);
                }
                else{
                    printf("Queue Found: %d\n",msgQid);
                    if((msgctl(msgQid, IPC_RMID, NULL))==-1){
                        fprintf(stderr,"Failed to Delete Queue\n");
                        exit(EXIT_FAILURE);
                    }
                    else{
                        printf("Queue Deleted: %d\n", msgQid);
                    }
                }
                exit(0);    
            }
        }
            else{
                //if not -c/-C or -d/-D then error
                fprintf(stderr, "Incorrect Usage of Flag\n");
                exit(EXIT_FAILURE);
            }
        }
        else{
            fprintf(stderr, "Invalid Key: %s\n", argv[2]);
            exit(EXIT_FAILURE);
        }

    if(argc == 4){
        if(argv[1]=="-r" || argv[1]=="R"){
            //Receive message of type from queue
            if((msgQid=msgget(k, flg))<0){
                perror("msgget: In MSG RECEIVE");
                exit(1);
            }
            if((msgrcv(msgQid, &rdbuf, MSGSZ, k, 0)) <0){
                perror("message receive");
                exit(1);
            }
            printf("%s\n", rdbuf.mtext);
            exit(EXIT_SUCCESS);
        }
    }
    if(argc == 5){
        if(argv[1]=="-s" || argv[1]=="S"){
            //Send message of type to queue
            if((msgQid=msgget(k, flg))<0){
                perror("msgget: In MSG RECEIVE");
                exit(1);
            }
            sndbuf.mtype = atoi(argv[3]);
            strncpy(sndbuf.mtext, argv[4], MSGSZ);
            buf_lng = strlen(sndbuf.mtext)+1;
            if((msgsnd(msgQid, &sndbuf, buf_lng, IPC_NOWAIT))<0){
                fprintf(stderr, "%d, %ld, %s, %d\n", msgQid, sndbuf.mtype, sndbuf.mtext, (int)buf_lng);
                perror("Message Send");
                exit(EXIT_FAILURE);
            }
            exit(0);
        }   
    }
    else{
        printf("DOES NOT FIT CRITERIA\n");  
    }
}

我的代码:

function pageLoad(sender, args) {
    $("[src*=plus]").live("click", function () {
        $(this).closest("tr").after("<tr><td></td><td colspan = '999'>" + $(this).next().html() + "</td></tr>")
        $(this).attr("src", "../img/minus.png");
        $(this).next().next().val(1);
    });

    $("[src*=minus]").live("click", function () {
        $(this).attr("src", "../img/plus.png");
        $(this).closest("tr").next().remove();
        $(this).next().next().val("");
    });

    $(function () {
        $("[id*=IsExpanded]").each(function () {
            if ($(this).val() == "1") {
                $(this).closest("tr").after("<tr><td></td><td colspan = '999'>" + $("[id*=childpanel]", $(this).closest("tr")).html() + "</td></tr>")
                $("[src*=plus]", $(this).closest("tr")).attr("src", "../img/minus.png");
            }
        });
    });
}

function Check_Click(objRef) {
    //Get the Row based on checkbox
    var row = objRef.parentNode.parentNode;

    //Get the reference of GridView
    var GridView = row.parentNode;

    //Get all input elements in Gridview
    var inputList = GridView.getElementsByTagName("input");

    for (var i = 0; i < inputList.length; i++) {
        //The First element is the Header Checkbox
        var headerCheckBox = inputList[0];

        //Based on all or none checkboxes
        //are checked check/uncheck Header Checkbox
        var checked = true;

        if (inputList[i].type == "checkbox" && inputList[i] != headerCheckBox) {
            if (!inputList[i].checked) {
                checked = false;
                break;
            }
        }
    }

    headerCheckBox.checked = checked;        
}

function checkAll(objRef) {
    var GridView = objRef.parentNode.parentNode.parentNode;
    var inputList = GridView.getElementsByTagName("input");

    for (var i = 0; i < inputList.length; i++) {
        //Get the Cell To find out ColumnIndex
        var row = inputList[i].parentNode.parentNode;

        if (inputList[i].type == "checkbox" && objRef != inputList[i]) {
            if (objRef.checked) {
                inputList[i].checked = true;
            }
            else {
                inputList[i].checked = false;
            }
        }
    }       
}

当我选中复选框时,我需要打开mu子gridview。 请给我一些指导。

0 个答案:

没有答案