Friday, 7 September 2012

Inserting Multiple Values from Checkboxlist

 string interests = string.Empty;
foreach (ListItem item in this.CheckBoxList1.Items)
        {
            if (item.Selected)
            {
                interests += item + ",";
            }
        }


Then Insert those Values into DataBase

Thursday, 6 September 2012

Problem in running your application

If your Application in server side runs in one system and getting Error in other System Then Just Place this Code in your WEB.Config File

<machineKey validationKey="A24C569010D1CC7CD68554BA0265B0012FE53AF2E376318C9A3DE166250BEC6D826C24B41EC641BEA1B620D26B0F8F86CDA765646C3B0122FAD0AF3203001EBD" decryptionKey="E896935906E139BA04DE38A5698F60E5D860992947D5BECF4DFC67E789DF15FF" validation="SHA1" decryption="AES" />

Place this Above <Pages>

Print a Div in Web application

Java Script to Print a particular DIV in our application

<script language="javascript" type="text/javascript"  >

function PrintContent()
{
    var DocumentContainer = document.getElementById('your DIV Id');
var WindowObject = window.open(' ', "PrintWindow"," width=750,height=650,top=50,left=50,toolbars=no,scrollbars=yes,status=no,resizable=yes");
WindowObject.document.writeln(DocumentContainer.innerHTML);
WindowObject.document.close();
WindowObject.focus();
WindowObject.print();
WindowObject.close();
}
</script>

Add Favicon To ur ASP.NET Application

Just make ur logo as (.jif) Image

and this Lines in ur ASPX Code

<link rel="shortcut icon" href="yourimage.gif"/>

Monday, 7 May 2012

Code to get MS WORD In Windows Application


 Code To Get MS WORD Document on Click Event In Windows Application


Microsoft.Office.Interop.Word.ApplicationClass wordObject = new Microsoft.Office.Interop.Word.ApplicationClass();
            object File = @” Ur Word Path From Solution Explorer”;
            object nullobject = System.Reflection.Missing.Value;
            Microsoft.Office.Interop.Word.Application wordobject = new Microsoft.Office.Interop.Word.Application();
            wordobject.DisplayAlerts = Microsoft.Office.Interop.Word.WdAlertLevel.wdAlertsNone;
            Microsoft.Office.Interop.Word._Document docs = wordObject.Documents.Open(ref File, ref nullobject, ref nullobject, ref nullobject, ref nullobject, ref nullobject, ref nullobject, ref nullobject, ref nullobject, ref nullobject, ref nullobject, ref nullobject, ref nullobject, ref nullobject, ref nullobject, ref nullobject);

SetUp and Deployment of Application in ASP.Net






Creating a Setup and Deployment Project

In this article I will cover the basics of creating a Windows Installer. This article will explain the step by step process of creating a Setup Project.


Step 1: Create a Sample .Net Project. I have named this project as "TestBlogProject".


[ProjectSolutionExplorer.JPG]







Figure 1 Sample Project


Create a Setup Project
Open the TestBlogProject in the VS IDE.








Figure 2: Add New Project





Figure 3: Setup Project Dialog


There are five different templates that are available when you select the project type 'Setup and Deployment Projects'.
1.  
Setup Project:
Creates a Windows Installer project to which files can be added. This project type is the most generic of the five.
2.  
Web Setup Project:
Creates a Windows Installer web project to which files can be added.
3.  
Merge Module Project:
Creates a Windows Installer Merge Module project to which files can be added. This project type is most commonly used for using third party products.
4.  
Setup Wizard:
Creates a Windows Installer project with the aid of a wizard.
5.  
Cab Project:
Creates a Cab project to which files can be added.

For the purpose of this article, I will be using the template Setup Project. Provide a name for the project as well choose the location where this project will be established. (See Figure 3) Once you have done this click 'OK' and you should now see a screen like the following.












Figure 4: Default Setup Project File View


Now that we have an empty Setup Project established.
Let us discuss about the various editors that are available.

1.   

Right Click on the Setup Project and Click View.



[FileSystemEditor.JPG]

Figure 5: File System Editor
1.
Click on the File System




File System Editor

The File System (Figure 6) provides you the essential tools to work with the application folder, user's desktop, and the user's programs menu.





Figure 6: File System Editor

The first thing we want to do here is to include the relevant files and folders we wish to install on the user's machine. This is accomplished by right clicking the Application Folder and selecting 'Add'. The following screenshot is an example of something similar you may see.





Figure 7: Add Project Output

Now to add project output files to this folder, Click Project Output.




Click OK.

Merely add one or more of the files that is vital for your application by clicking on File…. Now that you have you files in place.


[ProjectOutput.JPG]

Figure 8: Project Output




We could take additional steps such as manipulating the user's desktop with items such as a shortcut, as well you can add a program group to the user's program group.




Create Shortcut










Name the shortcut as you want. I have given the name as TestBlog. Drag and drop to User's Desktop Folder



Figure 9: Desktop Shortcut to application


The next item you find of immense importance is the User Interface Editor. Inside of this editor you may eliminate or include dialogs that are needed for this install project. The following screenshot is the default User Interface that is created when I initially created this setup project (See Figure 10). The only variation is that I have added a Customer Information dialog.



Figure 10: User Interface Editor
To include the Customer Information dialog that I spoke of follow the following steps.
1.  
Under Install right click on the 'Start' node
2.  
Choose 'Add Dialog'







Figure 11: Customer Information

1.  
Select the Customer Information Dialog and click 'OK'

As you can see there are is an ample variety of dialogs you can choose from.



Prerequisites Installation in Windows Installer
Most applications have prerequisites: Components such as the .NET Framework runtime must be available on a target computer in order for the application to run. The deployment tools in Visual Studio include the capability to automatically detect the existence of components during installation and install a predetermined set of prerequisites — a process known asbootstrapping.


This will be achieved as follows:


To choose which prerequisites to install
1.  
In
 Solution Explorer, select the deployment project and Right Click
2.  
Click
 Properties.
3.  
In the
 Property Pages dialog box, expand the Configuration Properties node, and then select theBuildproperty page.
4.  
Click the
 Prerequisites button.
5.  
In the
 Prerequisites dialog box, make sure that the Create setup program to install prerequisite components box is checked.
6.  
In the
 Choose which prerequisites to install list, check the prerequisites that you wish to install, and then click OK.

To specify the download location for prerequisites
·      
In
 Solution Explorer, select the deployment project, right click.
·      
Click
 Properties.
·      
In the
 Property Pages dialog box, expand the Configuration Properties node, and then select theBuildproperty page.
·      
Click the
 Prerequisites button.
·     
In the
 Prerequisites dialog box, choose a location:
o  
If you want to deploy the installers for the prerequisites to a vendor, click
 Download prerequisites from the component vendor's web site.
o  
If you want to deploy the installers for the prerequisites to the same location as your application installer, click
 Download prerequisites from the same location as my application.
o  
If you want to deploy the installers for the prerequisites to a different location, click
 Download prerequisites from the following location and enter a local path, URL, or file-share location.
·      
Click
 OK to continue.