|
All due respect ... I understand what he is saying and he would be absolutely right -- I'd be crazy to go get the data until I need it. However he doesn't have all the facts of what my entire application already does. The data fetch in question is embedded in a function that gets fired based on a previous postback. This function fetches the data based on what the user has requested, then stuffs an export button (which we are dealing with now) and a printable page button (already sorted and working great) onto the page along with a display of the fetched data ...
It looks basically like this:
http://img143.imageshack.us/img143/5783/screencapmr1.png
Now, please -- can someone help with my question -- I keep reading something about Delegates and Custom Event handlers -- does this ring a bell for anyone?
(Deleted other post, so much for throwing a wide net ...)
modified on Friday, January 11, 2008 5:40:53 PM
|
|
|
|
|
The point I was trying to make previously was that your approach was unnecessarily complicated and probably suboptimal for the task at hand. From your screenshot, it looks like you are working with small, simple sets of tabular data. Is it a major performance issue if the data is fetched from the database again if the user selects 'export'? If you were adamant that the data should only be fetched once, you could look at Data Caching[^]. However you should read the documentation and understand its pros and cons if you are considering using it. I think the data requirements your page has are too temporary to consider caching, but it's your choice.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hmmm ... yes the sets of data are typically small and simple -- generally not more than 100 rows of a single table. Lets assume I have the event handling function go get the data again. What would be the best method to have the EventHandler know what to get? I still think I'm stuck cuz it would be silly(and probably wouldn't work anyway) to pass the SQL select string in a query string right? Ugh, I guess I could store the SQL string in a cookie -- but that can't be a security best practice ....
Based on your recommendations I'm playing with some other ideas -- what about storing the dataset in the ViewState?
|
|
|
|
|
Your event handler doesn't need to differ from that already specified for the Click event. Within your event handler method, you just need to call whatever method you have to retrieve the data from the database. Remember, the click event fires in your server-side code, so cookies/query string variables are not relevent.
GusNElmer wrote: what about storing the dataset in the ViewState?
ViewState is another option. One advantage of using ViewState is that the data is stored on the client not the server, so no server-side resources are consumed. Its main disadvantage is that it bloats your web page. DataSets are quite heavy objects. To add a DataSet object to ViewState, it would first have to be serialized and the resulting string base-64 encoded. The size of your web page is going to increase significantly, which means longer download times. Try it out for yourself to see what effect it would have. It is usually recommended that ViewState caching is limited to simple scalar values and caching of more complicated objects performed on the server-side by using the .NET Caching API or Session state.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Okay, here is the issue I am having:
I have created a web app that puts applicant's information into a database. From there the user can do a search for particular users. There is also a function to create a report based on a series of sql queries. The report is created by calling an existing word document, which is in a .doc format, and then replaces bookmarks in the file with the results of the queries. Once that is done, the vb code will then save the report under a new file name and then have the user either open or save the new file on their computer.
Here is where the problem lies. For the past month when I got this originally working, I was able to put my web app into the IIS on my computer so I could test it out on the internal network without migrating it to it's permanent home. It was all working fine until yesterday, when I rebooted my machine. Now, when I call the code to create the document, my browser's progress bar will stop at about 25% of the way and nothing will happen. I can see that the aspnet worker process is running and has called winword.exe and the sql process, but nothing will happen.
When I go to debug the app, here is the line that it is stopping on:
<br />
Dim doc As Microsoft.Office.Interop.Word.Document = wordApp.Documents.Open(filename, confirmConversions, isreadOnly, addToRecentFiles, _<br />
passwordDoc, passwordTemplate, revert, writepwdoc, writepwTemplate, format, encoding, _<br />
visible, openRepair, docDirection, notEncoding, xmlTransform)<br />
The funny thing is that I can run the code just fine when I go back to my original debug folder on my machine. What am I doing wrong here?
|
|
|
|
|
Hi,
I have a asp.net web application that uses UDL files to connect to the database. I stuck into a very strange situation where application is sometimes using this UDL to make connections to the database and sometime errors out stating "Unable to load the UDL file".
I am sure what is causing this behaviour in the application. But it is apprent that the same piece of code(without modifying anything) works today and error out tomorrow and again start working by itself.
Any help in this regard would be highly appreciated.
Regards.
|
|
|
|
|
Hi,
I need to point to the folder that is outside of the root directory. For example, if my project name is SWB and it is located in SWB folder I need to point to the folder that is outside of SWB folder.
Can I use Server.MapPath for that?
Thanks!
|
|
|
|
|
You could set this folder up in IIS as a virtual directory within your website.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Thanks for reply,
Is the re any other way to do it without IIS, cause I don't have it.
|
|
|
|
|
What web server are you using to host your ASP.NET application if you're not using IIS?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
I'm using Web Developer 2005, on Windows XP Media
|
|
|
|
|
asem0525 wrote: I'm using Web Developer 2005, on Windows XP Media
You are confusing a web development tool with a web server. Visual Web Developer 2005 is a web development tool that allows you to create ASP.NET website. When you come to deploy your website to a production environment, you would need to install a web server such as IIS to host your website. IIS would be the obvious choice as it is a Microsoft product and has features specifically designed for running ASP.NET websites.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
well, yes,
it is actually my school project and I don't think I'm gonna upload it to the Internet.
is there a way to point to the folder outside of the root folder on my local computer?
|
|
|
|
|
Unless you use a web server such as IIS to define an external folder as a virtual directory within your own website, I don't think you can do this.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
I am beginner in ASP.Net and have following question:
I have a class and inside of this class i load some information from database.
It is very slow to connect in each instance of this class to database again.
class DataNode
{
SqlConnection DB;
public DataNode()
{
DB = new SqlConnection("connection string");
DB.Open();
}
public DataNode[] ProcessAllSubNodes()
{
DataNode subNode = new DataNode();
subNode.GetSomeDataFromDB();
}
}
I have tried following to avoid it:
1) make SqlConnection DB - static.
Problem: if many users connect simultaniosly - i get error that datareader already used somewhere else.
2) to store DB instance in HttpContext.Current.Session and reuse it each time. It has helped, but i am not sure that it is ideal way and has no bad effects.
I know about caching objects in HttpContext.Cache, but the first time (when there is no cache) it connects to database so often (because my objects are recursive), that database stops responding and i get DB connection timeout exception
So if someone knows a good pattern for my problem, please share
Thanks.
|
|
|
|
|
The rule of thumb for database access is to open the connection as late as possible and close it as soon as possible. The slowness may simply be caused by the connection to your database, say if it is located on another server.
If the data is static, i.e. doesn't change often, then caching it may be an option, depending on the amount of data.
There are an enormous amount of examples of constructing data access layers, I would suggest you try searching for one as an example.
only two letters away from being an asset
|
|
|
|
|
I have been trying to send an email from ASP.NET 2.0 application.
It worked fine when i executed the code in the localhost. I was able to send mails through the email server and also received the same.
But when i deployed the same code in ftp server I am unable to send the email.
Exception I received is:
"Failure sending mail.System.Net.WebException: Unable to connect to the remote server".
Can anyone help me out in dis.
Regards
Ramya
|
|
|
|
|
I believe the exception is self-explanatory. Check if the deployed server can actually reach the mail server you are trying to use.
only two letters away from being an asset
|
|
|
|
|
Hi Mark,
I understand ur point. But there are two things that has to be noted here.
1. I am able to send email from an asp page inside the same ftp server to mail server that i mentioned earlier, which means that ftp server and mail server are accessible.
2. I am able to access the mail server from my aspx page in localhost , which means that mail server is accessible from aspx page too.
I dont know where exactly the problem is.
|
|
|
|
|
Just because you can access the smtp server from you local host does not mean it can be accessed from from the it is deployed on.
If the asp page works, compare it to the aspx page, what is different about the mail aspect. There is obviously something different. Have you debugged on the remote server?
only two letters away from being an asset
|
|
|
|
|
After deploying it in the ftp, how is it possible to debug the code?
I dnt know the way to do it. Kindly let me know if there is any.
|
|
|
|
|
|
Fine Mark. I will try out remote debugging nd wl get bk.
Thank you for your support.
|
|
|
|
|
I need help on how to AUTORESPOND if a user send an email to me from an asp.net application
Any Vb.net code will be appreciated
|
|
|
|
|
Instead of doing it in coding,you can try out an different way.
The domain hoster while giving you the details of the mail server will also provide you with an option to send auto responder . Try using it.
Ramya
|
|
|
|