【问题标题】:Vb.net button press automaticallyvb.net按钮自动按下
【发布时间】:2011-12-11 09:08:42
【问题描述】:

有什么方法可以在页面加载时自动按下网页上的按钮?

我在按钮上有以下代码来制作网格视图行

 Dim nos() As Integer = New Integer((Convert.ToInt32(10)) - 1) {}
        Dim i As Integer = 0
        Do While (i < nos.Length)
            nos(i) = (i + 1)
            i = (i + 1)
        Loop
        GridView1.DataSource = nos
        GridView1.DataBind()
        btnInsert.Visible = True
        btnInsert.Enabled = True
        GridView1.Focus()

我还在页面加载事件上粘贴了这段代码,但是当页面加载时,它没有获取要插入数据库的文本框值,它仅在从按钮执行此代码时获取值。这就是为什么我要求在页面加载时自动按下按钮

【问题讨论】:

  • 循环 ??这意味着另一个回发。

标签: asp.net vb.net


【解决方案1】:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
a()
End Sub


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
a()
End Sub


Sub a()
Dim nos() As Integer = New Integer((Convert.ToInt32(10)) - 1) {}
    Dim i As Integer = 0
    Do While (i < nos.Length)
        nos(i) = (i + 1)
        i = (i + 1)
    Loop
    GridView1.DataSource = nos
    GridView1.DataBind()
    btnInsert.Visible = True
    btnInsert.Enabled = True
    GridView1.Focus()
End Sub

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-10-11
    • 2017-01-18
    • 2016-11-05
    • 1970-01-01
    • 1970-01-01
    • 2015-07-13
    • 1970-01-01
    相关资源
    最近更新 更多