Click here to Skip to main content
16,021,115 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
In ASP.NET, I have a textbox and a pop up search window which retrieves data with a link . When I selected the link window is closing but value is not populated in the text box for mozilla.
<script type="text/javascript"> 
       <!-- #include file="../jscripts/script368.js" -->     
     function newSearchWindow()
		{
		    
            cugval = window.showModalDialog('CUGSearch.aspx','CUGSearch','dialogWidth:900px;dialogHeight:600px;center:yes;status:no;');
					
			if (cugval != "")
			{
			alert(cugval);			 
			  document.forms[0].elements["<%=cugcode.ClientID%>"].value = cugval;	
			  alert( document.forms[0].elements["<%=cugcode.ClientID%>"].value);			  
			 document.forms[0].submit();
			}						
	   }  
    </script>

For all alerts value is populated but for cug text box value is not populated.
<input  type="text" id="cugcode" class="text" size="20" name="cugcode"  runat="server"  onchange="submit()"/> 
Posted
Updated 29-Mar-11 18:57pm
v4

Please try it like this:

C#
<script type="text/javascript" >
      <!-- #include file="../jscripts/script368.js" -->    
    function newSearchWindow()
    {
		    
        cugval = window.showModalDialog('CUGSearch.aspx','CUGSearch','dialogWidth:900px;dialogHeight:600px;center:yes;status:no;');
        if (cugval != "")
        {
            alert(cugval);			 
            var element = document.getElementById("<%=cugcode.ClientID%>");
            element.value = cugval;	
            alert( element.value);
            document.forms[0].submit();
       }						
   }  
</script>


Hope that helps!
 
Share this answer
 
v4
Comments
tulasi.k 1-Apr-11 0:21am    
Hi,
Thank's for the solution.But no luck ..It did not work.Actualy value is poulating for the first time.when i selected again another value from the pop up same problem is repeating.Is the problem with the code or settings in mozilla?
Manfred Rudolf Bihy 1-Apr-11 4:36am    
If it works once but not again after that there seems to be some kind of other problem. The best chance you have is to use the debugging tools for FireFox like FireBug for instance. If you have this example online I'd give debugging it a try myself, all you have to do is tell me the URL.
This sentence does doesn't make sense: "For all alerts value is not populated but for cug text box value is not populated" as it is the logical thing to happen.
If the alerts show that there is no value then why would you expect that the text box would be filled with anything?

Please clarify!

Cheers,
 
Share this answer
 
v2
Comments
#realJSOP 29-Mar-11 15:45pm    
Changed "does" to "doesn't".
Manfred Rudolf Bihy 29-Mar-11 15:58pm    
Actually I had that version first, but when I thought about it I changed it to "does". He just stated the obvious, a tautology so to say. :)
tulasi.k 30-Mar-11 0:58am    
Thanks.I modified my question, for alerts value is populating correctly but the value is not set to the textbox in mozilla.

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