asp:linkbutton在生产中不起作用 [英] asp:linkbutton not functioning in production

查看:131
本文介绍了asp:linkbutton在生产中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp:linkbutton,如下:

I've got an asp:linkbutton as follows:

<asp:LinkButton ID="lb_new" runat="server" ForeColor="White">New Item</asp:LinkButton>


Protected Sub lb_new_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lb_new.Click
    ViewState("ItemID") = "0"
    Dim myURL As String
    myURL = String.Format("D002.aspx?e={0}&i={1}", ViewState("EventID"), ViewState("ItemID"))
    Response.Redirect(myURL)
End Sub

直到最近,它仍然可以正常工作.但是由于某种原因,它已经停止生产.据我所知,它根本不与它的代码隐藏连接(我试图对其进行修改以仅更改页面上一个文本框中的文本,并且同样失败).如果我通过Visual Studio运行网站,仍然可以使用.但是,一旦我发布到生产服务器,它就不再起作用.

Up until recently, it has functioned as it should. But for some reason, it has stopped working in production. As far as I can tell, it's not connecting to it's code-behind at all (I tried modifying it to simply change the text in one of the text boxes ont he page, and it fails that as well). Still works if I run the website through visual studio. But as soon I publish to our production server, it no longer works.

我很困惑-仍然在摆弄它.

I'm stumped -- and still fiddling with it.

如果有人经历过,请分享.现在已经讨论了几个小时,并且没有想法.

If anyone has experienced this, please share. Have been on this for a couple hours now, and am out of ideas.

谢谢!

更新

  1. 事件处理程序已被一些人建议为缺少.实际上,这是在"Handles"子句(...Handles lb_new.Click)后面的代码中处理的.
  2. 手动删除生产文件夹中的项目,然后重新发布.不高兴.
  3. 验证生产文件夹中的文件是新文件.
  4. 我创建了一个全新的链接按钮-它也无法连接到其代码隐藏的位置
  5. 我在标记中添加了一个Onclick =.考虑到后面的代码中的Handles子句,这不是必须的.无论如何,点击仍然会失败.
  1. The event handler has been suggested as missing by a couple of folks. This is actually handled in the code-behind by the 'Handles' clause (...Handles lb_new.Click).
  2. Manually deleted the items in the production folder, then re-published. No joy.
  3. Verified the files in the production folder are the new ones.
  4. I created a brand new linkbutton -- it fails to connect to it's code-behind as well
  5. I added an Onclick= to the mark-up. This shouldn't be necessary, considering the Handles clause in the code-behind. Regardless, the click still fails.

...仍然堵住它

UPDATE2

在页面上删除了必需的字段验证器,并且它可以工作.这对我来说没有任何意义,因为我在页面上还有其他控件导致回发,而这些控件在整个过程中仍然有效.另外,我已经填写了要验证的字段,因此(我能想到)没有任何理由验证者会阻止回发.

Removed the required field validators on the page, and it works. This does not make sense to me, because I had other controls on the page causing postbacks, and they still worked the whole time. Also, I had the fields that were being validated filled-in, so no reason (I can think of) that the validators would have been preventing the postback.

现在,我只需要弄清楚如何在没有必需的字段验证器的情况下在页面上进行验证.

Now I just have to figure out how to do validation on the page without the required field validators.

...困惑...:-)

...confused... :-)

推荐答案

验证控件阻止了回发-或至少删除了这些控件似乎已经解决了问题.这对我来说没有意义,因为我还有其他选择页面上的控件导致回发,并且它们始终一直有效.另外,我已经填写了要验证的字段,因此(我能想到)没有任何理由验证者会阻止回发.无论如何,感谢大家的所有想法.

Validation controls were preventing a postback -- or at least, removing those controls seems to have solved the problem This does not make sense to me, because I had other controls on the page causing postbacks, and they still worked the whole time. Also, I had the fields that were being validated filled-in, so no reason (I can think of) that the validators would have been preventing the postback. Anyway, thanks to everyone for all the ideas.

这篇关于asp:linkbutton在生产中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