Click here to Skip to main content
11,584,455 members (63,854 online)
   

C#

 
Questionwhat is the meaning of this? Syntax error in UPDATE statement. Pin
kruczynski12316-Mar-13 18:43
memberkruczynski12316-Mar-13 18:43 
AnswerRe: what is the meaning of this? Syntax error in UPDATE statement. Pin
PIEBALDconsult16-Mar-13 19:23
memberPIEBALDconsult16-Mar-13 19:23 
AnswerRe: what is the meaning of this? Syntax error in UPDATE statement. Pin
Richard MacCutchan16-Mar-13 22:11
mvpRichard MacCutchan16-Mar-13 22:11 
AnswerRe: what is the meaning of this? Syntax error in UPDATE statement. Pin
OriginalGriff16-Mar-13 22:54
mvpOriginalGriff16-Mar-13 22:54 
GeneralRe: what is the meaning of this? Syntax error in UPDATE statement. Pin
PIEBALDconsult17-Mar-13 10:45
memberPIEBALDconsult17-Mar-13 10:45 
AnswerRe: what is the meaning of this? Syntax error in UPDATE statement. Pin
Abhinav S18-Mar-13 6:37
mvpAbhinav S18-Mar-13 6:37 
QuestionConnection between two forms in a project Pin
coolvibhu16-Mar-13 6:18
membercoolvibhu16-Mar-13 6:18 
AnswerRe: Connection between two forms in a project Pin
ThePhantomUpvoter16-Mar-13 6:36
memberThePhantomUpvoter16-Mar-13 6:36 
AnswerRe: Connection between two forms in a project Pin
OriginalGriff16-Mar-13 6:40
mvpOriginalGriff16-Mar-13 6:40 
QuestionListBox datasource is not updated on first click Pin
zulfakar16-Mar-13 3:24
memberzulfakar16-Mar-13 3:24 
AnswerRe: ListBox datasource is not updated on first click Pin
Jegan Thiyagesan16-Mar-13 13:31
memberJegan Thiyagesan16-Mar-13 13:31 
GeneralRe: ListBox datasource is not updated on first click Pin
zulfakar17-Mar-13 8:24
memberzulfakar17-Mar-13 8:24 
GeneralRe: ListBox datasource is not updated on first click Pin
Jegan Thiyagesan18-Mar-13 3:50
memberJegan Thiyagesan18-Mar-13 3:50 
QuestionExporting Gridview with fixed number of rows on each page Pin
AlexRusso16-Mar-13 1:18
memberAlexRusso16-Mar-13 1:18 
Hello everyone,

I need to export gridview data in pdf where suppose i have 50 records...so first 10 records should come in 1st page...next 11 to 20 in next page...so on..

here is my code:

StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);

StringReader sr = new StringReader(sw.ToString());


Document document = new Document(PageSize.A4, 0, 0, 50, 50);

HTMLWorker htmlparser = new HTMLWorker(document);

PdfWriter writer = PdfWriter.GetInstance(document, Response.OutputStream);
document.Open();
htmlparser.Parse(sr);

iTextSharp.text.Table datatable = new iTextSharp.text.Table(columns, tableRows);
datatable.BorderWidth = 1;
datatable.BorderColor = new Color(0, 0, 255);
datatable.Cellpadding = 3;
datatable.Cellspacing = 3;


String strConnString = System.Configuration.ConfigurationManager.ConnectionStrings["conString"].ConnectionString;
SqlConnection con = new SqlConnection(strConnString);



Cell c2 = new Cell(this.GridView1.Columns[0].HeaderText);
datatable.AddCell(c2);
datatable.AddCell(this.GridView1.Columns[1].HeaderText);
datatable.AddCell(this.GridView1.Columns[2].HeaderText);
datatable.AddCell(this.GridView1.Columns[3].HeaderText);

for (int rowCounter = 0; rowCounter < rows; rowCounter++)
{


for (int columnCounter = 0; columnCounter < columns; columnCounter++)
{

string strValue = GridView1.Rows[rowCounter].Cells[1].Text;
datatable.AddCell(strValue);

}
if (rowCounter > 0)
{
document.Add(datatable);
document.NewPage();
}



}

document.Close();
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment; filename=GridViewwithPagebreak.pdf");
Response.Write(document);
Response.End();


