Monday 15 October 2012

Web user control with AJAX

Step by Step procedure for making  the Web User Control with Ajax

Step: 1: - create web user controls with public properties and event at.ascx.cs and switch to design part with (update panel + Grid view + Sql Data Source)
Step: 2: - Through sql data source, bind the user specific data from the database, let’s say we bind tbdept table.
Step: 3: - code behind technique w.r.t design part.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class WebUserControl : System.Web.UI.UserControl
{
   public delegate void abc(object s, EventArgs e);
    public event abc myclick;
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    public Int32 p_GetDno
    {
        get
        {
            return Convert.ToInt32(GridView1.SelectedRow.Cells[1].Text);

        }
    }

    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        myclick(this, e);
    }
}
Step: 4: - Again create one more user control and on the design part drop   grid  View and sql data source in update panel.
Step: 5: - Configure the sql data source and with where clause .(Bind tbemp and in where clause define edno)
Step: 6 - set the coding window w.r.t the design part.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class WebUserControl2 : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    public Int32 p_SetDno
    {
        set
        {
            SqlDataSource1.SelectParameters["edno"].DefaultValue = value.ToString();
            GridView1.DataBind();
        }
    }
}

Step: 7: - Create web page (.aspx) and drop the user controls from the solution explorer with script manager
Step: -8: - Now finally we can get the services of AJAX with web user control.

Monday 27 August 2012

Template of Music Site with HTML tags....



source code of music site Template.....

<html>
<title>
music</title>
<link rel=stylesheet type=text/css href="music.css">
<script language=javascript>

document.write(Date());
</script>


<body bgcolor=#66FF66>
<div>
<h2 class=aa>
musicworld.com</h2></div>
<div class=contact>
<a href="css2.html">home</a><p>
<a href="music.html">music</a><p>
<a href="video.html">video</a><p>
<a href="wall1.html">wallpapers</a><p>
<a href="about1.html">about us</a><p>
<a href="contact.html">contact us</a><p>

</div>
<div class=abc1>


<table class=music>
<tr>
<th><a href="old.html">old is gold</a><th> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
<th><a href="latest.html">latest songs</a></th> <th>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
<th><a href="punjabi.html">punjabi songs</a></th><th>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
<th><a href="english.html">English songs</a></th>
</tr>
<tr>
<td><img src="file:///C|/Users/sandy/Desktop/images (1).jpg" height=150px width=150px"></td><td></td>
<td><img src="file:///C|/Users/sandy/Desktop/cocktail.jpg" height=150px width=150px"></td><td></td>
<td><img src="file:///C|/Users/sandy/Desktop/hunny singh.jpg" height=150px width=150px"></td><td></td>
<td><img src="file:///C|/Users/sandy/Desktop/eniqure.jpg" height=150px width=150px">
</tr>
<tr>
<td>lsiten evergreen<br>
songs of bollywood<br>
industry that<br>
feels the pain and<br>
happiness of the<br>
person</td>
<td></td>
<td>
Download Hindi Songs<br>
offers Hindisongs download<br>bollywoodsongs<br>
latesthindi and regionalsongs,<br>
</td>
<td></td>
<td>
Download free Punjabi<br>
Album songs online, <br>
Free punjabi mp3 songs
</td>
<td>
</td>
<td>
Hollywood songs,English songs<br>
English albums,<br>
akon songs,<br>
titanic songs
</td>
</tr>
<tr>
<td><a href="old.html">see more..</a></td><td></td>
<td><a href="latest.html">see more..</a></td><td></td>
<td><a href="punjabi.html">see more..</a></td><td></td>
<td><a href="english.html">see more..</a></td>
</table>
</div>


<div class=bb>
footer of website</div>
</body>
</html>

Saturday 25 August 2012

Facebook style Login Page in HTML and CSS along with JavaScript Validations




Facebook style Login Page in HTML and CSS along with JavaScript Validations



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Facebook</title>
<link href="value.css" rel="stylesheet" type="text/css" />
</head>


<body bgcolor="#ECECFF">


<div style="background-color:#3B5998;height:95px;width:100%">
<img style="height:90px;margin-left:150px" src="C:\Users\sandy\Desktop\images.jpg" />
<div style="float:right;padding:16px;">
<table>
<tr>
<td><font style="font-weight:900;font-size:16px;padding:20px" color="#FFFFFF">username</font></td>
<td><font style="font-weight:900;font-size:16px;padding:20px;padding-bottom:10px" color="#FFFFFF">password</font></td></tr>
<tr>
<td><input type="text" name="t1" /></td>
<td><input type="password" name="t2" /></td>
<td><input type="button" name="a" value="login" /></td></tr>

<td><input type="checkbox" name="s" value="remember the password" /><font color="#BFBFFF">remember password</font></td>
<td><input type="checkbox" name="s" value="forgot your password?" /><font color="#BFBFFF">forgot password?</font></td>
</tr>
</table>
</div>
</div>

<div style="float:left;margin-left:10px">
<div style="background:#ECECFF;height:500px;width:600px">
<h1 style="padding-top:30px;text-align:center">Your Facebook Timeline</h1>
<h3 style="text-align:center"><font color="#5E5EFF">Tell Your Life story witha a new kind of profile.</font><font color="#0033FF">Learn More</font></h3>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<img src="C:\Users\sandy\Desktop\facebook.jpg" align="middle" style="border:double;color:#FFFFFF" />
</div>
</div>
<div style="float:right;margin-left:5%;padding-bottom:100px">
<div style="height:500px;width:600px;background-color:#ECECFF">
<h3 style="float:left"><font color="#333333">Sign Up</font></h3><br /><br />
<p style="margin-left:2px;text-decoration:underline">It's a free and always will be.</p>
<form action="reg.php" name="f" method="post">

<script language="javascript">

function valid()
{
if(f.t1.value=="")
{
alert("Enter the Firstname");
return;
}
if(f.t2.value=="")
{
alert("Enter the Lastname");
return;
}

var h=f.t3.value;
var s=h.indexOf("@");
//var s=h.indexOf(".");
if(s<0)
{
alert("not a valid E mail");
return;
}
var s=h.indexOf(".");
if(s<0)
{
alert("not a valid E mail");
return;
}


if(f.t3.value=="")
{
alert("Enter the Email");
return;
}

if(f.t4.value=="")
{
alert("Enter the confirm Email");
return;
}
if(f.t3.value!==f.t4.value)
{
alert("Email doesn't match");
return;
}
}
</script>

<table>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;First Name:</td>
<td><input style="height:30px;width:300px" type="text" name="t1" value="enter the name" onfocus="this.value=''" /></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Last Name:</td>
<td><input style="height:30px;width:300px" type="text" name="t2" /></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Your Email:</td>
<td><input style="height:30px;width:300px" type="text" name="t3" /></td>
</tr>
<tr>
<td>Re-enter Email:</td>
<td><input style="height:30px;width:300px" type="text" name="t4" /></td>
</tr>
<tr>
<td>NewPassword:</td>
<td><input style="height:30px;width:300px" type="password" name="t5" /></td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I am:</td>
<td><select style="height:30px;width:120px" name="s1" >
<option>Select Sex:</option>
<option>Male</option>
<option>Female</option>
</select>
</td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Birthday:</td>
<td><select style="height:30px;width:70px"  name="s2" >
<option>Month:</option>
<option>Jan</option>
<option>Feb</option>
<option>Mar</option>
<option>Apr</option>
</select>
&nbsp;&nbsp;
<select style="height:30px;width:50px;size:1" name="s2">
<option>Day:</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
&nbsp;&nbsp;
<select style="height:30px;width:70px;size:1" name="s2">
<option>Year:</option>
<option>2006</option>
<option>2007</option>
<option>2008</option>
<option>2009</option>
<option>2010</option>
</select>
</td>
<tr>
<td>
</td>
<td><a href="#"><font color="#8080FF">Why do i need to provide my birtyhday?</font></a></td>
</tr>
<tr>
<td></td>
<td><font size="3px">By clicking Sign Up, you agree to our Terms and that you have read and understand our Data Use Policy, including our Cookie Use.</font></td>
</tr>
<tr>
<td></td>
<td><input style="background-color:#00AA55;width:100px;height:30px;border:thick;text-align:center" type="button" onclick="valid()" name="t7" value="Sign Up" /></td>
</tr>
</tr>
</table>
</form>
</div>
</div>
</body>
</html>

Friday 17 August 2012

Business Layer of the 3-tier Architecture using Microsoft Application Blocks in ASP.NET 4.0


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
using Microsoft.ApplicationBlocks.Data; //Add namespace (Downloaded from Enterprise Library)


