|
|
Browse by Tags
All Tags » ASP.NET 2.0 - G... » ASP.NET 1.x
-
I always find a difficulty in remembering all the server variables and how they can help me, here is a list of all the server variables I ran in a testing application. You will see the server variables with a sample data coming from the testing application:
ALL_HTTP
HTTP_CONNECTION:Keep-Alive HTTP_ACCEPT:*/* HTTP_ACCEPT_ENCODING:gzip, ...
-
A nice trick I read in the ASP.NET 2.0 Core Reference is that, when an exception occurs at the end of the request, that is the GetLastError of the Server object returns an exception, the Session data is lost, however, in your handler of the Exception, if you call Server.ClearError, the Session is restored!
That is a great tip Dino, ...
-
I have been developing an API for an application of mine at work. The API returns a set of objects in the form of Collections. I needed a way to filter the collection based on some values I provide.
I have passed by this blog post:
http://codebetter.com/blogs/brendan.tompkins/archive/2004/09/02/24116.aspx
Brendan creates something known as ...
-
I had a need few days ago to delete some files in the Session_End. As you know, Session_End will be fired, even if the client's session ends, because the Session is based on the Server and therefore, after the Session times-out the Session_End on the server will be executed.
However, I needed to use some properties from the HttpContext and it ...
-
A very common question on the ASP.NET forums, is how to loop through the page controls, and find dynamically my control!
Here is the solution, its R E C U R S I O N !!
A very simple example, that loops through the page controls, and once it finds a Panel, it prints out, I am a Panel
public void ShowPanels(Control p_Control)
{
...
-
I have always had the need to use String Enumerations. What do I mean by that?
Suppose we have this Enum Type:
public enum StringNames
{
Bilal,
Wessam,
Elsa,
Samer,
Tarek,
Farah,
Firas,
Mohammad
}
In my code, I would like to have something as:
string _Name ...
-
Hello:
Suppose you open a Modal Dialog window inside your ASP.NET page. In that dialog window, you have a GridView, DataGrid, or whatever control. Do some changes on that control, you will see that the data has changed right?
Ok, then close the dialog window, then open it again from the ASP.NET Page, you will see the old data and not the ...
-
A very common question on the ASP.NET forums is:
How to define an event in a UserControl, and process this event in the Page holding this UserControl?
The answer is simple, follow this post, and you will be able to define your own events very easily.
We have the following UserControl file together with the Code Behind as follows:
<%@ ...
-
If you are working with either a new custom server control or a normal web user control, this is the proper way of adding an event that can be handled by the parent control of the child control you are develping:
Add the following to the control (Server Control / Web User Control ) being developed: #region Event Handler
private static readonly ...
-
This is a nice summarized sample code on how to format DateTime instances:// This code example demonstrates the String.Format() method.
// Formatting for this example uses the ''en-US'' culture.
using System;
class Sample
{
enum Color {Yellow = 1, Blue, Green};
static DateTime thisDate = DateTime.Now;
public static void ...
-
There has been always a popular question on the ASP.NET forums about the difference between CurrentCulture and CurrentUICulture. I wanted to distinguish things in this post and make it clear once and for all.
CurrentCulture and CurrentUICulture are both of type CultureInfo which is part of the System.Globalization.
CurrentCulture and ...
-
While working with the HttpContext.Current.Server.MapPath(), I discovered something which is that, the MapPath method starts seeking a path Starting from the current directory you are in and not directly from the root directory.
Hope this hint helps,
Regards
-
I have been working on a Global Error Logging & Handling solution for a web application that is part of a huge system we have been developing in my company.
I used an HttpModule to get attached to the Application_Error event, where I instantiate my own error handler classes and process the error. The processing is done though ...
-
Sometimes there is a need to do some action on a field returned from the database and displayed inside a TemplateField inside the DataGrid or GridView columns.
For example, you might have an email address inside your database and you want to set the HREF of the a tag as a link with the ''mailto:'' appended at the beginning of the ...
-
I have always misunderstood the difference between NULL and DBNULL until recently while I was working on ASP.NET web application, and was talking to a Webservice and I found an exception coming from one of the web methods inside the Webservice which is using the SqlCommand.ExecuteScalar() method.
What happens when the ExecuteScalar() method is ...
-
When you developer an ASP.NET web application or a DotNetNuke application, you will be having all types of file extensions:
.csproj
.cs
.vb
.su
.sln
etc ...
So, imagine you are developing a huge web application or even a DotNetNuke website and now it is time to deploy your application. Are you going to go through each single folder in ...
-
There is a very nice module on Security Patterns in ASP.NET (1.x/2.0).
You can check it at: Security Training Modules
Hope that helps,
Regards
-
Sometimes in an ASP.NET (1.x/2.x) webform, we might have a Password TextBox, and one of the DropDownLists or RadiobuttonLists or any control present inside the web form might do a postback before you need to submit the form.
Every time this happens, I loose the Password TextBox value. A solution that might help you preserve the Password ...
-
In the last few days, I was working on a Custom DotNetNuke Module, which is called ContactUs, which I will be using in one of the projects currently under my hands.
I wanted to list all entries of the ContactUs form that are stored in the database. So I decided to use the DataList, in which I place my own Table inside the ItemTemplate.
There are ...
-
I am working on a Custom DotNetNuke module. I wanted to have a DropDownList of all the countries in the world.
I had to google a little bit to find all the countries available, which I beleive are 222 countries.
I wanted to share with you the SQL Script I created.
You can download this script from the Files Area.
When you run this script using ...
-
I would like to share with you the following two links, which I beleive are good and useful.
String Formatting in C#
Url Rewriting with Regex for ASP.NET 2.0
Regards
-
Have you ever faced that error before?
I have started development lately on a Windows 2003 Standard Server, having both VS.NET 2003 and VS.NET 2005 installed.
I was trying to open a DotNetNuke project yesterday and got the error by VS.NET 2003:
Error while trying to run the project : Unable to Start debugging on the web server. You ...
-
In my work today, I faced a very weird thingy, here it is:
I was retreiving a bit column from the table whose default value is set to 0, and then using an SqlDataReader, and the weird thing is that I used:
1- (bool)reader[col]2- Convert.ToBoolean(reader[col]])3- reader.GetInt32(col)
Nothing worked ...
-
When I start a new project, I usually create a Blank Solution in VS.NET, then add to it my Class Libraries and Web Application. The problem I used to have before is that, every time I did some changes in one of the Class Libraries I had to update the references manually to all other projects referencing that updated Class Libraries.
Thank to ...
-
I had today to work with some DateTime calculations.
I need two methods:
1- Get time difference between two dates, in such a way to have the following formats in the returned value:
- Hours
- Minutes (01 -> 1 minute, 10 -> 10 minutes,...)
- Seconds
- Hours.Minutes
- Hours:Minutes:Seconds
2- Add a double value for a DateTime
- double ...
|
|
|