implant


  Aktif KonularAktif Konular  Forum Üyelerini GösterÜye Listesi  Forumu AraArama  YardımYardım
  Kayıt OlKayıt Ol  GirişGiriş
ASP / ASP.NET
 ASPTurkiye.com Forum : ASP / ASP.NET
Konu Konu: dropdownlist kodlarının açıklaması Yanıt YazYeni Konu Gönder
Yazanlarda
Mesaj << Önceki Konu | Sonraki Konu >>
appiah-54-
Yeni Üye
Yeni Üye


Kayıt Tarihi: 26-Nisan-2009
Ülke: Türkiye
Gönderilenler: 1
Gönderen: 26-Nisan-2009 Saat 19:18 | Kayıtlı IP Alıntı appiah-54-

bu programın ne işe yaradıgını ve dropdownlist hakkında
bilgi yazarmısınız acil lazım lütfen şimdiden
tesekkurler
2 ÖRNEKTEN BİRİN YAPARSANISIZN SEVNİRİM



ÖRNEK1
<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="Default.aspx.vb" Inherits="MyPage" %>

<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: 151px; position: absolute;
             top: 120px" Text="What is the
date"></asp:Label>
        <asp:Label ID="result" runat="server"
Height="25px" Style="z-index: 101; left: 159px;
             position: absolute; top: 242px" Text="Label"
Width="324px"></asp:Label>
        <asp:DropDownList ID="DropDownList1"
runat="server" AutoPostBack="True" Height="48px"
             Style="z-index: 102; left: 274px; position:
absolute; top: 118px" Width="243px">
        </asp:DropDownList>
        <asp:Button ID="Button1" runat="server"
Style="z-index: 104; left: 393px; position: absolute;
             top: 168px" Text="OK" />
     
    </div>
    </form>
</body>
</html>


File: Default.aspx.vb


Partial Class MyPage
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(ByVal sender As Object,
ByVal e As System.EventArgs) Handles Button1.Click
        Select Case Me.DropDownList1.SelectedIndex
             Case 0
                Me.result.Text = "A"
             Case 1
                Me.result.Text = "B"
             Case 2
                Me.result.Text = "C"
             Case 3
                Me.result.Text = "D"
             Case 4
                Me.result.Text = "E"
             Case 5
                Me.result.Text = "F"
             Case 6
                Me.result.Text = "G"
             Case 7
                Me.result.Text = "H"
             Case 8
                Me.result.Text = "I"
             Case 9
                Me.result.Text = "J"
             Case 10
                Me.result.Text = "K"
             Case 11
                Me.result.Text = "L"
        End Select

    End Sub

    Protected Sub Page_Load(ByVal sender As Object,
ByVal e As System.EventArgs) Handles Me.Load
        If Page.IsPostBack = False Then
             Me.DropDownList1.Items.Add("A")
             Me.DropDownList1.Items.Add("B")
             Me.DropDownList1.Items.Add("C")
             Me.DropDownList1.Items.Add("D")
             Me.DropDownList1.Items.Add("E")
             Me.DropDownList1.Items.Add("F")
             Me.DropDownList1.Items.Add("G")
             Me.DropDownList1.Items.Add("H")
             Me.DropDownList1.Items.Add("I")
             Me.DropDownList1.Items.Add("J")
             Me.DropDownList1.Items.Add("K")
             Me.DropDownList1.Items.Add("L")
        End If

    End Sub
End Class



ÖRNEK 2
<%@ Page Language="C#" %>

<script runat="server">
    protected void
