Click here to Skip to main content
15,897,718 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
actually i converted an aspx page to popup using JS ,but like before the textfields doesnot shows data anymore,plzz help.here are codes

JS code 4 popup:

JavaScript
function basicPopup() {
             //var imageCode = '<%=imageCode%>';


             var imageCode = document.getElementById('holdValue');
             popupWindow = window.open("ImageUpload.aspx?imageCode="+ imageCode  , 'popUpWindow', 'height=300,width=600,left=100,top=30,resizable=No,scrollbars=No,toolbar=no,menubar=no,location=no,directories=no, status=No');
             //popupWindow = window.open("ImageUpload.aspx" , 'popUpWindow', 'height=300,width=600,left=100,top=30,resizable=No,scrollbars=No,toolbar=no,menubar=no,location=no,directories=no, status=No');


         }






here imagecode is string used to fetch data.i want to show dta and pop up window on ONclick of button.here is my button code
C#
protected void btnUpload_Click(object sender, EventArgs e)
{

Response.Redirect("ImageUpload.aspx?imageCode=" + this.SelectedItem.ImageCode);


}
Posted
Updated 6-Sep-13 2:11am
v5
Comments
Thanks7872 6-Sep-13 7:30am    
Don't you think the title should be some what different?
ZurdoDev 6-Sep-13 7:34am    
What's your question? You are saying that a textbox does not show data but you didn't show the code where you fill in the textbox.
ashwani 12 6-Sep-13 7:46am    
i want to say the pop up is appearing now,but the selected data is not coming in "image upload" popup box.which was used to be when it was aspx page.
ashwani 12 6-Sep-13 7:51am    
<asp:Button runat="server" ID="btnUpload" Text="Upload Image" OnClientClick="return basicPopup();"
Visible="false" Width="129px" />
<asp:HiddenField ID="holdValue" runat="server" />

The logic in your code does not look right

On the button click you are redirecting the url to ImageUpload.aspx?imageCode=10 (assume the ID as 10) and this does not know anything about the javascript / the function
basicPopup()
to be called. so obviously the javascript would not get called

1. you have to amend the button so that it know that the javascript to be called on the button click

<asp:Button ID="Button1" runat="server" onClientClick="basicPopup();" Text="Button" />
This line of code says that on the buttn click the javascript to be called


2. Now move on and define your javascript

XML
<script type="text/javascript">
           function basicPopup() {



               var imageCode = document.getElementById('holdValue');
               popupWindow = window.open("ImageUpload.aspx?imageCode=1", 'popUpWindow', 'height=300,width=600,left=100,top=30,resizable=No,scrollbars=No,toolbar=no,menubar=no,location=no,directories=no, status=No');
               //popupWindow = window.open("ImageUpload.aspx" , 'popUpWindow', 'height=300,width=600,left=100,top=30,resizable=No,scrollbars=No,toolbar=no,menubar=no,location=no,directories=no, status=No');


           }
       </script>



This should work


The only reson, it may not work is that you have your javascript section in a wrong place. If does not work let me know with the description of area where you have defined your Javascript
 
Share this answer
 
Maybe try
JavaScript
popupWindow = window.open("ImageUpload.aspx?imageCode="+ imageCode+", 'popUpWindow', height=300,width=600,left=100,top=30,resizable=No,scrollbars=No,toolbar=no,menubar=no,location=no,directories=no, status=No");
 
Share this answer
 
Comments
ashwani 12 6-Sep-13 8:08am    
not working

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900