Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Helo Freinds

I had created tab bar When we click tab bar the view page has to displayed.In that view page it contains information about that tab bar

my view page code

JavaScript
var tabbars = [];

    tabbars[0] = initTabbar("b_tabbar", "right", "left");
    tabbars[1] = initTabbar("a_tabbar", "top", "left");
    tabbars[0].setSkin('dhx_skyblue');
    tabbars[1].setSkin('dhx_skyblue');

    tabbars[0].setImagePath("../../codebase/imgs/");
    tabbars[1].setImagePath("../../codebase/imgs/");
    var formData;
    var myForm = new dhtmlXForm("form_container", formData);
    dhxWins = new dhtmlXWindows();
    dhxWins.setImagePath("dhtmlxWindows/codebase/imgs/");
    var popupWindow = dhxWins.createWindow("b_tabbar", 0, 0, 250, 250);
    popupWindow.hide();
    formData = [{
        type: "input",
        label: "Enter Tab",
        name: "Name",
        value: ""
    },
    {
        type: "button",
        name: "Save",
        value: "Save",
        command: "Save"
    }, {
        type: "button",
        name: "Cancel",
        value: "Cancel"

    }
    ];
    var myForm = popupWindow.attachForm(formData);

    var url = '/Home/Database'
    $.ajax({ type: "GET",
        url: url,

        dataType: "json",
        error: function (xhr, status, error) {
            alert(error);
        },
        success: function (json) {
            var c = 1;
            var d = 0;
            for (i = 0; i <= 3; i++) {
                c++;

                d++;
                tabbars[1].addTab("a" + d, json[i].Tabname, "60px");
                tabbars[1].setContentHTML("a1", "HTML");
                if (c == 5) {

                    tabbars[1].addTab("a" + c, "newtab", "60px");

                    var lastTab = "a" + c;

                    tabbars[1].attachEvent("onSelect", function (id, prevId) {

                        if (id == lastTab) {
                            popupWindow.show();
                            popupWindow.center();
                            popupWindow.button("close").disable();
                            myForm.setItemFocus("Name");

                        }
                        return true;
                    });

                    var c = 6;
                    myForm.attachEvent("onButtonClick", function (name, command) {
                        if (name == "Save") {

                            var value = myForm.getItemValue("Name");
                            //            lastTab = "a" + c;
                            var index = tabbars[1]._rows[0].tabCount - 1;

                            tabbars[1].addTab("a" + c, value, "60px", index);
                            tabbars[1].setTabActive("a" + c);

                            c++;

                            popupWindow.hide();
                            tabbars[1].setContentHTML("a" + c, "a <br/> b");
                        }
                    });
                    myForm.attachEvent("onButtonClick", function (name, command) {


                        if (name == "Cancel") {

                            popupWindow.hide();
                            tabbars[1].setTabActive("a4");


                        }
                    });
                }

                myForm.attachEvent("onButtonClick", function (name, command) {

                    if (name == "Save" && command == "Save") {

                        $.ajax({

                            url: "/Home/Save",

                            data: JSON.stringify({

                                name: myForm.getItemValue("Name")
                            }),
                            cache: false,
                            dataType: "json",
                            success: function (str) {
                                alert(str.st);

                            },
                            type: 'POST',
                            contentType: 'application/json; charset=utf-8'
                        });
                    }
                });
            }
        }
    });


    $.getJSON('/Home/AddTab', "", function (data) {
        tabbars[0].setHrefMode("ajax-html");
        tabbars[0].addTab("b1", "<div class='rotated" + (isIE8 ? " ie_filter" : "") + "'>" + data.Tab1 + "</div>", "60px");
        tabbars[0].addTab("b2", "<div class='rotated" + (isIE8 ? " ie_filter" : "") + "'>" + data.Tab2 + "</div>", "60px");
        tabbars[0].addTab("b3", "<div class='rotated" + (isIE8 ? " ie_filter" : "") + "'>" + data.Tab3 + "</div>", "60px");
        tabbars[0].setContentHref("b1", "../../Home/About");
    });


What I have tried:

I honestly don't know what's going on. ;/
Posted
Updated 28-Dec-22 1:54am
v2
Comments
Graeme_Grant 27-Dec-22 18:16pm    
This is javascript not C#. Please tag the question correctly.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900