venerdì 1 marzo 2013

JQuery Tabs - Enable - Disable

Here the code to create and disable your tabs:

$("#tabs").tabs({ disabled: [1, 2, 3, 4, 5 ] });

<div id="tabs" >

            <li><a href="#tabs-0">Tab 0</a></li>
            <li><a href="#tabs-1">Tab 1</a></li>

       <div id="tabs-0" >
           … Your Content …
       <div id="tabs-1" >
           … Your Content …

and here the code to enable them:

$('#tabs').tabs('enable', 1)
$('#tabs').tabs('enable', 2)

My Two Cents ...

martedì 19 febbraio 2013

JQuery - PostBack from JQuery Modal DialogBox

In our web applications sometimes we need to use JQuery Modal Dialog Box and make some action in it, for example an insert/update into a database. 
To make this, we have to associate at the action of the modal box button an hidden Aspx button.
The following code show how make this. 

JQuery code to make the Modal Dialog Box:

                autoOpen: false,
                height: 400,
                width: 350,
                modal: true,
                    Ok: function ()
                    Cancel: function ()
                close: function ()
                { }

The Html/Aspx Code to declare your Modal Box and for example the button for the action:

<div id="Your_DIV_ID" title="Your Title">

    ... Your Div Content ...
    <asp:Button ID="Your_Button" style = "display:none" runat="server" Text="Save"  onclick="Your_Button_Click"  />


C# Code of the button:

protected void Your_Button_Click(object sender, EventArgs e)
           // Do Somenthing

My Two Cents ...

JQuery - Getting Value From DropDownList

If you need to get the value of a Drop Down List, look at the following example:

var value = $("#Yuor_DropDownList_ID option:selected").val();

My Two Cents ...

Verify Future Date with Javascript

The following Javascript function shows a way to verify if a date is in the future:

function isFutureDate(obj)
    var dteDate;
    var now = new Date().format("yyyyMMdd");
    obj1 = obj.split("/");
    var day = parseInt(obj1[0], 10);
    var month = parseInt(obj1[1], 10);
    var year = parseInt(obj1[2], 10);

    var born = obj1[2] + obj1[1] + obj1[0];

    if (parseInt(born) > parseInt(now))
        return true;
        return false;

My Two Cents ...

InLine BulletList

If you need to have Inline Bullet List and not vertical and with a custom bullet, you can do as shown here:
This is the code you have to put in .aspx page:

<asp:BulletedList ID="your_bullet_id" runat="server" ></asp:BulletedList>

and here teh code per CSS stylesheet:

    display: inline;
    padding-left: 15px;
    background: url(path_of_your_custom_bullet_image) no-repeat;   

My Two Cents ...