|
The ThreadAbortException is normal for a page redirect. It isn't an error.
If you are catching exceptions, you must allow this one through.
try
{
}
catch(ThreadAbortException)
{
throw;
}
catch(Exception ex)
{
}
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
Colin Angus Mackay wrote: throw; // Continue throwing the ThreadAbortException
I think this is not required as ThreadAbortException will be raised again automatically at the end of catch block.
|
|
|
|
|
N a v a n e e t h wrote: I think this is not required as ThreadAbortException will be raised again automatically at the end of catch block.
Really? Anyway, if you are catching other exceptions where the scope includes ThreadAbortException, you don't want to be processing stuff unnecessarily.
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
Colin Angus Mackay wrote: Really?
Yup. Quoting MSDN,
ThreadAbortException is a special exception that can be caught, but it will automatically be raised again at the end of the catch block. When this exception is raised, the runtime executes all the finally blocks before ending the thread.
|
|
|
|
|
thanks, but it's not working.
|
|
|
|
|
priya1515s wrote: but it's not working.
Define "not working" - I'm not a mind reader.
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
priya1515s wrote: but it does not redirect to the target link instead it stays back to the current page.please help me out.
It may be possible that you are catching and suppressing this exception, thus not allowing it to continue up to the top to allow ASP.NET to handle it.
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
"not working" meaning that the same problem occurs again.the page is not redirecting and stays back.
|
|
|
|
|
show us the piece of code. What is the value of url ?
|
|
|
|
|
Redirect internally calls Response.End which calls Abort function that raises ThreadAbortException exception upon completion. Plz post your stacktrace and code.
|
|
|
|
|
Hi,
I have a gridview and I have used Footer template to insert data. When there is no data returned from select method of object datasource The empty data text is displayed and nothing displays. I want that when there is no data then atleast the footer templates should be displayed so that new record can be inserted. How can i do this.
Please help...
|
|
|
|
|
Retrieve your data in a dataset begore databinding it to a gridview. Add a newrow() to you dataset if it has 0 rows:
i.e.:
myTable.Rows.Add(myTable.NewRow());
Your Gridview wil display an empty gridview row but also the footerrow.
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
Hi i am new to Crystal report. I search google example and create a Report. But at execution it ask Login information each time. I had a VB code for solution.
Dim ConnInfo As New ConnectionInfo
With ConnInfo
.ServerName = ".sqlexpress"
.DatabaseName = "Northwind"
.UserID = "sa"
.Password = "eXpress2005"
End With
For Each cnInfo As TableLogOnInfo In Me.CrystalReportViewer1.LogOnInfo
cnInfo.ConnectionInfo = ConnInfo
Next
End Sub
Can anyone tell the C# code to achieve this?
|
|
|
|
|
HI Karthik,
You can use this code for refrence to display crystal report.
sql= "";
DataSet ds = new DataSet();
OleDbDataAdapter AdpNew = new OleDbDataAdapter(sql,Conn);
AdpNew.Fill(ds);
Rpt ReportObject = new Rpt();
ReportObject.SetDataSource(ObjectName.Tables[0]);
ReportViewerName.Height = this.Height;
ReportViewerName.Width = this.Width;
ReportViewerName.ReportSource = ReportObject;
|
|
|
|
|
Need to change the date format in javascript.
format is dd/MM/yyyy
|
|
|
|
|
|
javascript does not have build-in date formatting. But, many people have wrote small js code to format date to various degree. Simple Google[^] search turns a wealth of examples.
|
|
|
|
|
Hi,
I am beginner in asp.net and my problem When i try to redirect with the code
Response.Redirect("~/Zone/Home.aspx?ZID=24&"); an exception is being raised i.e;
"Thread is being aborted" and after this redirection is done without any problems. What cud be the possible mistake made by me?
Plz help.
|
|
|
|
|
If you look at the Redirect[^] documentation, you will see it takes a second parameter of a type of bool to indicate if you want to terminate current page execution
use instead
Response.Redirect("~/Zone/Home.aspx?ZID=24&", false);
|
|
|
|
|
|
But, be aware that if you do set the value to false, the page you are currently on will continue to process. If the value is true (the default) then the page stops processing immediately.
See also the answer I gave here[^]
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
Colin Angus Mackay wrote: See also the answer I gave here[^]
try{ // My code that does a redirect}catch(ThreadAbortException){ throw; // Continue throwing the ThreadAbortException}catch(Exception ex){ // Catch any other type of exception and handle the error.}
That is interesting, but I am not sure how it will work though.
In my code I use expensively try/catch. Then I have have catch all basin at the application level. Any unhandled exception will end up at the catch basin. If you rethrow the ThreadAbortException doesn't it get bubbled up. Don't you want to eat that exception?
|
|
|
|
|
Yusuf wrote: If you rethrow the ThreadAbortException doesn't it get bubbled up.
Yes, it will.
Yusuf wrote: Don't you want to eat that exception?
Nope. It is the exception that the Redirect method throws to force the end of execution. If you catch it and eat it execution resumes when you've already said you want it to stop so you can redirect elsewhere. (Although, I've been told that ASP.NET will automatically rethrow it if you catch it - which I didn't know before and wish to confirm before I change my stance as I don't see how it does it.)
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
I’m building a fairly typical ASP.NET web app that has a data entry screen, a number of maintenance screens, and some reports. The data entry screen and the maintenance screens all work in the same way; they use ListView controls embedded in UpdatePanels.
So far so good – they’re solid and reliable. However, performance is an issue for the data entry screen, and I don’t think using a ListView is going to be good enough. Using Fiddler, I can see that every postback sends 30Kb of data down the line, which seems a little excessive to me.
I’ve experimented with a ‘fast’ data entry screen. This one just uses a plain ol’ table, no UpdatePanels. I handle the click event on the client side by calling a web service that updates the database. This has got me from 30Kb down to 12 bytes!
The thing is, I’d like to retain use of the ListView if possible, because I want consistency with my other screens, and I’d like to continue to use the DataPager control. To do this, I’m obviously going to need to override the __doPostBack functions that the ListView generates.
My question is, is this going to be more trouble than it’s worth? Before I waste days of my life on this, is there a much better way of going about it?
|
|
|
|
|
Well, the reason you see big chunk of data (30k) being sent is because of control viewstate[^]. You can turn off the ListView viewstate, but you will loose all the controls viewstate functionality. Do you need to remember the control state between postbacks?
|
|
|
|