namespace nsemployee
{
    public class clsempprp
    {
        public int p_empno { get; set; }
        public String p_ename { get; set; }
        public String p_eadd { get; set; }
        public int p_esal { get; set; }
    }
    public class clsemp
    {
        String cs;
        public clsemp()
        {
            cs = ConfigurationManager.ConnectionStrings["cn"].ConnectionString;
        }
        public void save_rec(clsempprp p)
        {
            Object[] prm = new object[4];
            prm[0] = p.p_empno;
            prm[1] = p.p_ename;
            prm[2] = p.p_eadd;
            prm[3] = p.p_esal;
            SqlHelper.ExecuteNonQuery(cs, "insemp", prm);
        }
        public void update_rec(clsempprp p)
        {
            Object[] prm = new object[4];
            prm[0] = p.p_empno;
            prm[1] = p.p_ename;
            prm[2] = p.p_eadd;
            prm[3] = p.p_esal;
            SqlHelper.ExecuteNonQuery(cs, "updemp", prm);
        }
        public void delete_rec(clsempprp p)
        {
            Object[] prm = new Object[1];
            prm[0] = p.p_empno;
            SqlHelper.ExecuteNonQuery(cs, "del", prm);
        }
        public List<clsempprp> disp_rec()
        {
            SqlDataReader dr;
            dr = SqlHelper.ExecuteReader(cs, "dispemp");
            List<clsempprp> obj = new List<clsempprp>();
            while (dr.Read())
            {
                clsempprp k = new clsempprp();
                 k.p_empno = Convert.ToInt32(dr[0]);
                k.p_ename = dr[1].ToString();
                k.p_eadd = dr[2].ToString();
                k.p_esal = Convert.ToInt32(dr[3]);
                obj.Add(k);
            }
            dr.Close();
            return obj;
        }
    }

}

Saturday 12 May 2012

Roles of XML in asp.net



IN ADO.NET Basics

Microsoft ADO.NET is the latest improvement after ADO. ADO.NET provides platform interoperability and scalable data access. In the .NET Framework, data is transmitted in the Extensible Markup Language (XML) format. Therefore, any application that can read the XML format can process data. 


IN Web Configuration settings:

The application-level configuration settings are stored in an Extensible Markup Language (XML) format. The XML format is a hierarchical text format, which is easy to read and write. This format makes it easy to apply new settings to applications without the aid of any local administration tools.

IN SECURITY

Through the XML format we can easily define the security for the administrator. we can easily read, write and modify the authentication and authorization concepts according to the administrator

IN WEB SERVICES

Web service is a programmable URL. Stated another way, a Web service is an application component that is remotely callable using standard Internet protocols such as HTTP and XML.XML is the best way to transfer the data in different interface through the concept of COM and DOM. Thus, any system that supports these basic, standard protocols is capable of supporting Web services.



Thursday 3 May 2012

Sitemap used for current status of the web page


Definition: -
                   Site map is used to create the hierarchy for the navigation of the current website.

Procedure to get the current status of the application: -

    Choose Website à Add new Item à Site Map à Create it

Code for the Site Map File: -

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
    <siteMapNode url="" title="Master"  description="Master">
        <siteMapNode url="reg.aspx" title="Registration"  description="Registration" />
        <siteMapNode url="login.aspx" title="Login"  description="Login" />
    </siteMapNode>
</siteMap>

Wednesday 2 May 2012

Designing CSS with Visual Studio 2010

Follow these steps for making the design of the controls in asp.net so attractive through the CSS.


1)     Open a new Web Site, and select the Source mode.


2)  From the Standard Toolbox menu, add a Textbox web control to the editor between the <div></div> tags, and put a <p/> tag after it

3)   From the HTML Toolbox menu, add an Input (Text) Web form beneath the <p/> tag.

4)   Switch to Design mode

5)  Select View àManage Styles to open the CSS Manage Styles tool.

6)  Once the CSS style tool is open, click on New Style at the top of the window. The New Style window opens.

7)  In the Selector box, type .input. This is the class name.

8)    In the Define In box, choose Current Page from the drop-down list

9)     Select Font from the Category menu. Make the settings: -

10)  Select Border in the Category menu

11)   Select Position àcategory menu (according to the condition)

12    Click OK and if you want to see the information which you stored in CSS just move the mouse over the CSS file (such as .input class).

13) Now go to the design mode (.aspx page) àdrop web controls as you want à Go to property window à  CSS Class à choose Name of CSS class such as (.input )

Edit and Update record in Grid View in asp.net


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack == false)
        {
            data_bind();
        }

    }

    private void data_bind()
    {
        SqlDataAdapter adp = new SqlDataAdapter("select * from tbemp1", ConfigurationManager.ConnectionStrings["cn"].ConnectionString);
        DataSet ds = new DataSet();
        adp.Fill(ds);
        GridView1.DataSource = ds;
        GridView1.DataBind();
    }
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        GridView1.EditIndex = e.NewEditIndex;
        data_bind();

    }
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Int32 empno,esl;
        String enam, eadd;

        enam = ((TextBox)(GridView1.Rows[e.RowIndex].FindControl("t1"))).Text;
        eadd = ((TextBox)(GridView1.Rows[e.RowIndex].FindControl("t2"))).Text;
        esl = Convert.ToInt32(((TextBox)(GridView1.Rows[e.RowIndex].FindControl("t3"))).Text);
        empno = Convert.ToInt32(((Label)(GridView1.Rows[e.RowIndex].FindControl("lk"))).Text);

        SqlConnection con = new SqlConnection();
        con.ConnectionString = ConfigurationManager.ConnectionStrings["cn"].ConnectionString;
        con.Open();
        SqlCommand cmd = new SqlCommand();
        cmd.CommandText = "Update tbemp1 set ename = @enam,eadd = @ed,esal = @esl where empno = @eno";
        cmd.Connection = con;
        cmd.Parameters.Add("@eno", SqlDbType.Int).Value = empno;
        cmd.Parameters.Add("@enam", SqlDbType.VarChar, 50).Value = enam;
        cmd.Parameters.Add("@ed", SqlDbType.VarChar, 50).Value = eadd;
        cmd.Parameters.Add("@esl", SqlDbType.Int).Value = esl;
        cmd.ExecuteNonQuery();
        cmd.Dispose();
        GridView1.EditIndex = -1;
        data_bind();


    }
   
}