anyone have idea...how to do that?? what changes i have to make??
AnswerRe: Exporting Gridview with fixed number of rows on each page Pin
Eddy Vluggen16-Mar-13 12:06
mvpEddy Vluggen16-Mar-13 12:06 
GeneralRe: Exporting Gridview with fixed number of rows on each page Pin
AlexRusso18-Mar-13 0:57
memberAlexRusso18-Mar-13 0:57 
GeneralRe: Exporting Gridview with fixed number of rows on each page Pin
Eddy Vluggen18-Mar-13 1:29
mvpEddy Vluggen18-Mar-13 1:29 
QuestionFilesystemwatcher causes exception. Pin
leone15-Mar-13 6:32
memberleone15-Mar-13 6:32 
AnswerRe: Filesystemwatcher causes exception. Pin
Jibesh15-Mar-13 6:53
memberJibesh15-Mar-13 6:53 
GeneralRe: Filesystemwatcher causes exception. Pin
leone15-Mar-13 11:03
memberleone15-Mar-13 11:03 
GeneralRe: Filesystemwatcher causes exception. Pin
Jibesh15-Mar-13 11:09
memberJibesh15-Mar-13 11:09 
GeneralRe: Filesystemwatcher causes exception. Pin
Dave Kreskowiak15-Mar-13 12:44
mvpDave Kreskowiak15-Mar-13 12:44 
AnswerRe: Filesystemwatcher causes exception. Pin
Eddy Vluggen15-Mar-13 7:47
mvpEddy Vluggen15-Mar-13 7:47 
QuestionC# file exists on network drive Pin
classy_dog15-Mar-13 2:44
memberclassy_dog15-Mar-13 2:44 
AnswerRe: C# file exists on network drive Pin
s_magus15-Mar-13 3:07
members_magus15-Mar-13 3:07 
GeneralRe: C# file exists on network drive Pin
Richard MacCutchan15-Mar-13 7:19
mvpRichard MacCutchan15-Mar-13 7:19 
GeneralRe: C# file exists on network drive Pin
Eddy Vluggen15-Mar-13 7:48
mvpEddy Vluggen15-Mar-13 7:48 
GeneralRe: C# file exists on network drive Pin
Richard MacCutchan15-Mar-13 7:56
mvpRichard MacCutchan15-Mar-13 7:56 
GeneralRe: C# file exists on network drive Pin
Eddy Vluggen15-Mar-13 8:07
mvpEddy Vluggen15-Mar-13 8:07 
AnswerRe: C# file exists on network drive Pin
Richard MacCutchan15-Mar-13 7:28
mvpRichard MacCutchan15-Mar-13 7:28 
GeneralRe: C# file exists on network drive Pin
classy_dog15-Mar-13 8:28
memberclassy_dog15-Mar-13 8:28 
QuestionIf existing String Form name, get that by database then open Pin
Jayantha Bandara15-Mar-13 0:37
memberJayantha Bandara15-Mar-13 0:37 
AnswerRe: If existing String Form name, get that by database then open Pin
Richard MacCutchan15-Mar-13 1:02
mvpRichard MacCutchan15-Mar-13 1:02 
AnswerRe: If existing String Form name, get that by database then open Pin
Pete O'Hanlon15-Mar-13 1:12
protectorPete O'Hanlon15-Mar-13 1:12 
GeneralRe: If existing String Form name, get that by database then open Pin
V.15-Mar-13 3:44
memberV.15-Mar-13 3:44 
GeneralRe: If existing String Form name, get that by database then open Pin
Mycroft Holmes15-Mar-13 13:39
memberMycroft Holmes15-Mar-13 13:39 
QuestionResolving dependent projects Pin
Bernhard Hiller15-Mar-13 0:15
memberBernhard Hiller15-Mar-13 0:15 
AnswerRe: Resolving dependent projects Pin
Pete O'Hanlon15-Mar-13 1:38
protectorPete O'Hanlon15-Mar-13 1:38 
Questionsubstring from form1 to form2.... Pin
Goaty6510914-Mar-13 17:15
memberGoaty6510914-Mar-13 17:15 
AnswerRe: substring from form1 to form2.... Pin
Jibesh14-Mar-13 17:35
memberJibesh14-Mar-13 17:35 
GeneralRe: substring from form1 to form2.... Pin
Goaty6510914-Mar-13 18:57
memberGoaty6510914-Mar-13 18:57 
QuestionBlueTooth Bytes Disappearing Pin
C-P-User-314-Mar-13 13:03
memberC-P-User-314-Mar-13 13:03 
QuestionView in Nhibernate Pin
hadi_ganji14-Mar-13 6:06
memberhadi_ganji14-Mar-13 6:06 
AnswerRe: View in Nhibernate - Repost Pin
Richard MacCutchan14-Mar-13 6:24
mvpRichard MacCutchan14-Mar-13 6:24 
QuestionUnable to set registry value Pin
sjs4u13-Mar-13 21:27
membersjs4u13-Mar-13 21:27 
AnswerRe: Unable to set registry value Pin
dusty_dex14-Mar-13 5:07
memberdusty_dex14-Mar-13 5:07 
QuestionHow to use CreateTextServices in C# Pin
cpw999cn13-Mar-13 20:32
membercpw999cn13-Mar-13 20:32 
AnswerRe: How to use CreateTextServices in C# Pin
Bernhard Hiller13-Mar-13 22:01
memberBernhard Hiller13-Mar-13 22:01 
GeneralRe: How to use CreateTextServices in C# Pin
cpw999cn13-Mar-13 22:40
membercpw999cn13-Mar-13 22:40 
QuestionC# Receive from TCP send to COM2 Pin
dockwomblejr13-Mar-13 11:55
memberdockwomblejr13-Mar-13 11:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.150603.1 | Last Updated 7 Jul 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid