Saturday, June 29, 2013

How to Export Data of Datalist into Pdf in Asp.net using iTextSharp DLL

Introduction: In this post I will try to explain how we can export the data of Datalist to PDF in Asp.net.
Description:
In last article I have explain How to bind Datalist Controlin Asp.net. here I bind the datalist control using Sqldatasource. See below:
<form id="form1" runat="server">
    <div> <table border="1"><tr><td>
    <asp:DataList ID="dlstudent" runat="server" DataKeyField="STUDENT_ID" CellPadding="3"
            DataSourceID="SqlDataSource1">
            <HeaderStyle Font-Bold="True" BorderColor="Black" />                  
            <ItemTemplate>              
               <table><tr><td><b>Student Name</b> </td>
                <td><asp:Label ID="STUDENT_NAMELabel" runat="server"
                    Text='<%# Eval("STUDENT_NAME") %>' /></td></tr>
                <tr> <td><b>Student Address</b></td>
               <td><asp:Label ID="STUDENT_ADDRESSLabel" runat="server"
                    Text='<%# Eval("STUDENT_ADDRESS") %>' /></td> </tr>
                <tr><td><b>Student Class</b></td>
               <td><asp:Label ID="STUDENT_CLASSLabel" runat="server"
                    Text='<%# Eval("STUDENT_CLASS") %>' /></td> </tr></table>
            </ItemTemplate>       
                       </asp:DataList></td></tr></table>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:TestBlogConnectionString %>"
            SelectCommand="SELECT * FROM [STUDENT_DETAIL]"></asp:SqlDataSource>
        <br />
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Export to Pdf" />
    </div>
    </form>

Friday, June 28, 2013

Sql Server Queries with Example

Introduction: In this post I will explain the Sql Server Queries to find the information from Table.
Description:
I have created a table name EMPLOYEE_INFORMATION.
EMPLOYEE_ID
int
EMPLOYEE_NAME
varchar(50)
EMPLOYEE_SALARY
int
EMPLOYEE_DEPARTMENT
varchar(50)

Table contain the below mention data as in snapshot:



To Display all the Details from EMPLOYEE_INFORMATION:
SELECT * FROM dbo.EMPLOYEE_INFORMATION

To Display the information and manage in Descending order on Salary wise:
SELECT * FROM dbo.EMPLOYEE_INFORMATION ORDER BY EMPLOYEE_SALARY DESC

To Display the information and manage in Asecnding order on Salary wise:
SELECT * FROM dbo.EMPLOYEE_INFORMATION ORDER BY EMPLOYEE_SALARY DESC

How to insert Data of one table to Another Table in Different Database in Sql Server

Introduction: In this post I will explain how we can insert the Data of one Table to Another Table in different Database in Sql Server.
Description:
In the last article I have explained How to insert data of one Table to Another Table in Sql.

SELECT * INTO DATABASE NAME1.TABLE NAME FROM DATABASE NAME2.TABLE NAME

Here DATABASE NAME1.TABLE NAME denotes that Database in table have to Cretaed.
DATABASE NAME2.TABLE NAME denotes the Database and Table Name from which Data will be copy.

Example:

SELECT * INTO Testing.dbo.COPY_DETAIL FROM TestBlog.dbo.BOOK_DETAIL

You see a Table name COPY_DETAIL will Created in Testing Database.

Related Articles on Sql Server:

How to insert data of one Table to Another Table in Sql

Is it helpful?

If yes post your comment to admire my work. You can like me on Facebook, Google+, Linkedin and Twitter via hit on Follow us Button and also can get update follow by Email.

Thursday, June 27, 2013

How to insert data of one Table to Another Table in Sql Server

Introduction: In this post I will explain how we can insert the Data of one Table to Another Table in same Database in Sql Server.
Description:
 In the previous post i have explained How to find 2nd, 3rd and N highest salary in Sql Server from Employee Table.
select * into Copy table_Name from Table_Name

OR

select * into DATABASE NAME.TABLE NAME from DATABASE NAME.TABLE NAME

Here Copy table_Name denotes that Table in which you want to copy the Table Data.
Table_Name denotes the Table of which want to copy the Data.

Example:

select * into COPY_DETAIL from dbo.BOOK_DETAIL
OR
select * into Testing.dbo.COPY_DETAIL from Testing.dbo.Emp_salary


You see a Table name COPY_DETAIL will Created in Database.

Is it helpful?

If yes post your comment to admire my work. You can like me on Facebook, Google+, Linkedin and Twitter via hit on Follow us Button and also can get update follow by Email.

Wednesday, June 26, 2013

How to Send an Email with Verification link to user in Asp.net after registration

In this post I will try to explain how we can send the verification Email with link to user after registration in Asp.net.
Send an Email with Verification link

Description:
In the previous article i have explained  How to Send Email with Attachment in Asp.net ,How to send Email in Asp.net using Web.config.
Here I created a table USER_REGISTRATION. USER_ID is primary key.

USER_ID
int
USERNAME
varchar(50)
FIRST_NAME
varchar(50)
LAST_NAME
varchar(50)
EMAIL
varchar(50)
IS_APPROVE
bit
PASSWORD
varchar(50)

Add two webforms to project User_registration.aspx and Verification.aspx.

Tuesday, June 25, 2013

How to find 2nd, 3rd and N highest salary in Sql Server from Employee Table

Introduction: In this article I will explain how we can find the 2nd, 3rd and N highest salary from Employee Table.
Description:
In the previous article i have explained How to insert data of one Table to Another Table in Sql Server, What is Join in Sql Server.
I have created a table name EMPLOYEE_INFORMATION.
EMPLOYEE_ID
int
EMPLOYEE_NAME
varchar(50)
EMPLOYEE_SALARY
int
EMPLOYEE_DEPARTMENT
varchar(50)

Table contain the below mention data as in snapshot:


To find 2nd highest Salary of Employee from Table:

select MAX(EMPLOYEE_SALARY) from dbo.EMPLOYEE_INFORMATION where EMPLOYEE_SALARY < (select MAX(EMPLOYEE_SALARY) from dbo.EMPLOYEE_INFORMATION)

Thursday, June 20, 2013

How to check the username/email is exists or not in asp.net

Introduction:  In this article I will try to explain how we can check the Username/Email is Exists or not at the time of User registration in Asp.net.
username/email is exists or not

Description:
Here I created a table USER_REGISTRATION. USER_ID is primary key.
USER_ID
int
USERNAME
varchar(50)
FIRST_NAME
varchar(50)
LAST_NAME
varchar(50)
EMAIL
varchar(50)
PASSWORD
varchar(50)

Add a webform to project. Drag and drop the controls from Toolbox to .aspx page.

Monday, June 17, 2013

How to send Email with Attachment in Asp.net

Introduction: In this article I will explain how we can send the Email with attachment in Asp.net.
send Email with Attachment

Description:
In the last article I explained How to send Email in Asp.netusing Web.config file. Add a new webform to project. After that add the below given code to .aspx page:
<table border="1px solid">
    <tr><b>Send Email with Attachment in Asp.net</b></tr>
    <tr><td>To:</td><td>
        <asp:TextBox ID="txtemail" runat="server"></asp:TextBox></td></tr>
        <tr><td>Subject:</td><td>
            <asp:TextBox ID="txtsubject" runat="server"></asp:TextBox></td></tr>
            <tr><td>Message:</td><td>
                <asp:TextBox ID="txtmessage" runat="server" TextMode="MultiLine"></asp:TextBox></td></tr>
                <tr><td>Attachment:</td><td>
                    <asp:FileUpload ID="fileupload" runat="server" /></td></tr>
                    <tr><td>&nbsp;</td><td>
                        <asp:Button ID="Button1" runat="server" Text="Send Email"
                            onclick="Button1_Click" /></td></tr>
        </table>

Sunday, June 16, 2013

How to upload multiple files using AjaxFileUpload and save path to Database in Asp.net

Introduction: In this post I will explain how we can upload the multiple files and save their path to Database using AjaxFileUpload control in Asp.net.
AjaxFileUpload

Description:
In last article I explained How to install Ajax controlToolkit in Visual Studio.  I have created a table IMAGE_PATH. Here IMAGE_ID is primary key.
IMAGE_PATH
int
IMAGE_PATH
varchar(MAX)

