Click here to Skip to main content
15,914,820 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
XML
my Aspx page...

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Search.aspx.cs" Inherits="Search" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type ="text/javascript">
function Demand(regid) {
window.open("CustomerReport.aspx?Id=" + regid, 'Define', 'width=1000,height=600,left=0,top=0,scrollbars=yes,resizable=yes,menubar=yes');
}
</script>
<style type="text/css">
.style1
{
width: 100%;
border: 1px solid #000000;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div style="background:url(sweet3.jpg) no-repeat; background-size:cover; width:100%; height:678px; margin-top: 0px;">
<div style="height: 127px; width: 463px; margin-left:50px; padding-top:100px">
<table class="style1">
<tr>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
&nbsp;</td>
<td>
<asp:Label ID="Label1" runat="server" Text="Mobile Number"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
<td>
<asp:Button ID="Button1" runat="server" style=" float:left" Text="Search"
onclick="Button1_Click" />
<asp:Button ID="Button2" runat="server" style=" float:right" Text="clear"
onclick="Button2_Click" />
</td>
<td>
&nbsp;</td>
</tr>
</table>
</div>

<div style="height:auto; width:auto; margin-left:20px; padding-top:100px">

<asp:GridView ID="gvDetails" runat="server" AutoGenerateColumns="False" AllowPaging="False"
AllowSorting="true" DataSourceID="dsDetails" Width="100%" class="grid-bg"  DataKeyNames="name" >
<HeaderStyle BackColor="#df5015" />
<Columns>

<asp:TemplateField HeaderText="Mobile">
<ItemTemplate>
<asp:Label ID="Customerid" Text='<%# HighlightText(Eval("mobile").ToString()) %>' runat="server"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Address">
<ItemTemplate>
<asp:Label ID="lblCID" Text='<%# Eval("address") %>' runat="server"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<%--<asp:Label ID="Email" Text='<%# Eval("Email") %>' runat="server"/>--%>
<asp:HyperLink ID="HyperLink1" runat="server" style=" color:Blue"
Text='<%# Eval("name") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Last Order Date">
<ItemTemplate>
<asp:Label ID="lblFname" Text='<%# Eval("lastdate") %>' runat="server"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Last Order Status">
<ItemTemplate>
<asp:Label ID="lblLastStatus" Text='<%#Eval("status") %>' runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cancel due to">
<ItemTemplate>
<asp:Label ID="lblcustomertype" Text='<%# Eval("cancel") %>' runat="server"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Remark">
<ItemTemplate>
<asp:Label ID="lblcustomerCategory" Text='<%# Eval("remark") %>' runat="server"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<a href="#" id="lnkdetailbtn" onclick="Demand('<%# DataBinder.Eval(Container,"DataItem.mobile") %>');" btn_Click class="left" >Show Details</a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

</div>
<asp:SqlDataSource ID="dsDetails" runat="server" ConnectionString="<%$ConnectionStrings:conn %>" SelectCommand="select * from Sheet1$" FilterExpression="name LIKE '%{0}%' " >
<FilterParameters>
<asp:ControlParameter Name="mobile" ControlID="txtSearch" PropertyName="Text" />
</FilterParameters>
</asp:SqlDataSource>
</div>
</form>
</body>
</html>

Coding page..


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.Data.SqlClient;
using System.Text.RegularExpressions;

public partial class Search : System.Web.UI.Page
{
private string SearchString = "";
protected void Page_Load(object sender, EventArgs e)
{

}
public string HighlightText(string InputTxt)
{
string Search_Str = txtSearch.Text;
// Setup the regular expression and add the Or operator.
Regex RegExp = new Regex(Search_Str.Replace(" ", "|").Trim(), RegexOptions.IgnoreCase);
// Highlight keywords by calling the
//delegate each time a keyword is found.
return RegExp.Replace(InputTxt, new MatchEvaluator(ReplaceKeyWords));
}

public string ReplaceKeyWords(Match m)
{
return ("<span class=highlight>" + m.Value + "</span>");
}
protected void Button1_Click(object sender, EventArgs e)
{
SearchString = txtSearch.Text;
}
protected void Button2_Click(object sender, EventArgs e)
{
txtSearch.Text = "";
SearchString = "";
gvDetails.DataBind();
}
}


i want to know how i can find out that how many time a person click on show detail link.. plz help me out.. its really urgent.. plz plz.
Posted
Comments
Thanks7872 25-Apr-14 8:37am    
The question has nothing to do with this dump of code. Please remove the unnecessary code blocks in order to get solution.
Member 10236993 25-Apr-14 8:40am    
okthanx for your concern
Member 10236993 25-Apr-14 8:56am    
i have submitted my full page coding.. so that there is no problem for anyone to understand..
so plz dont make issue of long coding..

1 solution

A quick search on Google[^], gives us About 12,40,00,000 results (0.39 seconds).

Please try something and come back on Code Project with a specific Question.
 
Share this answer
 
Comments
Member 10236993 25-Apr-14 9:32am    
very funny..
Not funny. I guess you don't see the tagline of Code Project, which says "For those who code".

So, code something. If you find issues, come back and ask questions.

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