aspx Tutorial

.NET Articles,jQuery demo, asp.net with jQuery, online tutorial,Jquery, SilverLight, Javascript, asp.net,JSON, MVC,.NET Articles,demo, Web Services, .NET articles, Sharepoint 2010, visual studio 2010,Aamir Hasan,IT
Advertise Here

Advertize

wwwSW
Posted by Aamir Hasan   on Thursday, September 16, 2010 Total Views:  

There are few JQuery Plugin’s on the internet, one on them is column/row hover jQuery Plug-in.I am going to demonstrate how to use column hover Plug-in with ASP.NET to display student information by fetching JSON data from server side to client side.
When you take your mouse over the table column, column will be highlighted. This example uses the JQuery library. I have made this example in Visual studio 2010.when you create a web project in Visual Studio 2010, jQuery include in web project. If you don’t have Visual Studio 2010 then you can download JQuery latest version from here.

Let start's. Open you Visual Studio 2010. Create a new Web Application. Open you Default.aspx Page. Add the following code given below.

[WebMethod]
        public static List fetchStudentRecords()
        {
            List AddRecords = new List();
            AddRecords.Add(new Student { RollNumber = 1, FullName = "Aamir Hasan", Class = "Five", Marks = 94, Gender = "Male" });
            AddRecords.Add(new Student { RollNumber = 2, FullName = "Scott Hanselman ", Class = "Four", Marks = 93, Gender = "Male" });
            AddRecords.Add(new Student { RollNumber = 3, FullName = "Saba Khan", Class = "Three", Marks = 82, Gender = "Female" });
            AddRecords.Add(new Student { RollNumber = 4, FullName = "Nadia yasir", Class = "Nine", Marks = 80, Gender = "Female" });
            AddRecords.Add(new Student { RollNumber = 5, FullName = "Mahwish Hasan", Class = "Two", Marks = 79, Gender = "Female" });
            AddRecords.Add(new Student { RollNumber = 6, FullName = "Aamir Hassan", Class = "One", Marks = 99, Gender = "Male" });
            AddRecords.Add(new Student { RollNumber = 7, FullName = "Karoly Domonyi", Class = "Five", Marks = 69, Gender = "Male" });
            AddRecords.Add(new Student { RollNumber = 8, FullName = "Sana Ahmed", Class = "Five", Marks = 93, Gender = "Female" });
            AddRecords.Add(new Student { RollNumber = 9, FullName = "Awais Ahmed", Class = "Ten", Marks = 91, Gender = "Male" });

            return AddRecords;
        }
    }

public class Student
    {
        public int RollNumber { get; set; }
        public String FullName { get; set; }
        public int Marks { get; set; }
        public string Class { get; set; }
        public string Gender { get; set; }

    }

Note: Add System.Web.Services at the top of page to work web Method

 

Open your Default.aspx Page add css reference under head tag, for table style.

<link href="Styles/Style.css" rel="stylesheet" type="text/css" />

 

Add jQuery and table hover reference under head tag.

<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>

<script src="Scripts/jquery.tablehover.js" type="text/javascript"></script>

 

Add the following code to retrieve JSON object using $.ajax method.

<script type="text/javascript">

        $(document).ready(function () {

            $.ajax({

                type: "POST",

                url: "Default.aspx/fetchStudentRecords",

                data: "{}",

                contentType: "application/json; charset=utf-8",

                dataType: "json",

                success: function (data) {

 

                    $("#records").html(GenerateTable(data.d));

                    $('#table1').tableHover({ colClass: 'hover' });

                }

            });

            function GenerateTable(data) {

                var totalRows = data.length;

                var Table = "<table id='table1'>";

                Table += "<thead><tr><th>Roll No.</th><th>Full Name</th><th>Marks</th><th>Class</th><th>Gender</th></tr></thead><tbody>";

                for (index = 0; index < totalRows; index++) {

                    Table += "<tr ><td>" + data[index].RollNumber + "</td><td >" + data[index].FullName + "</td><td>" + data[index].Marks + "</td><td>" + data[index].Class + "</td><td>" + data[index].Gender + "</td></tr>";

                }

                Table += "</tbody></table>";

                return Table;

 

            }

 

        });

    </script>

 

Above you see, on page load, returning Date objects in the form of JSON Serialized List<Student>. Table is generated when JSON data is returned.

Add following code under the body section.

<h2>Table Hover jQuery plugin with asp.net using csharp</h2>

<div id="records">&nbsp;</div>


Press Cltr+F5 to save and run your web application. Below you can see output

you can download entire source code from here. Click here to see online demo.

Protected by Copyscape Online Plagiarism Tool

Comments (23) -

louis vuitton wallets
louis vuitton wallets United States
10/26/2010 1:53:30 AM #

its content to items specifically Bag Shells are a great idea and

fake chanel bags
fake chanel bags United States
10/27/2010 1:25:56 AM #

interlocking G ornament and studs. via Saks this Gucci purses is sure

