|
but sir,i have a grid in that page and i want to show the values in the grid
|
|
|
|
|
This is the way ASP.NET postback works. When you refresh, your browser submits the same page with the same postback information. The only way you can avoid it is by redirecting it to a different page.
|
|
|
|
|
|
What do you mean when you say 'refresh the page?' How, exactly, are you doing that?
Ignore any answers that suggest that viewstate will not contain the latest value inserted into a textbox, including string.empty.
Without seeing rhe code it's hard to know, but it sounds like you may be rebinding those textboxes to your datastore.
|
|
|
|
|
What is the best approach to persist a dataset across postbacks so that users could manipulate the data in it and could be saved(to the database) at last.
|
|
|
|
|
You can put it in ViewState .
Best wishes,
Navaneeth
|
|
|
|
|
I am using ViewState now but I notice the page is slower during reloads
|
|
|
|
|
You can use viewstate, but if the size of the dataset is very large, it will bloat the request and response size and can probably kill your app. Use a DataTable object and persist it in session. You can also try serializing the object to a database and save the key in viewstate. Each approach has its own advantages and disadvantages. You should try to find out what works best for you.
|
|
|
|
|
Hello Shameel
How about persisting the DataSet(as I have more than one DataTable) in a Session variable and clearing it(using Session.Remove()) while the user navigates away from the page?
|
|
|
|
|
The best way is not to Persist the dataset ever. Just save the changes during postbacks and show the most recent data.
Remember, the user might go next page on next date. Or might be there is a session timeout. If you store everything in context, that means errors might loose everything.
|
|
|
|
|
Thank you Abhishek
You re right. But here I am faced with a situation to reduce database hits rather than concurrency. I am having multiple tables so using DataSet. When I stored it in a ViewState variable I notice the page loading slower.
|
|
|
|
|
Dont load such a huge data in ViewState.
When you request for something, you send viewstate with it(even if it is an AJAX request). After receiving the viewstate it decrypts it using Machine key. It then modifies the viewstate according to your serverside program and then finally encrypts it... converts the encrypted string to Base64 and written over Response stream.
That means for every request this huge amount of task IIS has to perform. Hence slow output.
We generally place EnableViewState = false for frequently visited pages to have better performance. So according to me writing a Dataset(which serializes it and write to page) is not good.
On the other hand, Server memory is very low. If there are lots of connections, there might be a huge possibility to have Session OutofMemory. But if you dont have concurrent connections, you might use Session. But dont put the dataset, as there are a lots of properties which are not required. Rather make a list of DataRows and place them in session(Improves than writing DataSet). But still, I dont like this as well.
If I was there, I will always compromise Database hits than Server memory.
|
|
|
|
|
Hi All,
In my project using Ajax controls that is update panel,Modal controls and VS 2008, i am getting the Error in Log Database.But application running very fine.Why this Exception is generated?The Application is in Live....
HandlingInstanceID: 0c17cc24-7940-4807-a07e-e92170031d69 An exception of type 'System.Web.HttpException' occurred and was caught. ------------------------------------------------------------------------ 11/01/2009 04:03:55 Type : System.Web.HttpException, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a Message : The file '/4L5rpd4F.asmx' does not exist. Source : System.Web Help link : ErrorCode : -2147467259 Data : System.Collections.ListDictionaryInternal TargetSite : Void CheckVirtualFileExists(System.Web.VirtualPath) Stack Trace : at System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath) at System.Web.UI.WebServiceParser.GetCompiledType(String inputFile, HttpContext context) at System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String
Please giving me any suggestion, by that i can resolve the problem..
Thanks in Advance.
JohnDas
|
|
|
|
|
I think this is FileNotFound Exception.
The file '/4L5rpd4F.asmx' does not exist
|
|
|
|
|
Hello
A website with hundreds of thousands of user-Suppose,
how can I send a mail to website's users duration 1 hour
what's the solution?
Thanks
Mohammad Khansari
modified on Tuesday, November 3, 2009 6:54 AM
|
|
|
|
|
Write a very fast bit of code (multi-threaded probably) and hope your mail server can cope - and it doesn't think it's spam
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Hello
Thanks for your consideration
Do you know content management systems in this case how to act?
Standard method in this field there are there?
Mohammad Khansari
|
|
|
|
|
I doubt any CMS system will even attempt to email 100,000 people in an hour. If you have to email that many people then you will probably need to do as I suggested in my first reply, and multi-thread, probably to different mail servers. If you are using a 3rd party host then you are probably not going to acheive it anyway as they will treat it as a DOS attack.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
If you try to send thousands of emails within a very short period of time, your email server will probably block it thinking someone is trying to overload it. You can probably split your users into batches and try to send emails through different email servers.
|
|
|
|
|
Hello
Thanks for your consideration
Do you know content management systems in this case how to act?
Standard method in this field there are there?
Mohammad Khansari
|
|
|
|
|
I have a textbox which is created dynamically in page_load.
TextBox tb = new TextBox();
tb.id = "ID1";
tb.text = GetfromDB();
tb.TextChanged +=new EventHandler(tb_TextChanged);
Now i want to add a javascript confirmbox as
tb.Attributes.Add("onchange","javascript:return confirm('Data has Changed. Click OK To Continue');");
If the user clicks ok then continue to tb_TextChanged function and if user clicks cancel i want to restore the previous value of textbox.
How can i write the javascript function?
Thanks
|
|
|
|
|
Basically when a postback occurs, everything in the page gets recreated again.
If it is not posted back you need to somewhere hold the initial values and show to the items.
You can make a global object say
var myarray = {};
myarray["textbox1"] = document.getElementById("textbox1").value;
..
..
..
When you restore, set the value from myarray to actual controls.
document.getElementById("textbox1").value = myarray.textbox1;
...
...
...
what is the problem with that. If the page is not posted back you can do this easily.
|
|
|
|
|
I do not want to store values without any event. I have many textboxes and i want to store the inital value only based on some event.
Is there some event like onfocus or onkeydown for the textbox where i can store only for the textbox which is supposed to be changed.
Thanks
|
|
|
|
|
of course there is. You might use onfocus = "javascript:myarray[this.id]=this.value"
to initialize myarray with initial value if you want.
No big deal, do it whatever you feel like.
|
|
|
|
|
Hi all,
Am creating a report(matrix) using microsoft report viewer...
am getting the output like this:-
Code Name 24 25 26 27 28
1 Sam 9.81 9.81 9.81 18.81 18.81
Now i want to put the total of(9.81 +9.81 +9.81 + 18.81 + 18.81) as total as next column as given below
Code Name 24 25 26 27 28 Total
1 Sam 9.81 9.81 9.81 18.81 18.81 64.05
how can i do this?
Thanks in Advance...
|
|
|
|