我的解决方案中有多个子目录,其中包含default.aspx页面,所以当我使用url:
http://www.mysite.com/products/
其中products是上述子目录,它显示了目录中default.aspx页面的内容。
每当页面上发生初始回发时,网址就会变为:
http://www.mysite.com/products/default.aspx
导致回发的事件被触发,但不会产生该事件的结果 即(Gridview不受新结果约束)
如果我最初导航到页面
http://www.mysite.com/products/default.aspx
然后一切都按照第一枪的预期发生。所以我假设它与使用URL而不是特定代码有关?
对此问题的任何反馈都将不胜感激。
这是通过onclick事件执行的,我在listview中的按钮会触及最后一行,但不会交换文本(url更改):
Protected Sub PrepareNewReason(ByVal sender As Object, ByVal e As EventArgs)
ListView1.EditIndex = -1
If CType(sender, Control).ID = "addReason1" Then
' We are on top of the list show entry row on top
ListView1.InsertItemPosition = InsertItemPosition.FirstItem
Else
ListView1.InsertItemPosition = InsertItemPosition.LastItem
End If
ListView1.FindControl("addReason1").Visible = False
ListView1.FindControl("addReason2").Visible = False
Label1.Text = "This Line was hit"
End Sub
答案 0 :(得分:2)
这可能与URL更改无关。尝试更简单的改变。在页面上放置一个标签,并从触发PostBack的事件中更改标签文本。
答案 1 :(得分:1)
不确定这是否有帮助。可能是Web.Config中的一个设置。