Html File
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="user_info.aspx.cs" Inherits="jQueryUploadTest.user_info" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link href="css/img/StyleSheet.css" rel="stylesheet" />
<script src="js/jquery-1.4.1.min.js"></script>
<script src="js/jquery.dynDateTime.min.js"></script>
<script src="js/calendar-en.min.js"></script>
<link href="css/calendar-blue.css" rel="stylesheet" />
<title>Uploaded Files</title>
<script type="text/javascript">
jQuery(document).ready(function () {
jQuery("#createdOn").dynDateTime({
showsTime: true,
ifFormat: "%d/%m/%Y ",
daFormat: " %p, %m, %Y",
align: "TL",
electric: false,
singleClick: false,
displayArea: ".siblings('.dtcDisplayArea')",
button: ".next()"
});
});
</script>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style2 {
width: 147px;
height: 61px;
}
.auto-style3 {
width: 124px;
height: 61px;
}
.auto-style5 {
width: 147px;
height: 24px;
}
.auto-style6 {
width: 124px;
height: 24px;
}
.auto-style8 {
height: 24px;
width: 518px;
}
.auto-style9 {
width: 175px;
height: 24px;
}
.auto-style10 {
width: 175px;
height: 61px;
}
.auto-style11 {
height: 61px;
width: 518px;
}
</style>
</head>
<body>
<form runat="server" style="width: 569px">
<table class="auto-style1">
<tr>
<td class="auto-style5">FileName</td>
<td class="auto-style6">FileInformation</td>
<td class="auto-style9">CreatedOn</td>
<td class="auto-style8">StatusName</td>
</tr>
<tr>
<td class="auto-style2">
<asp:TextBox ID="fileName" runat="server" AutoPostBack="true" Width="100px" Font-Size="11px" OnTextChanged="getId" ></asp:TextBox>
</td>
<td class="auto-style3">
<asp:TextBox ID="fileType" runat="server" AutoPostBack="true" Width="100px" Font-Size="11px" OnTextChanged="getId" ></asp:TextBox>
</td>
<td class="auto-style10">
<asp:TextBox ID="createdOn" runat="server" AutoPostBack="true" Width="100px" Font-Size="11px" Height="16px" OnTextChanged="createdOn_TextChanged"></asp:TextBox>
<button id="datePick" type="button" style="height: 43px; width: 38px;background-image:url(image\calendar.png)" ></button>
</td>
<td class="auto-style11">
<asp:DropDownList ID="ddlstatusName" runat="server" AutoPostBack="True" Width="100px" Font-Size="11px" OnSelectedIndexChanged="ddlstatusName_SelectedIndexChanged">
<asp:ListItem>completed</asp:ListItem>
<asp:ListItem>success</asp:ListItem>
<asp:ListItem>pending</asp:ListItem>
<asp:ListItem>progressing</asp:ListItem>
<asp:ListItem>yet to start</asp:ListItem>
<asp:ListItem>failure</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
<br />
<br />
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" EnableSortingAndPagingCallbacks="True" OnRowDataBound="GridView1_RowDataBound1">
</asp:GridView>
<br />
</form>
</body>
</html>
code Behind File
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Net.Mail;
using System.Drawing;
namespace jQueryUploadTest
{
public partial class user_info : System.Web.UI.Page
{
int i = 0;
SqlDataAdapter da;
DataTable table;
DataSet ds = new DataSet();
SqlConnection Connection = new SqlConnection("Data Source=.;Initial Catalog=printapp_apr_2;Integrated Security=True");
string keyid;
string statusId;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindData();
}
}
private void BindData()
{
try
{
string key = Session["email"].ToString();
string query = "select f.fileName,(f.fileType + Char(13) + f.fileSize)as fileInfo,f.createdOn,f.statusId,s.statusName from fileInfo As f left join status As s on f.statusId=s.statusId where userId=(select userId from userInfo where email ='" + key + "')";
da = new SqlDataAdapter(query, Connection);
table = new DataTable();
GridView1.DataSource = table;
GridView1.EnableViewState = true;
GridView1.AllowPaging = true;
GridView1.PageSize = 4;
GridView1.DataBind();
GridView1.EnableSortingAndPagingCallbacks = true;
da.Fill(table);
GridView1.DataBind();
}
catch(Exception ex)
{
}
}
public void getId(object sender, EventArgs e)
{
string FormatOption = ((TextBox)sender).ID;
string FormatText = ((TextBox)sender).Text;
Connection.Open();
string qury = "select f.fileName,(f.fileType + '' + f.fileSize)as fileInfo,f.createdOn,f.statusId,s.statusName from fileInfo As f left join status As s on f.statusId=s.statusId where " + FormatOption + " like '" + FormatText + "%" + "'";
SqlCommand cmd = new SqlCommand(qury, Connection);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}
protected void info_Sorting(object sender, GridViewSortEventArgs e)
{
switch (e.SortExpression)
{
case "Melder":
if (e.SortDirection == SortDirection.Ascending)
{
GridView1.DataBind();
}
else
{
GridView1.DataBind();
}
break;
}
}
protected void GridView1_RowDataBound1(object sender, GridViewRowEventArgs e)
{
try
{
if (i > 0 && e.Row.Cells[3].Text != " ")
{
Connection.Open();
SqlCommand Command1 = Connection.CreateCommand();
Command1.CommandText = "select statusColor, statusName from status where statusId=" + e.Row.Cells[3].Text;
SqlDataReader reader = Command1.ExecuteReader();
while (reader.Read())
{
e.Row.BackColor = System.Drawing.ColorTranslator.FromHtml(reader[0].ToString());
}
}
i++;
e.Row.Cells[3].Visible = false;
Connection.Close();
}
catch (Exception ex)
{
}
}
protected void ddlstatusName_SelectedIndexChanged(object sender, EventArgs e)
{
string statusName = ddlstatusName.SelectedItem.Text;
string query = "select f.fileName,(f.fileType + '' + f.fileSize)as fileInfo,f.createdOn,f.statusId,s.statusName from fileInfo As f left join status As s on f.statusId=s.statusId where statusName = '" + statusName + "'";
SqlCommand comd = new SqlCommand(query, Connection);
SqlDataAdapter da1 = new SqlDataAdapter(comd);
DataSet ds1 = new DataSet();
da1.Fill(ds1);
GridView1.DataSource = ds1;
GridView1.DataBind();
}
protected void createdOn_TextChanged(object sender, EventArgs e)
{
Connection.Open();
string s = createdOn.Text;
BindData();
DataView rd = new DataView(table);
string SearchRegdate = null;
if (!String.IsNullOrEmpty(s))
{
SearchRegdate = string.Format("{0} '%{1}%'", GridView1.SortExpression, s);
}
rd.RowFilter = "Convert(createdOn,System.String) like " + SearchRegdate;
da.Fill(ds);
GridView1.DataSource = rd;
GridView1.DataBind();
Connection.Close();
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndexChanging += new GridViewPageEventHandler(GridView1_PageIndexChanging);
}
}
}
it cannot able to dispaly in the second page in gridview...