//Hash table creation
Hashtable hs = new Hashtable();
//Add some values to the hash table
hs.Add((Object)"myname", "jk");
hs.Add((Object)"No", "109091");
hs.Add((Object)"Salary", "1348572");
//Get the value of the hash table using the key
string str = hs["myname"];
//redirect to the next page with the hash table values
Response.Redirect("page2,aspx?mynames=" + str);
Monday, July 19, 2010
HastTable for QueryString
Load script at startupt in asp.net
Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript1", "");
Execute storage procedure using c#
Database bs = new Database();
bs.StoredProcedureName = "spTest";
SqlParameter[] param = new SqlParameter[2];
param[ 0] = new SqlParameter{ParameterName = "Acc" ,SqlDbType = System.Data.SqlDbType.NVarChar ,Value = Acc,Direction = ParameterDirection.Input};
param[1] = new SqlParameter{ParameterName = "id" ,SqlDbType = System.Data.SqlDbType.Int ,Value = id,Direction = ParameterDirection.Output};
//get the oputput variable
Int32.TryParse(bs.GetParameterValue("id").ToString(), out tempVar)
bs.StoredProcedureName = "spTest";
SqlParameter[] param = new SqlParameter[2];
param[ 0] = new SqlParameter{ParameterName = "Acc" ,SqlDbType = System.Data.SqlDbType.NVarChar ,Value = Acc,Direction = ParameterDirection.Input};
param[1] = new SqlParameter{ParameterName = "id" ,SqlDbType = System.Data.SqlDbType.Int ,Value = id,Direction = ParameterDirection.Output};
//get the oputput variable
Int32.TryParse(bs.GetParameterValue("id").ToString(), out tempVar)
Friday, July 9, 2010
Visual Studio Setup Project
Deploying a C# application (Visual Studio Setup Project)
Posted 19 July 2008 - 07:40 AM
In this tutorial I will show how to deploy a C# application using a standard Visual Studio Setup Project.
Any application must be somehow provided to the end-user. If the application is very small and is composed of a single executable, it can be deployed by just providing the executable to the end user. In our situation, the application has many dependencies, that can or cannot be present on the client machine, so we need to create a setup project, that will install the needed dependencies and the application itself.
Special Tutorial Requirements:
Let's start.
1. First of all we need to open a C# project/solution (or any other project/solution you have made using one of the programming languages included in Visual Studio). Use 'File -> Open -> Project/Solution' (or Ctrl+Shift+O):

2. After opening a C# project/solution you will get something like this:
3. Now you have to add a setup project to the current solution. Use 'File -> Add -> New Project...':
4. In the 'Project types' list, go to 'Other Projects -> Setup and Deployment' and select the 'Setup Wizard' template:
As you see there are many 'Setup and Deployment' project types and you can create just a blank setup project and customize it by yourself, but in this tutorial I will show how to use the wizard, which is a little bit easier for beginners.
5. Now let's take a deeper look at the wizard.
The wizard is composed of 5 general steps:
Step #1: Initialization
This step is a 'welcome message'.
Step #2: Project Type
In this window you have to select the setup project type. You have four options:
To create a setup program to install an application:
To create a redistributable package:
I will use the 'Create a setup for a Windows application', as my C# project is a Windows application.
Step #3: Project Outputs
Here you must select the project outputs you wish to include in your installation package. For my project I select only 'Primary output', which includes the application DLL or EXE.
Step #4: Files to include
Here you have the opportunity to add additional files, like guides, HTML pages or just a ReadMe file. I will add just a ReadMe file:
Step #5: Confirmation
Here you can see the settings for the project that will be created. If you find a mistake or something, you can easily go back and change a specific setting.
6. If the project was successfully created, you will see this:
7. Now you can customize the setup project properties. To access the project properties grid, click on Setup1 project in the 'Solution Explorer' window:
Here are the properties and a short explanation of what they do:
AddRemoveProgramsIcon - Specifies an icon to be diplayed in the Add/Remove Programs dialog.
Author - Specifies the name of the author of an application or component.
Description - Specifies a free-form description for an installer.
DetectNewerInstalledVersion - Specifies whether to check for newer versions of an application on the user's computer.
InstallAllUsers - Specifies whether the package is installed for all users or only the current user.
Keywords - Specifies keywords used to search for an installer.
Localization - Specifies the locale for string resources and the run-time user interface.
Manufacturer - Specifies the name of the manufacturer of an application or component.
ManufacturerUrl - Specifies a URL for a Web site containing information about the manufacturer of an application or component.
PostBuildEvent - Specifies any commands to execute after the build ends.
PreBuildEvent - Specifies any commands to execute before the build starts.
ProductCode - Specifies a unique identifier for an application.
ProductName - Specifies a public name that describes an application or component.
RemovePreviousVersions - Specifies whether an installer will remove previous versions of an application or component.
RunPostBuildEvent - Specifies the condition under which the post-build event runs.
SearchPath - Specifies the path that is used to search for assemblies, files or merge modules on the development computer.
Subject - Specifies additional information describing an application or component.
SupportPhone - Specifies a phone number for support information for an application or component.
SupportUrl - Specifies a URL for a Web site containing support information for an application or component.
TargetPlatform - Specifies the target platform of the installer.
Title - Specifies the title of an installer.
UpgradeCode - Specifies a shared identifier that represents multiple versions of an application or component.
Version - Specifies the version number of an installer, merge module, or .cab file.
8. You can also specify what folders to create on the desktop and in the Start menu:
9. You can also customize the entries that will be added to the registry:

10. You can also customize the file types on the target machine:

11. You can also customize the user interface of the installer:

You can add additional dialogs:

12. You can also customize the custom actions:

13. You can also customize the launch conditions:

14. When you're done with project customizations, build the project (right click on 'Setup1', then select the 'Build' option):

Now you've got a new installation package for your application or component.
This tutorial showed the basics of creating a setup project, so now you can easily deploy your applications to the end-user.
Any application must be somehow provided to the end-user. If the application is very small and is composed of a single executable, it can be deployed by just providing the executable to the end user. In our situation, the application has many dependencies, that can or cannot be present on the client machine, so we need to create a setup project, that will install the needed dependencies and the application itself.
Special Tutorial Requirements:
- Microsoft Visual Studio 2008 ('Setup and Deployment' projects are not available in Express editions)
Let's start.
1. First of all we need to open a C# project/solution (or any other project/solution you have made using one of the programming languages included in Visual Studio). Use 'File -> Open -> Project/Solution' (or Ctrl+Shift+O):
Resized to 82% (was 610 x 480) - Click image to enlarge
2. After opening a C# project/solution you will get something like this:
Resized to 49% (was 1024 x 733) - Click image to enlarge
3. Now you have to add a setup project to the current solution. Use 'File -> Add -> New Project...':
Resized to 100% (was 502 x 385) - Click image to enlarge
4. In the 'Project types' list, go to 'Other Projects -> Setup and Deployment' and select the 'Setup Wizard' template:
Resized to 63% (was 804 x 512) - Click image to enlarge
As you see there are many 'Setup and Deployment' project types and you can create just a blank setup project and customize it by yourself, but in this tutorial I will show how to use the wizard, which is a little bit easier for beginners.
5. Now let's take a deeper look at the wizard.
The wizard is composed of 5 general steps:
Step #1: Initialization
Resized to 76% (was 658 x 505) - Click image to enlarge
This step is a 'welcome message'.
Step #2: Project Type
Resized to 76% (was 658 x 505) - Click image to enlarge
In this window you have to select the setup project type. You have four options:
To create a setup program to install an application:
- Create a setup for a Windows application
- Create a setup for a web application
To create a redistributable package:
- Create a merge module for Windows Installer
- Create a downloadable CAB file
I will use the 'Create a setup for a Windows application', as my C# project is a Windows application.
Step #3: Project Outputs
Resized to 76% (was 658 x 505) - Click image to enlarge
Here you must select the project outputs you wish to include in your installation package. For my project I select only 'Primary output', which includes the application DLL or EXE.
Resized to 76% (was 658 x 505) - Click image to enlarge
Step #4: Files to include
Resized to 76% (was 658 x 505) - Click image to enlarge
Here you have the opportunity to add additional files, like guides, HTML pages or just a ReadMe file. I will add just a ReadMe file:
Resized to 76% (was 658 x 505) - Click image to enlarge
Step #5: Confirmation
Resized to 76% (was 658 x 505) - Click image to enlarge
Here you can see the settings for the project that will be created. If you find a mistake or something, you can easily go back and change a specific setting.
6. If the project was successfully created, you will see this:
Resized to 49% (was 1024 x 768) - Click image to enlarge
7. Now you can customize the setup project properties. To access the project properties grid, click on Setup1 project in the 'Solution Explorer' window:
Here are the properties and a short explanation of what they do:
AddRemoveProgramsIcon - Specifies an icon to be diplayed in the Add/Remove Programs dialog.
Author - Specifies the name of the author of an application or component.
Description - Specifies a free-form description for an installer.
DetectNewerInstalledVersion - Specifies whether to check for newer versions of an application on the user's computer.
InstallAllUsers - Specifies whether the package is installed for all users or only the current user.
Keywords - Specifies keywords used to search for an installer.
Localization - Specifies the locale for string resources and the run-time user interface.
Manufacturer - Specifies the name of the manufacturer of an application or component.
ManufacturerUrl - Specifies a URL for a Web site containing information about the manufacturer of an application or component.
PostBuildEvent - Specifies any commands to execute after the build ends.
PreBuildEvent - Specifies any commands to execute before the build starts.
ProductCode - Specifies a unique identifier for an application.
ProductName - Specifies a public name that describes an application or component.
RemovePreviousVersions - Specifies whether an installer will remove previous versions of an application or component.
RunPostBuildEvent - Specifies the condition under which the post-build event runs.
SearchPath - Specifies the path that is used to search for assemblies, files or merge modules on the development computer.
Subject - Specifies additional information describing an application or component.
SupportPhone - Specifies a phone number for support information for an application or component.
SupportUrl - Specifies a URL for a Web site containing support information for an application or component.
TargetPlatform - Specifies the target platform of the installer.
Title - Specifies the title of an installer.
UpgradeCode - Specifies a shared identifier that represents multiple versions of an application or component.
Version - Specifies the version number of an installer, merge module, or .cab file.
8. You can also specify what folders to create on the desktop and in the Start menu:
Resized to 64% (was 789 x 445) - Click image to enlarge
9. You can also customize the entries that will be added to the registry:
Resized to 63% (was 795 x 445) - Click image to enlarge
10. You can also customize the file types on the target machine:
Resized to 64% (was 793 x 445) - Click image to enlarge
11. You can also customize the user interface of the installer:
Resized to 63% (was 795 x 447) - Click image to enlarge
You can add additional dialogs:
12. You can also customize the custom actions:
Resized to 63% (was 795 x 447) - Click image to enlarge
13. You can also customize the launch conditions:
Resized to 63% (was 795 x 447) - Click image to enlarge
14. When you're done with project customizations, build the project (right click on 'Setup1', then select the 'Build' option):
Now you've got a new installation package for your application or component.
This tutorial showed the basics of creating a setup project, so now you can easily deploy your applications to the end-user.
Wednesday, July 7, 2010
Custom template using DataBinder.Eval
Custom binding inside a gridview
&Name=" style="width:90px; height:30px; border:0px; overflow:hidden" frameborder="0" marginheight="0px" marginwidth="0px" height="30px" width="30px">
&Name=" style="width:90px; height:30px; border:0px; overflow:hidden" frameborder="0" marginheight="0px" marginwidth="0px" height="30px" width="30px">
Monitoring web events with HttpWatch
Page Level Events
Page level time charts now include lines to indicate when events were raised during the loading of a page:
Improved Grouping of Requests during Page Load
Requests occurring after the page onload event are now grouped with the requests recorded during the initial loading of the page:
HttpWatch Detects and Highlights Potential Problems
HttpWatch now examines each request and issues warnings where problems relating to performance, security or functionality are detected. Requests that have warnings are highlighted with a new Warning column marker:
and a new request level Warnings tab shows the details of each potential problem:
There's also a new Warning tab in the Summary window that summarizes the occurrence of each type of warning in a page or set of selected requests:
Customizable Grid Controls
Right clicking on a grid's column headers opens a customization menu:
For example, you may want to increase the font size if you are using HttpWatch in a demonstration:
New Data Columns in the Request Grid
There's now more than thirty columns to choose from in the main request grid covering almost every data item that is available in HttpWatch:
Customizable CSV Export
The CSV output now can now be customized to include the data fields that you need:
Data Tips Help You Understand The Recorded Data
Data tips are now displayed when you hold the mouse pointer over an item such as an HTTP status code:
Or a header value saving you the trouble of looking up what the value means:
New Icon Based Type Column
The new icon based type column saves space and provides an instant visual marker for different types of content. The data tip shows the underlying mime type:
Coloring of Result Column Values
The result column now uses red to indicate errors and gray for (Cache):
More Information About Cookies
The cookie tab now displays the HttpOnly and Secure flags for each cookie; including cookie values that were sent to the server. The source column shows whether the cookie value was returned from the server, set by Javascript or saved in the cookie store by a previous session:
Improved Support For HAR Files
HTTP Archive (HAR files) can now be:
- Saved as HttpWatch log files (.hwl)
- Open using the HttpWatch automation interface
- Re-exported in CSV or XML formats
Improved Automation Interface
The automation interface allows HttpWatch to be controlled from programs written in almost any programming language (e.g. C#, VB.Net, Ruby, Javascript). In version 7.0, this interface has been extended with new classes, properties and methods to support:
- Page level events
- Warnings
- Export of customized CSV output
- HTTP Archive (HAR) files
- Image dimensions
The documentation is also improved with a new format and object relationship diagrams:
Uploaded File Type on POST Data tab
The content type of uploaded files is now shown in a separate column in the POST Data tab:
Subscribe to:
Posts (Atom)