【发布时间】:2012-11-25 18:00:33
【问题描述】:
我有一个按钮,我不想在我的页面加载中导致这个 if 命令。
If Page.IsPostBack Then
ViewState(2) = TreeView1.SelectedNode.ValuePath
ViewState(5) = TextBox1.Text
''Where I would like to put another if command or whatever else is possible to check if the buttong was clicked''
If ViewState(2) = ViewState(1) And ViewState(5) = ViewState(4) Then
nodecount = ViewState(3)
nodecount = nodecount + 1
ViewState(3) = nodecount
If nodecount > 0 Then
MsgBox("Please select another option or different number of data points")
End If
Else
nodecount = 0
ViewState(3) = nodecount
End If
End If
我尝试设置一个公共属性以更改如果单击按钮但 page.ispostback 先被调用然后子调用。
【问题讨论】:
-
不是真的加上没有回答的事实。
-
来自 Kratz 的上述链接中的第一个答案确实有效 - 只需在
If Page.IsPostBack中调用getPostBackControlID函数,然后将输出与按钮的 id 进行比较。
标签: asp.net vb.net events button