0

我将两个文本字段放在一个网格中。一个是日历,在文本字段之外我放置了日历按钮。这是问题所在:

网格线包含 600 行。例如,如果我在选择日历图像后选择第 200 行或第 300 行,则它正在向上移动......这意味着光标位置正在移动到前 1 到 50 行。我该如何解决?因此,如果我选择 100 200 处的图像,它会再次向上移动,然后再选择日期。

这是我在图像按钮单击时的代码:

Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
    Dim Cnt, Rowcnt As Integer
    Rowcnt = Gridview1.Rows.Count
    Dim rowindex As Integer = Convert.ToInt32(Gridview1.SelectedRow)
    Dim gvr As GridViewRow = Gridview1.Rows(rowindex)
    Dim btnEdit As ImageButton = TryCast(sender, ImageButton)
    Dim row As GridViewRow = DirectCast(btnEdit.NamingContainer, GridViewRow)
    Dim introwindex As Integer
    introwindex = row.RowIndex

    For Cnt = 0 To Rowcnt
        If (Cnt = introwindex) Then
            cal1 = DirectCast(Gridview1.Rows(Cnt).FindControl(("Calendar1")), Calendar)
            cal1.Visible = True
            Exit For
        End If
    Next

End Sub
4

1 回答 1

0

如果您使用的是网络表单,请查看MaintainScoolPositionOnPostback属性。这可能会帮助你。

于 2013-09-10T06:15:51.977 回答