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.




        

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...