vishal malik

vishal malik

  • NA
  • 1
  • 1k

How i can count number of click on a particuler link???

Apr 25 2014 8:06 AM
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="mobile" >
<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. 
 

Answers (1)