selvi subramanian

selvi subramanian

  • NA
  • 799
  • 570.9k

its not working but there is no error

May 15 2014 1:48 AM
my source code 
<%@ Page Language="C#" MasterPageFile="~/MasterPage/Employe.master" AutoEventWireup="true" CodeFile="Attendance.aspx.cs" Inherits="Employee_Attendance" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">
.style1
{
width: 100%;
}
</style>
</asp:Content>
<asp:Content ID="Content8" runat="server" contentplaceholderid="Header_Menu"> <div id="example">
<ul id="na">
<li class="current"><a href="../Admin/Login.aspx">Registration</a></li>
<li><a href="#">Report</a>
<ul>
<li><a href="../Admin/Day Sales.aspx">Sales</a></li>
<li><a href="../Admin/SectionWiseSales.aspx">Purchas</a></li>
<li><a href="#">Purchase</a></li>
</ul>
</li>
<li><a href="#">Help</a>
</li>
</ul>
</div>
</asp:Content>
<asp:Content ID="Content9" runat="server" contentplaceholderid="HeaderBar">
<div id="BrownHeaderContent">
<div id="BrownHeader">
<br />
</div>
</div>
</asp:Content>
<asp:Content ID="Content12" runat="server" contentplaceholderid="ContentReport">
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.0.min.js" type="text/javascript"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.9.2/jquery-ui.min.js" type="text/javascript"></script>
<link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.9.2/themes/blitzer/jquery-ui.css" rel="Stylesheet" type="text/css" />
<script type="text/javascript">
$(function () {
$("[id*=ctl00_ContentReport_TextBox2]").autocomplete({
source: function (request, response) {
$.ajax({
url: 'Attendance.aspx/GetAutoCompleteData',
data: "{ 'prefix': '" + request.term + "'}",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
success: function (data) {
if (data.d.length > 0) {
response($.map(data.d, function (item) {
return {
label: item.split('-')[0],
val: item.split('-')[1]
};
}))
} else {
response([{ label: 'No results found.', val: -1}]);
}
}
});
},
select: function (e, u) {
if (u.item.val == -1) {
return false;
}
}
});
});
</script>
<script type="text/javascript">
$(function () {
$("[id*=ctl00_ContentReport_TextBox1]").autocomplete({
source: function (request, response) {
$.ajax({
url: 'Attendance.aspx/CompleteData',
data: "{ 'prefix': '" + request.term + "'}",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
success: function (data) {
if (data.d.length > 0) {
response($.map(data.d, function (item) {
return {
label: item.split('-')[0],
val: item.split('-')[1]
};
}))
} else {
response([{ label: 'No results found.', val: -1}]);
}
}
});
},
select: function (e, u) {
if (u.item.val == -1) {
return false;
}
}
});
});
</script>
<form id="form1" runat="server">
<table class="style1" align="center" style="border: thin outset #1d599e; width: 34%; margin-left: 0px;">
<tr>
<td style="margin-left: 80px; background:#1d599e;" colspan="2" align="center">
<asp:Label ID="Label22" runat="server" Text="Attendance" Style="color: #FFFFFF;
font-size: large; font-weight: 700; text-align: center;" class="style10"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Name"></asp:Label> &nbsp;</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="Status"></asp:Label>&nbsp;</td>
<td>
<asp:RadioButton ID="Present" runat="server" Text="Present" />
<asp:RadioButton ID="Absent" runat="server" Text="Absent" />
&nbsp;</td>
</tr>
<tr>
<td>
<asp:Label ID="Label3" runat="server" Text="Section"></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
&nbsp;</td>
<td>
<asp:ImageButton ID="ImageButton1" runat="server"
ImageUrl="~/Images/enter_button.png" Width="69px" />
</td>
</tr>
</table>
</form>
</asp:Content>
<asp:Content ID="Content13" runat="server"
contentplaceholderid="ContentPlaceHolder1">
<p>
&nbsp;</p>
<p>
&nbsp;</p>
<p>
&nbsp;</p>
<p>
&nbsp;</p>
<p>
&nbsp;</p>
<p>
&nbsp;</p>
<p>
<br />
</p>
</asp:Content>
my code part is
 
 
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data.SqlClient;
using System.Drawing;
using System.Web.Services;
using System.Text;
public partial class Employee_Attendance : System.Web.UI.Page
{
//string constr = ConfigurationManager.AppSettings["s"].ToString();
//[System.Web.Services.WebMethod]
//[System.Web.Script.Services.ScriptMethod()]
protected void Page_Load(object sender, EventArgs e)
{
}
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod()]
public static string[] CompleteData(string prefix)
{
string constr = ConfigurationManager.AppSettings["s"].ToString();
List<string> resultt = new List<string>();
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("select DISTINCT Name from EmpReg where " + "Name like @SearchText + '%'", con))
{
cmd.Parameters.AddWithValue("@SearchText", prefix);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
resultt.Add(dr["Name"].ToString());
}
con.Close();
}
return resultt.ToArray();
}
}
public static string[] GetAutoCompleteData(string prefix)
{
string constr = ConfigurationManager.AppSettings["s"].ToString();
List<string> result = new List<string>();
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("select DISTINCT Section from EmpReg where " + "Section like @SearchText + '%'", con))
{
cmd.Parameters.AddWithValue("@SearchText", prefix);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
result.Add(dr["Section"].ToString());
}
con.Close();
}
return result.ToArray();
}
}
}
 
 

Answers (1)