Public Sub DropDownList1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DropDownList1.SelectedIndexChanged
Dim comboIndex As Integer
MsgBox(DropDownList1.SelectedIndex)
Dim ddl As DropDownList = Master.FindControl("cmbCulture")
comboIndex = DropDownList1.SelectedIndex
If ddl.SelectedIndex >= 0 Then
'comboIndex = ddl.SelectedValue
End If
MsgBox(DropDownList1.SelectedIndex)
comboIndex = ComboBox1.SelectedIndex
Dim sqlQuery As String
If comboIndex = 1 Then sqlQuery = "SELECT * FROM scale WHERE scaleName = 'Major'"
If comboIndex = 0 Then sqlQuery = "SELECT * FROM scale WHERE scaleName = 'Dominant7'"
sqlQuery = "SELECT * FROM scale"
我需要知道我从我的内容页面触发了我的母版页上的下拉列表的selectedvaluechanged事件(默认)。我在代码中放了一个消息框,所以我知道它已经到了那里,但我无法解决它。有谁知道怎么做?
答案 0 :(得分:0)
好的,之前我已经完成了,你可以做的是将方法公之于众,然后在内容页面中调用master的实例并调用你需要的方法。这篇文章应该对你有帮助 http://geekswithblogs.net/diadiora/archive/2008/12/01/call-a-method-from-masterpage-in-content-page.aspx
然后在VB.NET中看起来像 在内容页面
Dim master As SiteMaster = DirectCast(Page.Master, SiteMaster)
master.Method1()
主页中的
Public Sub Method1()
End Sub