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
S Balaji
NA
72
1.3k
Export pdf user details using id in gridview print button
May 16 2018 3:13 AM
Hi I had a gridview page which it contains the users id,fname,lname and five more things. Secondly i had created a view button in each row to redirect to another page called detail page, to view the details of the particular user. Thirdly my requirement is i need one more button called print button so that the detail items to print as pdf with logo, footer, header to be inside the pdf page. I watch the link https://www.aspsnippets.com/Articles/Create-PDF-Report-from-database-in-ASPNet-using-C-and-VBNet.aspx
its covering my thoughts but not i exactly want, (I am new for the asp.net) and my code
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!
this
.IsPostBack)
{
BindGridView();
}
}
private
void
BindGridView()
{
string
constr = ConfigurationManager.ConnectionStrings[
"constr"
].ConnectionString;
SqlConnection con =
new
SqlConnection(constr);
SqlCommand cmd =
new
SqlCommand(
"select * from details"
, con);
DataTable dt =
new
DataTable();
SqlDataAdapter da =
new
SqlDataAdapter(cmd);
da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
protected
void
GridView1_RowCommand(
object
sender, GridViewCommandEventArgs e)
{
if
(e.CommandName ==
"EditButton"
)
{
int
index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = GridView1.Rows[index];
Response.Redirect(
"~/SD/EditView.aspx?EmpNo="
+ row.Cells[0].Text);
}
if
(e.CommandName ==
"PrintButton"
)
{
int
index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = GridView1.Rows[index];
}
}
need help.
Thanks.
Reply
Answers (
1
)
How to bind treeview with checkbox and click to parent node?
how to configured application on IIS.