ASP.NET NEDİR? ASP.NET ÖRNEK PROGRAM KODLARI

h-Session Nesnesi:

Session'un amacı sayfalar arası veri taşımaktır.Tabi RAM den yiyerek.

DEFAULT SAYFASININ HTML KODU:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title>Untitled Page</title>

</head>

<body>

    <form id="form1" runat="server">

        <asp:ScriptManager ID="ScriptManager1" runat="server" />

        <div>

            <asp:TextBox ID="TextBox1" runat="server" Style="z-index: 102; left: 21px; position: absolute;

                top: 75px"></asp:TextBox>

            <asp:Button ID="Button1" runat="server" Height="25px" OnClick="Button1_Click" Style="z-index: 102;

                left: 208px; position: absolute; top: 75px" Text="Button" Width="60px" />

        </div>

    </form>

</body>

</html>

DEFAULT SAYFASININ C#  KODU:

using System;

using System.Data;

using System.Configuration;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

 

public partial class _Default : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

 

    }

    protected void Button1_Click(object sender, EventArgs e)

    {

        //web config de çeşitli düzenlemeler de yaptık onlara bkarsın

        Session["adi"] = TextBox1.Text;

        Response.Redirect("page2.aspx");

        //Session["adi"] = ""; ile adi isimli sessionumuz sıfırlanır

        //Session.Abandon(); ile tüm sessionlar sıfırlanır

    }

}

İKİNCİ SAYFANIN HTML KODU:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="page2.aspx.cs" Inherits="page2" %>

 

<!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 runat="server">

    <title>Untitled Page</title>

</head>

<body>

    <form id="form1" runat="server">

    <div>

        <asp:Label ID="Label1" runat="server" Style="z-index: 100; left: 41px; position: absolute;

            top: 74px"></asp:Label>

        <asp:Button ID="Button1" runat="server" Height="26px" OnClick="Button1_Click" Style="z-index: 102;

            left: 154px; position: absolute; top: 68px" Text="session id i göster" Width="129px" />

   

    </div>

    </form>

</body>

</html>

İKİNCİ SAYFASININ C#  KODU:

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

 

public partial class page2 : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

        Label1.Text = Session["adi"].ToString() ;

    }

    protected void Button1_Click(object sender, EventArgs e)

    {

        Response.Write(Session.SessionID);

    }

}

ı-Wizard Kontrolü:

 

 

HTML KODU:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title>Untitled Page</title>

</head>

<body>

    <form id="form1" runat="server">

        <asp:ScriptManager ID="ScriptManager1" runat="server" />

        <div>

            <asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="2" BackColor="#EFF3FB" BorderColor="#B5C7DE"

                BorderWidth="1px" FinishCompleteButtonText="bitti" FinishPreviousButtonText="geri"

                Font-Names="Verdana" Font-Size="0.8em" Height="182px" OnFinishButtonClick="Wizard1_FinishButtonClick"

                StartNextButtonText="ileri" StepNextButtonText="ileri" StepPreviousButtonText="geri"

                Width="510px">

                <StepStyle Font-Size="0.8em" ForeColor="#333333" />

                <WizardSteps>

                    <asp:WizardStep runat="server" Title="Kişisel Bilgiler">

                        <asp:Label ID="Label1" runat="server" Text="Adı:"></asp:Label>

                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

                    </asp:WizardStep>

                    <asp:WizardStep runat="server" Title="&#214;zel Bilgiler">

                        <asp:Label ID="Label2" runat="server" Text="Hesap Numarası:"></asp:Label>

                        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>

                    </asp:WizardStep>

                    <asp:WizardStep runat="server" Title="Adres Bilgileri">

                        <asp:Label ID="Label3" runat="server" Text="Adres:"></asp:Label>

                        <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>

                    </asp:WizardStep>

                </WizardSteps>

                <SideBarButtonStyle BackColor="#507CD1" Font-Names="Verdana" ForeColor="White" />

                <NavigationButtonStyle BackColor="White" BorderColor="#507CD1" BorderStyle="Solid"

                    BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284E98" />

                <SideBarStyle BackColor="#507CD1" Font-Size="0.9em" VerticalAlign="Top" />

                <HeaderStyle BackColor="#284E98" BorderColor="#EFF3FB" BorderStyle="Solid" BorderWidth="2px"

                    Font-Bold="True" Font-Size="0.9em" ForeColor="White" HorizontalAlign="Center" />

            </asp:Wizard>

            &nbsp;&nbsp;

            <table style="width: 287px; height: 95px">

                <tr>

                    <td style="width: 100px">

                        Adı:</td>

                    <td style="width: 100px">

                        <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox></td>

                </tr>

                <tr>

                    <td style="width: 100px">

                        Hesap Numarası:</td>

                    <td style="width: 100px">

                        <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox></td>

                </tr>

                <tr>

                    <td style="width: 100px">

                        Adresi:</td>

                    <td style="width: 100px">

                        <asp:TextBox ID="TextBox6" runat="server"></asp:TextBox></td>

                </tr>

            </table>

        </div>

    </form>

</body>

</html>

C# KODU:

using System;

using System.Data;

using System.Configuration;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

 

public partial class _Default : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

 

    }

    protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)

    {

        //Wizard1_FinishButtonClick buraya gelebilmek için wizard a çift tıklarız

        TextBox4.Text = TextBox1.Text;

        TextBox5.Text = TextBox2.Text;

        TextBox6.Text = TextBox3.Text;

 

    }

}

 


ÜCRETSİZ KPSS VİDEO DERSLER, TESTLER BURADA TIKLAYINIZ


BENZER KONULARI SİTE İÇİNDE ARAYIN










  • SİTE İÇİ ARAMA
  • Kariyerdersleri.com
  • KATEGORİLER
  • HAKKIMIZDA
Mutlu olmayı yarına bırakmak, karşıya geçmek için nehrin durmasını beklemeye benzer ve bilirsin, o nehir asla durmaz.
KPSS MATEMATİK KPSS GEOMETRİ KPSS VATANDAŞLIK KPSS TÜRKÇE KPSS TARİH KPSS COĞRAFYA
İNGİLİZCE ALMANCA İTALYANCA KARİYER OYUN BİLGİSAYAR YAZILIM BİLGİSAYAR NETWORK
BİLGİSAYAR DONANIM BİLİŞİM TERİMLERİ CİLT VE CİLT BAKIMI HASTALIKLARIMIZ İNSAN VÜCUDU NEDİR