버튼이 있습니다. 내 페이지로드시이 명령을 사용하지 않으려 고합니다. 버튼에서 페이지를 클릭했는지 확인하는 방법
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가 처음 호출되는 경우 변경 공용 속성을 설정했습니다.
비슷한 질문 http://stackoverflow.com/questions/11333305/asp-net-determine-which-button-was-clicked-inside-an-updatepanel-in-page-load-ev – Kratz
정말 플러스 사실 그것은 대답하지 못했습니다. –
위의 Kratz 링크의 첫 번째 대답은 작동합니다. If Page.IsPostBack에서 'getPostBackControlID' 함수를 호출 한 다음 출력을 버튼의 ID와 비교하십시오. – Chaithanya