|
|
use template field and in template field use image control
|
|
|
|
|
Hello Friends,
Urgent help required...
I am developing a Web Application using ASP.Net 2.0 and C#, my data base is ORACLE 9i. Previously everything was going right, but now as the data increases and the retrieving is become headache for me. Previously i was showing this data in the third party grid i.e. FARPOINT Spread. It happens with the spread too. so i write a program to convert the Generic List into excel sheet. This works fine on local (XP Professional 2 GB RAM and all) but once i deployed this application on the server (Win server 2003 12 GB RAM with 3GB Virtual Memory set and 500 GB HDD) it gives me error that 'System.OutOfMemoryException'.
I checked that data is coming till UI layer from Business layer but still why it is throwing error. Couldn't make it out. And i need solution for this ASAP.
Currently trying to write this fetched data in Excel sheet by using following code block.
Thanks in advance.
Code to write excel sheet -
private void FpLoadEditData(ArrayList userName, ArrayList siteId, string from, string to)
{
oXL = new Application();
oXL.Visible = false;
//Get a new workbook.
oWB = (_Workbook)(oXL.Workbooks.Add(System.Reflection.Missing.Value));
oSheet = (_Worksheet)oWB.ActiveSheet;
//System.Data.DataTable dtGridData = ds.Tables[0];
int iRow = 2;
// Setting Column name for Sheet
int colCount = QiSpread.ActiveSheetView.Columns.Count;
int colHeaderIndex = 1;
for (int j = 0; j < colCount; j++)
{
oSheet.Cells[1, j + 1] = ConfigurationSettings.AppSettings["colHead" + colHeaderIndex];
colHeaderIndex++;
}
for (int rowNo = 0; rowNo < vzmLst.Count; rowNo++)
{
//if (rowNo < 150)
//{
for (int colNo = 0; colNo < QiSpread.ActiveSheetView.ColumnCount; colNo++)
{
PopulateSheet(oSheet, iRow, colNo, vzmLst[rowNo]);
}
iRow++;
//}
//else
// rowNo = vzmLst.Count;
}
if (vzmLst.Count > 6000)
Session.Timeout = 15;
oRng = oSheet.get_Range("A1", "IV1");
oRng.EntireColumn.AutoFit();
oXL.Visible = false;
oXL.UserControl = false;
string strFile = string.Empty;
if (Request.Params.Get("__EVENTARGUMENT") != null &&
Request.Params.Get("__EVENTARGUMENT").ToString().ToUpper().Equals("EDITDATA"))
{
strFile = "VzMEditData_" + loginName + from + "TO" + to + "_" + DateTime.Now.Second.ToString() + ".xls";
//strFile = "VzMEditData" + from, to DateTime.Now.Ticks.ToString() + ".xls";
}
else if (Request.Params.Get("__EVENTARGUMENT") != null &&
Request.Params.Get("__EVENTARGUMENT").ToString().ToUpper().Equals("VIEWDATA"))
{
strFile = "VzMViewData_" + loginName + from + "TO" + to + "_" + DateTime.Now.Second.ToString() + ".xls";
}
//string strFile = "report" + DateTime.Now.Ticks.ToString() + ".xls";//+
oWB.SaveAs(strCurrentDir + strFile, XlFileFormat.xlWorkbookNormal, null, null, false, false, XlSaveAsAccessMode.xlShared, false, false, null, null, null);
// Need all following code to clean up and remove all references!!!
oWB.Close(null, null, null);
oXL.Workbooks.Close();
oXL.Quit();
Marshal.ReleaseComObject(oRng);
Marshal.ReleaseComObject(oXL);
Marshal.ReleaseComObject(oSheet);
Marshal.ReleaseComObject(oWB);
Session.Add("fileUrl", strFile);
}
To display the generated excel -
private void GetExcel()
{
if (Session["fileUrl"] != null && Session["fileUrl"].ToString() != string.Empty)
{
Response.ContentType = "application/vnd.ms-excel";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + Session["fileUrl"].ToString());
Response.TransmitFile(Server.MapPath(".") + "\\EditViewDataFiles\\" + Session["fileUrl"].ToString());
HttpContext.Current.ApplicationInstance.CompleteRequest();
Response.Flush();
Response.Close();
}
}
Regards,
Abhijeet
|
|
|
|
|
As far as I can see this has loaded in all the data into the memory before processing it. Perhaps you need to load the data in in small chunks, process each chunck then move on to the next chunk.
|
|
|
|
|
Also, you can change the amount of memory that the application pool can use in IIS. You can also up the number of worker processes an app pool can use.
Can you use a data reader instead of a datagrid?
I didn't get any requirements for the signature
|
|
|
|
|
What is a good solution to printing a Word document from an aspx page. The Word document is on the client's computer. I do not want to automate Word on the server.
|
|
|
|
|
dptalt wrote: What is a good solution to printing a Word document from an aspx page. The Word document is on the client's computer.
If its already in client computer then why are taking overhead to print through aspx page. User can directly open and print the document .
Or you want some thing different.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
They do not know where the documents are on the computer. And if they did they would not know which document pertains to the job they are viewing on the aspx page.
|
|
|
|
|
Ah, yet another Desktop Application developed as a Web Application. Have you ever heard of the KISS Principle[^]?
|
|
|
|
|
That sounds like a really terrible website design. You know what documents are on the client PC but they do not ? How is that possible ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
So you want to use word without automating word
You could try to use an ActiveX-control on the client, but that means you need to automate word...
|
|
|
|
|
Where can you get that ActiveX-control?
|
|
|
|
|
Did you try to google for this?
If you don't find anything, you have to do it on your own...
|
|
|
|
|
You are wasting your time. Just put a link on your page to the file. Put some text next to the link that says "Document will open in MS word. To print file click File > Print."
I didn't get any requirements for the signature
|
|
|
|
|
Cool answer man !!!
Thanks,
Arindam D Tewary
|
|
|
|
|
I like that idea but there are some pitfalls. When you click on the link you are prompted to Open or Save. Can this be turned off so it always opens the document? Once opened the document can be edited. Can it be automatically set to readonly?
|
|
|
|
|
As you are using web application therfore(in first message you have mentioned aspx page ) this
dptalt wrote: When you click on the link you are prompted to Open or Save. Can this be turned off
can not be done as ,as you can not control client's browsers settings.( your concerned document will be opened in client's browser right ?)
dptalt wrote: Once opened the document can be edited
I dont think any browser allows editing word document !!! It can only prompt you that you to open with appropriate document editor software !!!
Thanks,
Arindam D Tewary
|
|
|
|
|
Yes the document opens in the browser, and that is fine. Or can it be directed to open up Word from the windows application?
It must be using Word to open up the document in the browser because there are some editing features available such as I can modify text or bold text. If I navigate away from the page it prompts me if I want to save changes. If I save changes the save as dialog box is displayed.
|
|
|
|
|
It seems to me that you are utterly clueless.
A link to the document will open the document in Word. How else would it work ? And you can't open a document as read only.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
I'm sorry change the message from
"Document will open in MS word. To print file click File > Print." To "(If Prompted) Click Open. Document will open in MS word. To print file click File > Print."
If you want to give the user a read only document I suggest converting it to .pdf first.
I didn't get any requirements for the signature
|
|
|
|
|
Hi friend
I want to know how send to e-mail at particular time. Is web services is use for this process, if yes then how?
please help me
Thanks and Regards
Azad yadav
|
|
|
|
|
azad yadav wrote: I want to know how send to e-mail at particular time. Is web services is use for this process, if yes then how?
If you want send Mail on Particular time, you can go for Windows Service. Which can periodically check you for status and send mail.
Or even you can use SQL Server 2005 to send mail periodically.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Hi all, maybe this questions has been asked before (sorry)
Is it possible to fire fire a C# method (server-side code) from a javascript function (client-side)?
I need to fire some code when user doubles click on datagrid row, something like:
gridview.Cells[index].Attributes.Add("ondblclick". "SomeMethodOnServerSideCode()");
if it was possible, can anyone show me or link me some example?
Thanks!
|
|
|
|
|
You can not directly fire a server side code from client side code by adding ANY event handler by adding it to attribute collection.
From client side code, only doPostBack function can fire a server side event handler.
So you need to call that _doPostback() function and sent the cooecr parameter so that doPostBack() function can fire a server side event handler.
Thanks,
Arindam D Tewary
|
|
|
|
|
Yes, I know an easy hack for this.
Drag a button onto your form.
Double click the button in design view to get your method. Put your server code there.
Add the following javascript to your page mark up.
function callServerEvent() {<br />
<br />
var Button1 = document.getElementById"<%= Button1.ClientID %>");<br />
Button1.click();<br />
}
in the page_load add the following
this.Button1.Style.Add("display", "none");
use the callServerEvent() method in your javascript code.
I didn't get any requirements for the signature
|
|
|
|