J
John
Hi, Experts,
I have a problem that I could not solve and hope someone could shed some light on it. Here is what I need to do:
on my page, there is textbox that user can enter an orderID, a "Get USPS label" button user can click, another textbox that will contain USPS tracking number. I need to implement it that if user click on the "Get USPS label" button, a pdf of the usps label will come up, and the tracking number will be populated on the textbox.
In the Button_Click server-side code, I use the orderID to get information and call USPS API to get the label xml that contains tracking number and pdf encoded as base64 string. then I use the following code to output the pdf to user and assign the tracking number back to a textbox control:
Response.AddHeader("content-type", "application/pdf");
Resposne.AddHeader("content-disposition", "attachment; file=uspslabel.pdf");
byte[] pdfdata = Convert.FromBase64String(sPDF);
Response.BinaryWrite(pdfdata);
Response.Flush();
this.txtTrackingNumber.Text = "TrackingNumberFromUSPS";
The pdf will come back but the tracking number assignment never shows on the page. How can I solve this problem? Do I have to use javascript?
Thanks a lot!
John
I have a problem that I could not solve and hope someone could shed some light on it. Here is what I need to do:
on my page, there is textbox that user can enter an orderID, a "Get USPS label" button user can click, another textbox that will contain USPS tracking number. I need to implement it that if user click on the "Get USPS label" button, a pdf of the usps label will come up, and the tracking number will be populated on the textbox.
In the Button_Click server-side code, I use the orderID to get information and call USPS API to get the label xml that contains tracking number and pdf encoded as base64 string. then I use the following code to output the pdf to user and assign the tracking number back to a textbox control:
Response.AddHeader("content-type", "application/pdf");
Resposne.AddHeader("content-disposition", "attachment; file=uspslabel.pdf");
byte[] pdfdata = Convert.FromBase64String(sPDF);
Response.BinaryWrite(pdfdata);
Response.Flush();
this.txtTrackingNumber.Text = "TrackingNumberFromUSPS";
The pdf will come back but the tracking number assignment never shows on the page. How can I solve this problem? Do I have to use javascript?
Thanks a lot!
John