Add a new webform to project. Drag and drop the ScriptManager from Ajax Extensions. After that take the AjaxFileUpload control from Toolbox as shown below:
<asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server" OnUploadComplete="AjaxFileUpload1_UploadComplete1"/>

Note: we can validate the uploaded file via their extension using AllowedFileTypes Property of AjaxFileUpload control.

Friday, June 14, 2013

How to convert textbox value to Uppercase Or Lowercase in Asp.net using JavaScript

Introduction: In this I will explain how we can change the text to Uppercase or Lowercase using JavaScript in Asp.net.
Uppercase Or Lowercase

Description:
Put the below given JavaScript between Head tag of webform:
For Uppercase:

<script type="text/javascript">
        function Uppercase(id) {
            var txt = document.getElementById(id);
            txt.value = txt.value.replace(/\w\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); });
        }
    </script>

Thursday, June 13, 2013

How to insert Data into Database using Three Tier Architecture in Asp.net

Introduction: In this post I try to explain how we can insert the Data into Database using Three Tier Architecture with SqlHelper.cs file in Asp.net.
Description:
I have created a table name STUDENT_DETAIL. Here STUDENT_ID is primary key.
STUDENT_ID
int
STUDENT_NAME
varchar(50)
STUDENT_ADDRESS
varchar(50)
STUDENT_CLASS
varchar(50)

Also create a store procedure to insert Data:
CREATE PROCEDURE INSERT_STUDENT_DETAIL
(
@STUDENT_NAME VARCHAR(50),
@STUDENT_ADDRESS VARCHAR(50),
@STUDENT_CLASS VARCHAR(50)
)
AS
BEGIN

      SET NOCOUNT ON;

   INSERT INTO dbo.STUDENT_DETAIL(STUDENT_NAME,STUDENT_ADDRESS,STUDENT_CLASS) VALUES (@STUDENT_NAME,@STUDENT_ADDRESS,@STUDENT_CLASS)
END
GO

Wednesday, June 12, 2013

Jquery Validation in Asp.net

Introduction: In this post I try to explain how we can use the Jquery Validation in Asp.net and insert values into Database.
Description:
I have created a table TABLE_REGISTARTION. Here USER_ID is primary key.
USER_ID
int
USERNAME
varchar(50)
FIRST_NAME
varchar(50)
LAST_NAME
varchar(50)
USER_EMAIL
varchar(50)
USER_PHONE
varchar(50)
ADDRESS
varchar(50)
CITY
varchar(50)
STATE
varchar(50)
ZIP
varchar(50)

Put the below mention Jquery code between Head tag (before the close of Head Tag).
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
  <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.5.5/jquery.validate.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
         
            $("#form1").validate({
              
                onsubmit: false
            });

            $("#btnregister").click(function (evt) {
              
                var isValid = $("#form1").valid();

                if (!isValid)
                    evt.preventDefault();
            });
        });
  </script>

Tuesday, June 11, 2013

How to Compare Password and confirm password using Javascript in Asp.net

Introduction: In this post I will explain how we can validate and compare the password and confirm Password in Asp.net using Javascript.
Description:
I have created a table Employee_Detail. Here ID is primary key.
ID
int
PASSWORD
varchar(50)

Add a new webform to project. Add the below mention to .aspx page.

<table border="1px solid"><tr><td>
    <b>Compare Password and Confirm Password Using Javascript in Asp.net</b>
    </td></tr><tr><td>       
    <table>
    <tr>
    <td>Password:</td><td>
        <asp:TextBox ID="txtpassword" runat="server" placeholder="Enter Password" TextMode="Password"></asp:TextBox></td>
    </tr>
    <tr><td>Confirm Password:</td><td>
        <asp:TextBox ID="txtconfirmpassword" runat="server" placeholder="ReEnter Password" TextMode="Password"></asp:TextBox></td></tr>
        <tr><td>&nbsp;</td><td>
            <asp:Button ID="btncheck" runat="server" Text="Check"
                OnClientClick="return compare();" onclick="btncheck_Click"/></td></tr>
    </table>
    </td></tr></table>