I received the following question over the weekend:
I’ve made a C# form application and I need to send a report name at runtime. How do I add an incoming parameter to the command line? Such as “crFORM.exe Shipform.rpt”
I received the following question over the weekend:
I’ve made a C# form application and I need to send a report name at runtime. How do I add an incoming parameter to the command line? Such as “crFORM.exe Shipform.rpt”
For many of you, this is going to be a “Duh!” kind of post. But while working on this today, I found so many people asking this question and so many others giving the wrong answer, I’m compelled to post anyhow. If you know the answer, then you are welcome to stop reading now. I didn’t write this for you. I wrote this for the hundreds of people who will search for this information and won’t be able to find the answer. The fact of the matter is, that’s why I write most of what I write–so people searching for the information can find it. So here’s the question: I’ve set up an Application_Error event handler in my Global.asax file and I have implemented a server transfer for errors. Now I want to set up a specific page to handle 404 errors. How do I detect a 404 error and call the 404-specific page? The main answer to this question involves retrieving the exception that triggered the event in the first place. To do that, we call Server.GetLastError()
:
I just got off the phone with a client who is using the MS-AJAX TabControl in one of his applications and any time he causes a postback, the tab resets to the first tab.
If you’ve never seen the problem, you’re lucky. There are a couple of ways around the problem. The first and easiest if it works in your situation is to put the tab in an update panel so that you never actually do a full postback.
Last week I introduced the ASP.NET MVC framework by talking a bit about what the model, view and controller are. In the comments, John Meyer said,
I respectfully disagree with your claim that the model is your BLL. MVC is a UI layer pattern, and as such all models, views, and controllers are strictly in the UI level.
While historically, MVC has been described in the way I stated–while the ASP.NET MVC guys have also portrayed the Model as BLL or below–I have to agree with John. Here’s why: At least as far as ASP.NET is concerned, the model is inherited from a specific class. This means that any implementation code you place in the class will be forever tied to the class it inherits from.
Yesterday we covered issues surrounding using ASP.NET’s Response.Redirect in server side code. We noted that not handing it correctly could prevent code from running on the server that we want to run. The other issue is emitting Javascript in the server side in association with Response.Redirect(). This also leads to unexpected problems if you aren’t thinking about what is actually happening with your code. Take this code as an example:
I’ve seen this question a couple of times in various situations. The first involves Javascript and the second involves server side code. Both are caused by a misunderstanding of what this function does and how web pages work. Let’s start with the easy one: server side code. You might have code that looks something like this:
During the Christmas break, I received the following question: What does C# global keyword actually do? Code example, from table adapter code:
One of the “advantages” of using CSharp instead of VB.NET is that if programmers want to, they have the option of bypassing the memory management of .NET and working with memory directly. This is called “unsafe” mode.
While I will show you how to use this keyword, I have to tell you up front that I’ve been using CSharp since Beta 2 of .NET 1.0 and I’ve NEVER needed to switch into unsafe mode to do any of the work that I’ve done.
One of the new tools that showed up in Visual Studio 2005 that I don’t see many people taking much advantage of is the Class Diagram.
I hate long titles, but this is what everyone is going to be searching for if they get this error, so that’s the title today.
I just got done fixing an error and when I went to Google, there were only five entries for this phrase and none of them solved the problem. Some got me close and gave me a clue, but none of them said…