Thursday, November 7, 2013

ASP.NET การอ้างถึง Control ใน MasterPage

ใน MasterPage

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Me.Page.IsPostBack Then
            Dim A1() As String = {"Food", "Drinks", "Dessert"}
            DropDownList1.DataSource = A1
            DropDownList1.DataBind()
        End If
    End Sub



Code ในหน้า TestPage
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim M1 As MasterPage = Me.Master
        Dim dx As DropDownList = M1.FindControl("DropDownList1")
        TextBox2.Text = dx.SelectedValue
    End Sub

1 comment:

  1. there are lots of projects available on www.projecttunnel.com where you can download php project with source code

    ReplyDelete