Connecting Tech Pros Worldwide Help | Site Map

Help in updating a aspImage in Repeater with JS

Newbie
 
Join Date: Jan 2008
Posts: 1
#1: Jan 24 '08
HI guys im fed up with this help me

The problem is..



Im having a repeater control in which im having a aspImage Control [asp:Image id="imgAImageUpload"]..just near to it is a href placed

Both are placed in a repeater Row as a RowContrl


When user clicks on href...a popup is opened up that shows a UI for Uploading the Image....when user clicks browse and saves the image...that image is reflected back in imgAImageUpload (the image contrl)..the idea is when user uploads the image file against the aspImage...im dynamicallly changing the src property of that control through a dynamically generated Javascript written on server side of that popup



The code is running fine in IE but mozilla is giving an error

The error is : "self.opener.parent.forms[0].elements.ctl00_ContentPlaceHolder1_rptAnswer_ctl0 2_imgAImageUpload has no properties"



The code is as follows : -



When popup gets opened up user clickcs on browse button and selects file-> clicks upload

Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click

Dim ss As String = "<Script language=JavaScript> "
ss += "try{"
ss += "self.parent.opener.document.forms[0].elements['" & imageControl & "'].src='" & Replace(path, "~/", "../../") & fName & fileExtension & "';"
ss += "self.close();"
ss += "}catch(e){window.alert(e.message);}"
ss += "</Script>"
If (Not Me.ClientScript.IsClientScriptIncludeRegistered("S tartup")) Then
Me.ClientScript.RegisterStartupScript(Me.GetType() , "Startup", ss)
End If

End Sub

After this the popup gets closed and the Parent window from where the popup was opened...in that the Repeater which is having that aspImage gets refreshed with the ImageUploaded

Morever i have placed that repeater in an Atlas:UpdatePanel

The code is running fine in IE but not working in Mozilla
kenobewan's Avatar
Moderator
 
Join Date: Dec 2006
Posts: 4,745
#2: Jan 24 '08

re: Help in updating a aspImage in Repeater with JS


You need to detect browser and may need to take separate actions on each. HTH.
Reply