|
Hi,
Can any one tell me how to export data from gridview to pdf?
I have tried with the following piece of code:
Response.ClearContent();
Response.AddHeader("content-disposition", "attachment; filename=Report.pdf");
Response.ContentType = "application/pdf";
StringWriter objStrWriter = new StringWriter();
HtmlTextWriter objHtmlTxtWriter = new HtmlTextWriter(objStrWriter);
grdvwReport.RenderControl(objHtmlTxtWriter);
Response.Write(style); // Set the currency columns style
Response.Write(objStrWriter.ToString());
Response.End();
But while opening the pdf iam geeting the follwing message:
AdobeReader could not open 'Report[1].pdf' because it is either not a supported file type or because the file has been damaged.
Please try to help me...
Thanks in advance
Sumithra
|
|
|
|
|
|
Hi,
I have already tried with that code.But while opening iam getting the error. Is there any other way to convert data from gridview to pdf?
Thanks
|
|
|
|
|
Hi
i read the html code and html controls into one protected string, i put that server tag into html source. but my problem is i am not able to finding html controls . this is my code
For cnt = 0 To listofobj.Count - 1
If listofobj(cnt).MNU_Imgpath = "" Then
listofobj(cnt).MNU_Imgpath = "Noimg.jpg"
End If
Dim dupchk As Boolean = dupeliminate(listofobj(cnt).MNU_MenuID)
If dupchk = True Then
str &= ""
str &= "" & vbCrLf
str &= " " & vbCrLf
str &= listofobj(cnt).MNU_MenuName
str &= " " & vbCrLf
str &= " " & vbCrLf
End If
str &= "" & vbCrLf
str &= "" & vbCrLf
str &= " " & vbCrLf
str &= " " & vbCrLf
str &= "" & vbCrLf
str &= " " & vbCrLf
str &= " " & vbCrLf
str &= " " & vbCrLf
str &= " " & vbCrLf
str &= " " & vbCrLf
str &= " "
str &= " " & vbCrLf
str &= " " & vbCrLf
str &= " " & vbCrLf
str &= "" & vbCrLf
str &= " " & vbCrLf
str &= " | " & vbCrLf
str &= " " & vbCrLf
str &= " | " & vbCrLf
str &= " " & vbCrLf
str &= " " & listofobj(cnt).MNU_ItemName & "
" & vbCrLf
str &= " " & listofobj(cnt).MNU_Desc & "
" & vbCrLf
str &= " Item Availabale From" & listofobj(cnt).MNU_StartTime & " to " & vbCrLf
str &= " " & listofobj(cnt).MNU_EndTime & ""
str &= " | "
str &= " " & vbCrLf
str &= " Price:" & listofobj(cnt).MNU_Price & " " & vbCrLf
str &= " | " & vbCrLf
str &= " Quantity:" & vbCrLf
str &= " " & vbCrLf
str &= " 1" & vbCrLf
str &= " 2" & vbCrLf
str &= " 3" & vbCrLf
str &= " 4" & vbCrLf
str &= " 5" & vbCrLf
str &= " 6" & vbCrLf
str &= " 7" & vbCrLf
str &= " 8" & vbCrLf
str &= " 9" & vbCrLf
str &= " 10" & vbCrLf
str &= " 11" & vbCrLf
str &= " 12" & vbCrLf
str &= " 13" & vbCrLf
str &= " 14" & vbCrLf
str &= " 15" & vbCrLf
str &= " 16" & vbCrLf
str &= " 17" & vbCrLf
str &= " 18" & vbCrLf
str &= " 19" & vbCrLf
str &= " 20" & vbCrLf
str &= " " & vbCrLf
str &= " | " & vbCrLf
str &= " | " & vbCrLf
str &= ""
Next
this string results a grid view format table.
grid view not satisfy my requirement because i want full rows in middle.
the tag is running good showing the items properly. but when i click add the item to cart. i need to be find the html controls which i written in server tag. but i am not able to find it.
dim itemid as new htmlinputcheckbox
itemid = ctype(page.findcotrol("enabled0"),htmlinputcheckbox)
the itemid showing nothing eventhough i have that control....... why ???
is there any other procedure to find the dynamic html control rather than the page.findcontrols...........
example:
pizza
----------------------------------
pizzaimg1 description cost quantity
pizzaimg1 description cost quantity
pizzaimg2 description cost quantity
pizzaimg3 description cost quantity
salad
pizza
----------------------------------
salad1 description cost quantity
salad2 description cost quantity
salad3 description cost quantity
like so on ................
i am assigning the source as array list with generic list of(...)
Hope that any body help me...........
This is haneef.............................................................
This is haneef.............................................................
|
|
|
|
|
This is an absolute mess.
If you don't like how the grid view renders your data, try using a repeater, which allows you to format your data any way you like.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi
i read the html code and html controls into one protected string, i put that server tag into html source. but my problem is i am not able to finding html controls . this is my question
For cnt = 0 To listofobj.Count - 1
If listofobj(cnt).MNU_Imgpath = "" Then
listofobj(cnt).MNU_Imgpath = "Noimg.jpg"
End If
Dim dupchk As Boolean = dupeliminate(listofobj(cnt).MNU_MenuID)
If dupchk = True Then
str &= ""
str &= "" & vbCrLf
str &= " " & vbCrLf
str &= listofobj(cnt).MNU_MenuName
str &= " " & vbCrLf
str &= " " & vbCrLf
End If
str &= "" & vbCrLf
str &= "" & vbCrLf
str &= " " & vbCrLf
str &= " " & vbCrLf
str &= "" & vbCrLf
str &= " " & vbCrLf
str &= " " & vbCrLf
str &= " " & vbCrLf
str &= " " & vbCrLf
str &= " " & vbCrLf
str &= " "
str &= " " & vbCrLf
str &= " " & vbCrLf
str &= " " & vbCrLf
str &= "" & vbCrLf
str &= " " & vbCrLf
str &= " | " & vbCrLf
str &= " " & vbCrLf
str &= " | " & vbCrLf
str &= " " & vbCrLf
str &= " " & listofobj(cnt).MNU_ItemName & " " & vbCrLf
str &= " " & listofobj(cnt).MNU_Desc & " " & vbCrLf
str &= " Item Availabale From" & listofobj(cnt).MNU_StartTime & " to " & vbCrLf
str &= " " & listofobj(cnt).MNU_EndTime & ""
str &= " | "
str &= " " & vbCrLf
str &= " Price:" & listofobj(cnt).MNU_Price & " " & vbCrLf
str &= " | " & vbCrLf
str &= " Quantity:" & vbCrLf
str &= " " & vbCrLf
str &= " 1" & vbCrLf
str &= " 2" & vbCrLf
str &= " 3" & vbCrLf
str &= " 4" & vbCrLf
str &= " 5" & vbCrLf
str &= " 6" & vbCrLf
str &= " 7" & vbCrLf
str &= " 8" & vbCrLf
str &= " 9" & vbCrLf
str &= " 10" & vbCrLf
str &= " 11" & vbCrLf
str &= " 12" & vbCrLf
str &= " 13" & vbCrLf
str &= " 14" & vbCrLf
str &= " 15" & vbCrLf
str &= " 16" & vbCrLf
str &= " 17" & vbCrLf
str &= " 18" & vbCrLf
str &= " 19" & vbCrLf
str &= " 20" & vbCrLf
str &= " " & vbCrLf
str &= " | " & vbCrLf
str &= " | " & vbCrLf
str &= ""
Next
this string results a grid view format table.
grid view not satisfy my requirement because i want full rows in middle.
example:
pizza
----------------------------------
pizzaimg1 description cost quantity
pizzaimg1 description cost quantity
pizzaimg2 description cost quantity
pizzaimg3 description cost quantity
salad
pizza
----------------------------------
salad1 description cost quantity
salad2 description cost quantity
salad3 description cost quantity
like so on ................
i am assigning the source as array list with generic list of(...)
Hope that any body help me...........
This is haneef.............................................................
|
|
|
|
|
Hi,
We have a requirement for creating automated test scripts for an asp.net web application which in turn has many middleware calls which will be accessing Session objects.
Can anyone give us an idea of how to get Session related details when writing test scripts.(Authentication mode used is Windows). We are planning to use Nunit framework for writing test scripts. Database used for the project is SQL Server.
We got to know that HttpSessionState or HttpContext can be used for getting session details. But can anyone provide more details on how to use this.
Regards,
|
|
|
|
|
Hi,
I am in the midst of deciding whether to populate my treeview using XML or from database. Here is my scenario.
All my nodes are quite static, except one node.
This node is call Hand Book, the second level will be Company Name, then the third level would be the Sub-Category of the HandBook. Praticaly the Tree is to store HandBook from a few Company.
Example:
> Hand Book
--> XYZ Limited
----> Dress Code
----> Leave Entitlement
User usually will add, delete or update the Company Name node or the HandBook Sub-Category Node.
The HandBook Sub-Category Node when clicked, it should open using Microsoft Word. (Or should I open in aspx, because I was wondering would it be a problem that the system need to create a new aspx file whenever user add a new sub-category).
So, I need to know how to go about this either using XML or Database to populate the Treeview, need some guidance here on how do I populate it and the best way to populate the tree view.
Thanks in advance.
J Liang
J Liang
|
|
|
|
|
Is there any way to trace browser back button click, Please help me.
Thanks
Mohamed
|
|
|
|
|
You mean you wanna trace the history of how many time user click "Back" button?
Why do you wanna do that?
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Hi all,
When i installed the application on windows server 2003, all buttons (server control) didn't react when i clicked them. But when i installed the application on windows XP, the application was running nornally, everything was just fine.
I don't know what problem is. Did i miss something. Hope you help me to firgure it out.
Thanks so much
|
|
|
|
|
This is common problem. You need to enable the ASP.NET in IIS.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
I have setup a insert command that includes a dollar value like so:
VPODS.InsertCommandType = SqlDataSourceCommandType.Text
VPODS.InsertCommand = "INSERT INTO [VPO] ([OrderDate], [Project], [Supplies], [NoExceed])VALUES (@OrderDate, @Project, @Supplies, @NoExceed)"
VPODS.InsertParameters.Add("OrderDate", Now())
VPODS.InsertParameters.Add("Project", Project)
VPODS.InsertParameters.Add("Supplies", TypeCode.Boolean, Supplies)
VPODS.InsertParameters.Add("NoExceed", TypeCode.Decimal, NoExceed)
rowsAffected = VPODS.Insert()
It is posting to an Access DB and the NoExceed file is of DataType Dollar.
I get an error when I post and I know its the dollar field causing the problem. Got any suggestions?
Thanks for any help
|
|
|
|
|
williammcq wrote: VPODS.InsertParameters.Add("NoExceed", TypeCode.Decimal, NoExceed)
If the datatype of NoExceed is "Dollar", Why don't you use "Currency"?
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Currency is not a member of System.TypeCode
|
|
|
|
|
williammcq wrote:
VPODS.InsertCommandType = SqlDataSourceCommandType.Text
Why "SqlDataSourceCommandType"? Your database is MS Access??
williammcq wrote: I have setup a insert command that includes a dollar value like so:
VPODS.InsertCommandType = SqlDataSourceCommandType.Text
VPODS.InsertCommand = "INSERT INTO [VPO] ([OrderDate], [Project], [Supplies], [NoExceed])VALUES (@OrderDate, @Project, @Supplies, @NoExceed)"
VPODS.InsertParameters.Add("OrderDate", Now())
VPODS.InsertParameters.Add("Project", Project)
VPODS.InsertParameters.Add("Supplies", TypeCode.Boolean, Supplies)
VPODS.InsertParameters.Add("NoExceed", TypeCode.Decimal, NoExceed)
rowsAffected = VPODS.Insert()
It is posting to an Access DB and the NoExceed file is of DataType Dollar.
Why don't you use OleDb ff your database is MS Access?
OleDbType.Currency
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
I set up a string in the web.config file so I could use SQL because I would like to convert the client over to SQL in the future and don't want to rewrite every darn connection in the app. Make since?
|
|
|
|
|
I tried OleDbType.Currency() in place of TypeCode.Decimal and VWDE tells me its not declared.
I love your suggestions, I just wish I could get one of them to work. I appreciate your time.
Doe the fact that this is a Access DB and not a SQL DB causing a problem?
|
|
|
|
|
Maybe. you can try like that..
using System.Data.OleDb;
OleDbConnection dbConn = new OleDbConnection ("connectionstring");<br />
dbConn.Open ();<br />
OleDbCommand cmd = new OleDbCommand ();<br />
cmd.Connection = dbConn;<br />
cmd.CommandText = "INSERT INTO [VPO] ([OrderDate], [Project], [Supplies], [NoExceed])VALUES (@OrderDate, @Project, @Supplies, @NoExceed)";<br />
<br />
cmd.Parameters.Add("OrderDate", OleDbType.Date, Now());<br />
cmd.Parameters.Add("Project", Project);<br />
cmd.Parameters.Add ("Supplies", OleDbType.Boolean, Supplies);<br />
cmd.Parameters.Add("NoExceed", OleDbType.Currency , NoExceed); <br />
<br />
cmd.ExecuteNonQuery ();<br />
<br />
cmd.Dispose ();<br />
dbConn.Close ();
williammcq wrote:
Doe the fact that this is a Access DB and not a SQL DB causing a problem?
maybe. or may not be... AFAIK, we should use OleDb for MS Access Database and SqlClient for SQL Database. I didn't see any documentation mentioned that SqlClient should be used for Microsoft Access Database.
Hope it helps..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Here's the link that answers your comment on documentation for using SqlClient for a Microsoft Access Database.
http://msdn2.microsoft.com/en-us/library/hktw939c.aspx
|
|
|
|
|
I am trying to migrate my web application to Ajax, but i am encountering some problem
The first thing I would like to do is to make my menu bars collspable in an ajax style. Sort of like the XP windows explorer. The problem is that the main content of the page was not implemented with AJAX and as a results, many buttons will cost a post back and refreshes the page. As soon as the page is reset, the collipsable menu resets itself to initial state, not saving what was expended before.
I solved this problem using session, at the load of the collapsable control, it will read the session and determine what is being closed and not.
I am wondering if there are any change personalization can help me in this. and if not, what other way can be done
Thank you
|
|
|
|
|
I am assuming that by AJAX, you mean the Microsoft AJAX library, not AJAX itself. Otherwise, you'd be writing menus and so on. The fact is, the point of AJAX is that it doesn't do postbacks, so if you want to 'AJAX' a page, you need to change those buttons to make AJAX calls instead of posting back.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Yes, i know that Ajax doesnt do post backs, however, not all buttons in my application are Ajax enabled. As of now, i am only trying to migrate the menu to Ajax, so, clicking on any button not on the menu will do a post back
|
|
|
|
|
Please help me, I share some multimedia files over IIS website in local area. but every type of files are working except .DAT & .VOB extention. I put MP3, WMV, MPG, DAT, VOB files but upon clicking on link the browser shows that site not found but when clicking on MP3 or other files then the link works. I will be grateful if someone help me.
Julian
|
|
|
|
|
You have to register the mime type with IIS. To do this go to Admistrative Tools -> IIS Manager click on the computer and select Mime Types. Add the mimetypes for .DAT and .VOB.
Refer to the screenshot below:
MimeTypes.gif (37.9 Kb)
|
|
|
|