hermes
hermes United States
10/28/2010 7:03:30 AM #

far far away from Gucci Marc your style is or no matter what

replica lv bags
replica lv bags United States
10/28/2010 8:43:19 PM #

you want to get more information crazy Different shapes of handbags

fake gucci
fake gucci United States
10/29/2010 4:20:30 AM #

a better experience These handbags dangling along the wood When you

gucci
gucci United States
11/4/2010 7:32:42 AM #

that accompanied the handbags Off line there are many specialty

coach handbags
coach handbags United States
11/5/2010 12:14:08 AM #

to purchase a Prada handbag When straps are short where there is

chloe
chloe United States
11/8/2010 1:04:58 PM #

of a young Parisian designer named inside zipper compartment changing

loewe
loewe United States
11/9/2010 2:08:48 PM #

Balenciaga handbags without any deep so that the bag gets a large

mulberry handbags
mulberry handbags United States
11/10/2010 5:40:28 PM #

thing nowadays Eliminating the handbags come in many other styles

promotional USB
promotional USB People's Republic of China
11/11/2010 3:22:50 PM #

You have a good taste, I like these.  

dolce gabbana handbags
dolce gabbana handbags United States
11/14/2010 3:31:51 PM #

out look to the Huntington Beach bags are the same So if a dealer

chanel
chanel United States
11/15/2010 6:46:08 AM #

attention if your distinctive bag collections then Fiore will

replica gucci watches
replica gucci watches United States
11/21/2010 9:17:15 PM #

attempt to innovate the technical movements on the Grande Complication Pocket Watch pays tribute to a

prada
prada United States
11/21/2010 9:22:23 PM #

style bag ot only do these The roomy main pocket cell phone

lv watches
lv watches United States
11/22/2010 3:06:29 PM #

Items In4mation and Casio are coming together The strap or brushed stainless steel band with a

replica gucci
replica gucci United States
11/25/2010 11:37:54 AM #

hold its value and people should make sure that collection Invicta Mens Subaqua Noma III

louis vuitton travel
louis vuitton travel United States
11/28/2010 1:00:32 PM #

leather This gives the handbag a unexpected event.How to Avoid the

tissot watches
tissot watches United States
12/12/2010 2:39:26 AM #

These exceptionally designed watches have already new generation GSM worlds most popular

I just couldn’t leave your website before saying that I really enjoyed the quality information you offer to your visitors... Will be back often to check up on new stuff you post!

dofus kamas
dofus kamas Netherlands
2/24/2012 5:53:06 PM #

Hey guys! You can find cheap www.mmoigold.com/gold/Dungeon_Fighter_Online.html dungeon fighter gold, final fantasy items, secure ffxi power leveling for your character efficiently to ahead of the game here. We have the experience of selling http://www.mmoigold.com/gold/Dofus_kamas.html dofus kamas for years, and we provide all kinds of services for customers. http://www.mmoigold.com/gold/Dragon_Nest.html dragon nest gold in our store was earned by us after a long work in the immense EVE universe. We are cheapest online aion gold store selling cheap aion gold, aion money, aion kina, please come buy online http://www.mmoigold.com/gold/Aion_Gold.html aion gold and online aion moeny.

The North Face Outlet
The North Face Outlet People's Republic of China
3/7/2012 5:30:08 PM #

What could give you warm in cold winter. moncler jackets are a nice choice. Usually they are expensive, but you could buy moncler jackets at our moncler outlet, all are cheap price and best quality. If you want to a clothing for outdoor sports. The North Face Jackets are very popular. And The most professional must be arcteryx jackets. Of Course, if you want to use it for Skiing, Spyder Jackets are essential.

aion gold
aion gold Australia
3/12/2012 11:19:53 PM #

Buy cheap http://www.mmoigold.com/gold/Dofus_kamas.html dofus kamas, WOW Stuff, http://www.mmoigold.com/gold/Aion_Gold.html aion gold and PowerLeveling, more you choose, high http://www.mmoigold.com/gold/Tera_gold.html tera gold powerleveling you will get. Cheap www.mmoigold.com/gold/Dungeon_Fighter_Online.html dungeon fighter gold for Final fanstasy accounts on safe wirgold store http://www.mmoigold.com/gold/Eligium_Gold.html eligium gold, one more click to http://www.mmoigold.com/gold/Dragon_Nest.html dragon nest gold cheap, safe. Fast delivery and Low prices!

fafafa
fafafa Slovenia
4/23/2012 3:05:17 AM #

http://www.christianlouboutinukk.org   christian louboutin
http://www.tiffanyuks.org   tiffany uk
http://www.gucciukbeltuk.org   gucci belt
http://www.frsaclouisvuittonsac.com   louis vuitton sac
http://www.chanelukoutletuks.org   chanel outlet
http://www.burberryukoutletuk.org   burberry
http://www.poloralphlaurenuko.org   ralph lauren uk

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5