Hi,
Re:I have table i want sorting for the columns but i tried and included some sorting plugin also.still it is throwing some errors.
in error console.
for same thing i want edit the records based on record(row) and delete the records based on record(row).
Timestamp: 10/9/2012 5:54:10 PM
Error: TypeError: $("#tbDetails").tablesorter is not a function
Source File: http://localhost:50976/User.aspx
Line: 52
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="User.aspx.cs" Inherits="FiSoftCustomerPortal.User" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<%----%>
<%----%>
<script src="Scripts/jquery-latest.js" type="text/javascript"></script>
<script src="Scripts/jquery.tablesorter.js" type="text/javascript"></script>
<script src="Scripts/jquery.tablesorter.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "User.aspx/BindDatatable",
data: "{}",
dataType: "json",
success: function (data) {
for (var i = 0; i < data.d.length; i++) {
$("#tbDetails").append("<tr><td>" + data.d[i].UserName + "</td><td>" + data.d[i].USerEmailID + "</td><td>" + data.d[i].Active + "</td><td>" + data.d[i].PhoneNumber + "</td></tr>");
}
},
error: function (result) {
alert("Error");
}
});
});
$(document).ready(function () {
$("#tbDetails").tablesorter();
}
);
$(document).ready(function () {
$("#tbDetails").tablesorter({ sortList: [[0, 0], [1, 0]] });
}
);
</script>
<style type="text/css">
.btn1
{
background: url("../images/btn_bg.gif") repeat-x scroll center top #015F92;
border: 1px solid #015F92;
border-radius: 3px 3px 3px 3px;
color: #FFFFFF;
cursor: pointer;
font-size: 12px;
font-weight: bold;
margin: 0;
padding: 5px 15px;
}
a
{
outline: medium none;
text-decoration: none;
}
.style1
{
width: 100%;
}
</style>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div class="full" id="main_body" align="center">
<div id="droppable">
<table class="style1">
<tr id="Tr1" align="center" runat="server">
<td>
</td>
<tr><td align="left" valign="top"> <asp:Button ID="btnNew" runat="server" Text="New..." onclick="btnNew_Click"
CssClass="btn1" /> <asp:Button ID="btnEdit"
runat="server" Text="Edit..." onclick="btnNew_Click"
CssClass="btn1" /> <asp:Button
ID="btndelete" runat="server" Text="Delete..." onclick="btnNew_Click"
CssClass="btn1" /></td></tr>
<tr align="center">
<td>
<table class="nrmltbl" id="tbDetails" cellpadding="0" cellspacing="3" border="0" style="border: medium groove #6699FF">
<thead style="border: medium groove #9999FF; background-color:#006699; color:White; font-weight:bold">
<tr style="border: medium ridge #000000">
<td>User Name</td>
<td>User EmaiID</td>
<td>Is Active</td>
<td>Phone Number</td>
</tr>
</thead>
<tbody>
</tbody>
</table></td></tr>
</table>
</div>
</div>
IN users.aspx.cs following code i done please check it and give me some suggestions.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Web.Services;
using System.Configuration;
using System.Collections;
using BusinessLayer;
namespace FiSoftCustomerPortal
{
public partial class User : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[WebMethod]
public static BLUsers[] BindDatatable()
{
Encryption clsencrypt = new Encryption();
DataSet ds = new DataSet();
DataTable dt = new DataTable();
List<blusers> details = new List<blusers>();
DataSet BindDs = new DataSet();
BLUsers bluser1 = new BLUsers();
BindDs = bluser1.BindtabletoUsers();
clsencrypt.decryptDataSet(BindDs);
dt = BindDs.Tables[0];
foreach (DataRow dtrow in dt.Rows)
{
BLUsers bluser = new BLUsers();
bluser.UserName = dtrow["User_Name"].ToString();
bluser.USerEmailID = dtrow["User_EmailID"].ToString();
bluser.Active = dtrow["Is_Active"].ToString();
bluser.PhoneNumber = dtrow["Phone_Number"].ToString();
details.Add(bluser);
}
return details.ToArray();
}
protected void btnNew_Click(object sender, EventArgs e)
{
Response.Redirect("ManageUser.aspx");
}
}
}