2 - Tire architecture used in asp.net



           SQL Data Source data bound control always used with 2 –Tire Architecture

                1.     Using of SQL data source with Grid view

SQL data source: -
                     The SQL data source control enables you to use a Web server control to access data that is located in a relational database. This can include Microsoft SQL Server and Oracle databases, as well as OLE DB and ODBC data sources. You can use the SQL data source control with data-bound controls such as the grid view, Form view, and Details view controls to display and manipulate data on an ASP.NET Web page, using little or no code.       

   Connecting the SQL data source with Database
1)    Place the grid view control and SQL data source controls on the web page at design time.

2)   Choose SQL data source  à Task list à Configure data source.

3)   Here we choose the data connection used to connect to the database.

4)  In this step we choose the specify columns from tables or Specify the custom SQL statements or Stored procedure.

5) 1st we choose name of the table and select * for all columns.


  Connecting the SQL database with Grid view control

Grid view à Task list à Data source à SQL data source 1.




        

Monday 30 April 2012

Key points of Grid View Control in asp.net

  1. Here we can manipulate the data as like a data list control(Insertion, deletion)
  2. Here we can get the data at runtime in tabular form automatically. 
  3. Here we can easily sort the data in ascending or descending order through the sorting property in Grid view.
  4.  In the Grid view control, we get the default template
  5. Auto edit, Auto delete, Auto Select options are preoccupied here
         In the grid view control, we can apply eight templates

1.     Item template
2.     Edit item template
3.     Alternating Item template
4.     Header template
5.     Footer template
6.     Selected Item template
7.     Pager template
8.     Empty Data template




Sunday 29 April 2012

Data Repeater control in asp.net


1)    It is used to display data in single column.
2)    No Manipulation is allowed in data repeater.
3)    There are no Paging concept in data repeater
4)    There are no default templates.

Here we have Five Templates are applied on data repeater
1)    Item Template
2)    Alternating Item Template
3)    Header Template
4)    Footer Template
5)    Separator Template


Disconnected approach for binding the data in data bound control

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.IsPostBack == false)
        {
            rep_bind();
        }
    }

    private void rep_bind()
    {
        SqlDataAdapter adp = new SqlDataAdapter("Select * from tbbook1", ConfigurationManager.ConnectionStrings["cn"].ConnectionString);
        DataSet ds = new DataSet();
        adp.Fill(ds);
        Repeater1.DataSource = ds;
        Repeater1.DataBind();
    }

}


Composite Data Bound control and types in asp.net


            Composite Data-bound controls are controls that can be bound to a data source control to make it easy to display and modify data in your Web application.There are total 8 data bound controls presents in asp.net 4.0 version, 

           Data Bound Control in Framework 2.0 Version
   
                                 1)    Repeater
                        2)    Data list
                        3)    Grid view
                        4)    Detail view
                                 5)  Form view

            Data Bound Control in Framework 3.5 Version.

          Here we added some more Composite Data Bound Control

                       1)    List view
                       2)    Data view


   Data Bound Control in Framework 4.0 Version.

                   1)    Chart control



   Note : - Text boxes and labels are also data bound controls, but it binds less amount of data.

ADO.NET in asp.net


Microsoft ADO.NET is the latest improvement after ADO. ADO.NET provides platform interoperability and scalable data access. In the .NET Framework, data is transmitted in the Extensible Markup Language (XML) format. Therefore, any application that can read the XML format can process data. XML (License free, fastest way to travel the data).

The ADO model uses the concept of recordsets, which are the ADO representation of tables and views from a database. Although these recordsets are very flexible to use and allow access to data even when disconnected from data sources
ADO.NET also allows you to access data when disconnected from actual data Sources. However, unlike ADO, ADO.NET uses XML as the data format. ADO.NET uses the DataSet and DataReader objects to access and manipulate data



QUICK REVISION of the Informatics Practices Examination

QUICK REVISION of the Informatics Practices Examination Data Types Every value belongs to a specific data type in Python. Data type iden...