TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
avijit
NA
7
0
how can i code to print gridview data
Jan 2 2010 7:23 AM
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MehtaGroup.CivilApp.Library;
public partial class ViewSubmit : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
HtmlLink cssLink = new HtmlLink();
cssLink.Href = "CivilApp.css";
cssLink.Attributes.Add("rel", "stylesheet");
cssLink.Attributes.Add("type", "text/css");
Header.Controls.Add(cssLink);
grdJobHistory.RowDataBound += new GridViewRowEventHandler(grdJobHistory_RowDataBound);
Library lib = new Library();
DataTable dtjobHistory = lib.ViewSubmit("mehscl", "Rnv","02260");
if (dtjobHistory.Rows.Count > 0)
{
grdJobHistory.DataSource = dtjobHistory;
grdJobHistory.DataBind();
}
}
protected void grdJobHistory_RowDataBound(object sender, GridViewRowEventArgs e)
{
//if (e.Row.RowType == DataControlRowType.DataRow)
//{
// string sProbid = Convert.ToString(e.Row.Cells[0].Text);
// string sEmpCode = Convert.ToString(e.Row.Cells[1].Text);
// if (e.Row.Cells[9].Text == "")
// {
// HyperLink h1 = e.Row.FindControl("Hyperlink1") as HyperLink;
// string sUrl = "~/Submit.aspx";
// sUrl += "?Prob_id=" + sProbid.Trim();
// sUrl += "&empcode=" + sEmpCode.Trim(); ;
// h1.NavigateUrl = ResolveUrl(sUrl);
// }
//}
}
protected void grdJobHistory_PageIndexChanging(object sender, GridViewPageEventArgs e )
{
if (Convert.ToString(Request.QueryString["empcode"].ToString()) != "")
{
Library lib = new Library();
DataTable dtJobHistory = lib.ViewSubmit("Mehscl", "RNV", "02260");
if (dtJobHistory.Rows.Count > 0)
{
grdJobHistory.PageIndex = e.NewPageIndex;
grdJobHistory.DataSource = dtJobHistory;
grdJobHistory.DataBind();
}
else
{
lblNoRecordFound.CssClass = "Fail";
lblNoRecordFound.Text = "no data";
}
}
}
protected void btnLogout_Click(object sender, EventArgs e)
{
Response.Redirect("Login.aspx");
}
protected void btnOk_Click(object sender, EventArgs e)
{
Response.Redirect("Apply.aspx");
}
protected void lnkPrint_Click(object sender, EventArgs e)
{
string sEmpCode = Request.QueryString["empcode"].ToString();
Library lib = new Library();
DataTable dtJobHistory = null;
if (sEmpCode == "empcode")
{
dtJobHistory = lib.ViewSubmit("Mehscl", "RNV", "02260");
}
}
}
Reply
Answers (
2
)
how can i code to print gridview data in C#
insert to datagridview from Form2