Search code examples
asp.netasp.net-3.5linkbutton

asp:linkbutton not functioning in production


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

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.

Thank you!

UPDATE

  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.

...still plugging away at it

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... :-)


Solution

  • 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.