Server Side Controls and Client-Side Controls in ASP.NET

 

In .Net the control can be considered as an object[textbox object,-----]

 

This can be classified into 2 types:

 

1.client side control

 

2.server side control

 

-> the control object created by browser is called

 

     “client side control”

 

<input type=”text”name=”t1”>

 

    It is an instruction to browse to create textbox object[client side control]

 

    This client side control object is not accessible with in server side codeing

 

<%

 

      T1.value=”—“->not accepted //text box will use serverside

 

-------

 

%>

 

HTML server controls:

 

->HTML server controls will provided similar syntax of client side controls to

 

Make migration easier.

 

->providing Run at=server to client side control becomes server side

 

Control, this makes conversion easier.

 

->HTML server controls are provided based the number of client side controls,

 

This area does not have any changes from asp.net1.0to asp.net4.0

 

Web server controls:

 

->webserver controls provides very rich functionality compare to

 

Html server controls,this are very advanced controls.

 

->webserver controls can be sub divided into following things:

 

1.standard controls

 

            Label,bullon,textbox,…….

 

2.validation controls

 

       Requiredfield validator,range validator,…….

 

3.data controls

 

     Gridview,listview,chart[new in asp.net4.0],….

 

4.navigation controls

 

      Menu,treeview,…..

 

5.webparts controls

 

    Webpartzone,…….

 

6.login controls

 

      Creat userwizard,….

 

7.Ajax extension controls

 

      Script manager,……..

 

->web server controls supports extensibility.

 

[Extensibility means Microsoft can introduce new controls from one version to another and developer can create user defined webserver controls]

 

->webserver controls provides xml based syntax.

 

<asp:controlname id=”- -“

 

Run at=”server”+properties>

 

</asp:control name>

 

Label control:label control can be used to display static text, this support positioning on web page,

 

This positioning is not possible

 

Using response.write->// its used in less times.

 

Textbox control:

 

->It allows user to edit data

 

->It call be used in the form of single line,multiline and

 

Pass word  type.

 

Button control:

 

  This control supports page submission.      ->client submit to data into server

 

Page submission  is the concept of client submitting data to webserver.

 

This can be classified into 2 things:

 

1.pastback submission

 

       The page submitting to itself is called”postback submission”.

 

2.cross page submission

 

      One webpage is submitting to another page is called”cross page submission”

 

Example for cross page submission:

 

->select new website with vs2010

 

  Location.-file system    e:\aspnet.103\crosspagesite

 

->add webform into site

 

    Name-login.aspx

 

[website menu->add new item->select webform]

 

->goto design view of webpage to place controls.

 

->the controls are provided with in tool box window

 

         [view menu->toolbox]

 

->clicking on source will complete webpage,content

 

    Generated by designer.

 

->select textbox1 and press f4

 

    [it will display properties window]

 

               Id-t1

 

->goto textbox2 props id-t2

 

Text mode-password

 

->button1 props

 

  Text –submit

 

Pastbackurl-validate.aspx

 

Note :

 

    Pastback url property requires destination page[page present in server]

 

To which data to be submitted.

 

->add webform

 

 Validate.aspx[this page purpose is reading data submitted by login page]

 

       ---

 

<body>

 

<%

 

string uname=Request.From[“t1”];

 

String pwd=Request.From[“t2”];

 

Response.Write(“welcome to “+uname);

 

//’+’ is concatenation operator in c#

 

%>

 

->F5[login.aspx]

 

Analyzing page submission:

 

Page submission depends on 2 things:

 

1.arrangement of data for transmission

 

2.reading data

 

Arrangement of data:

 

There are 2 methods for arranging data.

 

1.post method

 

2.get method

 

Differences between POST method and GET method.

 

                    Post                                                                 GET                               

 

1.the data will be arranged                       1.the data will be arranged with

 

Within http message body                       in http header

 

                                                                             [Appending to url]

 

2.it supports large amount of                  2.it supports small amount of

 

Data arrangement                                        data arrangement

 

                                                                    [maximum of 2kb]

 

3.It provides security for                           3.It doesn’t provide security

 

  Password type data                                   for password type

 

4.Transmission will be slow                      4.Transmission will be faster