Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
144 views
Welcome To Ask or Share your Answers For Others

1 Answer

Check the __EVENTTARGET and __EVENTARGUMENT variables on the post; these should match the values from the button that triggered the postback. That's at least the first clue...

Did you upgrade some third party DLL or upgrade from .NET 3.5 to .NET 4.0 or something like tha too?

HTH.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...