答案 0 :(得分:0)
按下按钮操作
Response.Redirect(“Your Page Name.aspx”)
并在该页面中调用您创建的BindGrid函数以绑定gridview
答案 1 :(得分:0)
您可以使用
重定向 Response.Redirect("GridView.aspx")
同时,您只能使用会话
来使用一个aspxProtected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Session.Add("CheckButton", Button1Clicked)
Response.Redirect("GridView.aspx")
End Sub
Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Session.Add("CheckButton", Button2Clicked)
Response.Redirect("GridView.aspx")
End Sub
之后在你的pageload上的GridView.aspx
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim CheckButton As String = Session("CheckButton")
Dim query As String
If (CheckButton = "Button1Clicked") Then
query = "SELECT * FROM Table1"
Else If (CheckButton = "Button2Clicked") Then
query = "SELECT * FROM Table2"
Else
Response.Write("<script>alert('Error!')</script>")
End If
SqlDataSource1.SelectCommand = query
SqlDataSource1.DataBind()
End Sub