image button event handler
-
why is this so? when i click on the imgbtn, the whole tables is gone and display nothing. What should i do? Dim img As New ImageButton AddHandler img.Click, AddressOf ImageClickHandler img.ImageUrl = Server.MapPath("Pics\pencil.gif") Private Sub ImageClickHandler(ByVal sender As Object, ByVal e As ImageClickEventArgs) Session.Add("newdate", lblDate.Text) Dim dt As Date = CType(Session("newdate"), Date) Server.Transfer("LoginCalendarMakeBooking.aspx?BookingDate= " & dt & "ResourceName=" & name & "ResourceType=" & type) End Sub Anything wrong with this?
-
why is this so? when i click on the imgbtn, the whole tables is gone and display nothing. What should i do? Dim img As New ImageButton AddHandler img.Click, AddressOf ImageClickHandler img.ImageUrl = Server.MapPath("Pics\pencil.gif") Private Sub ImageClickHandler(ByVal sender As Object, ByVal e As ImageClickEventArgs) Session.Add("newdate", lblDate.Text) Dim dt As Date = CType(Session("newdate"), Date) Server.Transfer("LoginCalendarMakeBooking.aspx?BookingDate= " & dt & "ResourceName=" & name & "ResourceType=" & type) End Sub Anything wrong with this?
Nothing seems to be wrong -- if Server.Transfer() is the method you wish to use and LoginCalendarMakeBooking.aspx is the page you want to transfer to. What is that page supposed to do? Why would you use Server.Transfer as opposed to using Response.Redirect()? What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
-
why is this so? when i click on the imgbtn, the whole tables is gone and display nothing. What should i do? Dim img As New ImageButton AddHandler img.Click, AddressOf ImageClickHandler img.ImageUrl = Server.MapPath("Pics\pencil.gif") Private Sub ImageClickHandler(ByVal sender As Object, ByVal e As ImageClickEventArgs) Session.Add("newdate", lblDate.Text) Dim dt As Date = CType(Session("newdate"), Date) Server.Transfer("LoginCalendarMakeBooking.aspx?BookingDate= " & dt & "ResourceName=" & name & "ResourceType=" & type) End Sub Anything wrong with this?
Most likely ... When doing the Server.Transfer it becomes the first request for the page (URL is different) and loses the ViewState because it is not a PostBack. Just my stab in the dark.
Wally Atkins
Newport News, VA, USA
http://wallyatkins.com