DropDownList1_SelectedIndexChanged(object sender,
EventArgs e)
    {
        string[] CarArray = new string[4] {"Ford",
"Honda", "BMW", "Dodge"};
        string[] AirplaneArray = new string[3] {"Boeing
777", "Boeing 747","Boeing 737"};
        string[] TrainArray = new string[3] {"Bullet
Train", "Amtrack", "Tram"};
       
        if (DropDownList1.SelectedValue == "Car") {
             DropDownList2.DataSource = CarArray; }
        else if (DropDownList1.SelectedValue ==
"Airplane") {
             DropDownList2.DataSource = AirplaneArray; }
        else {
             DropDownList2.DataSource = TrainArray;
        }
               
        DropDownList2.DataBind();
        DropDownList2.Visible = true;
    }

    protected void Button1_Click(object sender,
EventArgs e)
    {
        Response.Write("You selected <b>" +
            DropDownList1.SelectedValue.ToString() + ": "
+
            DropDownList2.SelectedValue.ToString() +
"</b>");
    }
</script>


<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>DropDownList Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        Select transportation type:<br />
        <asp:DropDownList ID="DropDownList1"
                            Runat="server"
                            
OnSelectedIndexChanged="DropDownList1_SelectedIndexChang
ed"
                            AutoPostBack="true">
             <asp:ListItem>Select an Item</asp:ListItem>
             <asp:ListItem>Car</asp:ListItem>
             <asp:ListItem>Airplane</asp:ListItem> ;
             <asp:ListItem>Train</asp:ListItem>
        </asp:DropDownList>
        <asp:DropDownList ID="DropDownList2"
Runat="server" Visible="false">
        </asp:DropDownList>
        <asp:Button ID="Button1" Runat="server"
Text="Select Options"
        OnClick="Button1_Click" />
    </div>
    </form>
</body>
</html>

TEKRAR TEŞEKKÜRLER
Yukarı Dön Göster appiah-54-'s Özellikler Diğer Mesajlarını Ara: appiah-54-
 
özgenur
Yeni Üye
Yeni Üye


Kayıt Tarihi: 16-Mayıs-2012
Ülke: Turkiye
Gönderilenler: 20
Gönderen: 16-Mayıs-2012 Saat 16:48 | Kayıtlı IP Alıntı özgenur

<%@ Page Language="C#" AutoEventWireup="True" %>
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls" Assembly="Samples.AspNet.CS" %>
<!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>
    <title>Custom DropDownList - BorderColor - C# Example</title>
    <script runat="server">
      private void Page_Load(object sender, System.EventArgs e)
      {
          DropDownList1.Items.Add(new ListItem("Item1", "Item1"));
          DropDownList1.Items.Add(new ListItem("Item2", "Item2"));
          DropDownList1.Items.Add(new ListItem("Item2", "Item2"));
      }
    </script>
  </head>
  <body>
      <form id="Form1" method="post" runat="server">
          <h3>Custom DropDownList - BorderColor - C# Example</h3>

          <aspSample:CustomDropDownListBorderColor
          id="DropDownList1"
          runat="server" />

      </form>
  </body>
</html>


...


using System.Web;
using System.Security.Permissions;

namespace Samples.AspNet.CS.Controls
{
    [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
    public sealed class CustomDropDownListBorderColor : System.Web.UI.WebControls.DropDownList
    {
    [System.ComponentModel.Browsable(false)]
    public override System.Drawing.Color BorderColor
    {
      // NOTE: The BorderColor property is inherited from the WebControl
      // class and is not applicable to the DropDownList control.
      get
      {
        return base.BorderColor;
      }
      set
      {
        base.BorderColor = value;
      }
    }

    public override System.Web.UI.WebControls.BorderStyle BorderStyle
    {
      // NOTE: The BorderStyle property is inherited from the WebControl
      // class and is not applicable to the DropDownList control.
      get
      {
        return base.BorderStyle;
      }
      set
      {
        base.BorderStyle = value;
      }
    }

    public override System.Web.UI.WebControls.Unit BorderWidth
    {
      // NOTE: The BorderWidth property is inherited from the WebControl
      // class and is not applicable to the DropDownList control.
      get
      {
        return base.BorderWidth;
      }
      set
      {
        base.BorderWidth = value;
      }
    }

    public override string ToolTip
    {
      // NOTE: The ToolTip property is inherited from the WebControl
      // class and is not applicable to the DropDownList control.
      get
      {
        return base.ToolTip;
      }
      set
      {
        base.ToolTip = value;
      }
    }
  }
}

Yukarı Dön Göster özgenur's Özellikler Diğer Mesajlarını Ara: özgenur
 

Eğer Bu Konuya Cevap Yazmak İstiyorsanız İlk Önce Giriş
Eğer Kayıtlı Bir Kullanıcı Değilseniz İlk Önce Kayıt Olmalısınız

  Yanıt YazYeni Konu Gönder
Yazıcı Sürümü Yazıcı Sürümü

Forum Atla
Kapalı Foruma Yeni Konu Gönderme
Kapalı Forumdaki Konulara Cevap Yazma
Kapalı Forumda Cevapları Silme
Kapalı Forumdaki Cevapları Düzenleme
Kapalı Forumda Anket Açma
Açık Forumda Anketlerde Oy Kullanma

Powered by Web Wiz Forums version 7.91
Copyright ©2001-2004 Web Wiz Guide

Bu Sayfa 0,1094 Saniyede Yüklendi.