Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: When HyperLink is clicked, Page_Load executes Twice


Message #1 by "dHABUD" <dhabud@h...> on Thu, 21 Nov 2002 08:11:18
Hi

When I click hyperlink on page1.aspx, the Page_Load() in page2.aspx gets 
executed twice.

In page1.aspx
Sub CreateHyperLink(O -----, e -------)
hypLnk = New	HyperLink()
hypLnk.NavigateUrl="/page2.aspx?ImgID=" & imagelink
hypLnk.Text=	"example Image"
hypLnk.Visible=True
End Sub

In Page2.aspx

Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) 
Handles MyBase.Load
Dim ImgString As String = Request("ImgID")
Response.Write(ImgString)
End Sub

These Response.Write gets written twice.

Any Suggestion on this.

Thanks A Lot
Dhabud
Message #2 by "dHABUD" <dhabud@h...> on Thu, 21 Nov 2002 08:27:40
Hi

Got this working, I changed the Page_Load arguments to
Page_Load(obj as Object, e as EventArgs)
From
Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) 

Dhabud

> Hi

> When I click hyperlink on page1.aspx, the Page_Load() in page2.aspx gets 
e> xecuted twice.

> In page1.aspx
S> ub CreateHyperLink(O -----, e -------)
h> ypLnk = New	HyperLink()
h> ypLnk.NavigateUrl="/page2.aspx?ImgID=" & imagelink
h> ypLnk.Text=	"example Image"
h> ypLnk.Visible=True
E> nd Sub

> In Page2.aspx

> Sub Page_Load(ByVal sender As System.Object, ByVal e As 
System.EventArgs) 
H> andles MyBase.Load
D> im ImgString As String = Request("ImgID")
R> esponse.Write(ImgString)
E> nd Sub

> These Response.Write gets written twice.

> Any Suggestion on this.

> Thanks A Lot
D> habud

  Return to Index