User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 456,611 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,441 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 7914 | Replies: 10
Reply
Join Date: Nov 2007
Posts: 28
Reputation: u4umang2001 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
u4umang2001's Avatar
u4umang2001 u4umang2001 is offline Offline
Light Poster

Question drop down list selected index change doesn't work in mozilla

  #1  
Nov 7th, 2007
Hi

i want to bind a drop down list on the other drop down list selected index change event. i m using the following code---
ddlid.Attributes.Add("onchange","javascript:callfunction(this);")

function is written in a seperate js file.

this works in IE but not in Mozilla... plz give me the solution so that it will work in Mozilla also

Thanks
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2007
Posts: 1,058
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: drop down list selected index change doesn't work in mozilla

  #2  
Nov 7th, 2007
try moving the function to your current file and see if it fixes your problem. Also, make sure your file is included before you call the function.
Reply With Quote  
Join Date: Nov 2007
Posts: 28
Reputation: u4umang2001 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
u4umang2001's Avatar
u4umang2001 u4umang2001 is offline Offline
Light Poster

Re: drop down list selected index change doesn't work in mozilla

  #3  
Nov 8th, 2007
if i put that function ( which is written in a seperate js file) in the same file then it works...
i have included the js file also, but if this function is written in the js then it is not working,
please solve my this problem also
and thanks 4 solving my background-color code problem...
bbye
Thanks & Regards
Umang
Reply With Quote  
Join Date: Sep 2007
Posts: 1,058
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: drop down list selected index change doesn't work in mozilla

  #4  
Nov 8th, 2007
This is because you are compiling your page before the javascript runs. Try adding the javascript to your page before you call your code. Example is below:
If Not Page.IsPostBack Then
  If Not Page.IsClientScriptBlockRegistered("IncludedJavascript") Then
    Page.RegisterClientScriptBlock("IncludedJavascript", "<SCRIPT Language=""JavaScript"" src=""javascriptincludedfile.js""></SCRIPT>")
  End If
  ddlid.Attributes.Add("onchange","javascript:callfunction(this);")
End If
Last edited by SheSaidImaPregy : Nov 8th, 2007 at 1:03 pm.
Reply With Quote  
Join Date: Sep 2007
Posts: 1,058
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: drop down list selected index change doesn't work in mozilla

  #5  
Nov 8th, 2007
if you wish to know more about this stuff, microsoft has a good article on it.

http://msdn2.microsoft.com/en-us/library/aa478975.aspx
Reply With Quote  
Join Date: Nov 2007
Posts: 28
Reputation: u4umang2001 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
u4umang2001's Avatar
u4umang2001 u4umang2001 is offline Offline
Light Poster

Re: drop down list selected index change doesn't work in mozilla

  #6  
Nov 12th, 2007
Hi, i m using the following code but it is not working...

if(!Page.IsPostBack)
{
if(!Page.IsClientScriptBlockRegistered("scriptcode"))
{
Page.RegisterClientScriptBlock("scriptcode","<script language=javascript src=\"scriptcode.js\"></script>");
}
}


actually that drop down is pasted on a user control and the user control is pasted on a page. i have written this code on the both page user control and the actual page, but it is not working....
what should i do???
Thanks & Regards
Umang
Reply With Quote  
Join Date: Sep 2007
Posts: 1,058
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: drop down list selected index change doesn't work in mozilla

  #7  
Nov 12th, 2007
first check to see if your code is executing correctly. add a write command right after your scriptcode src segment and run the page. If it posts, and your script isn't executing let me know.
Reply With Quote  
Join Date: Nov 2007
Posts: 28
Reputation: u4umang2001 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
u4umang2001's Avatar
u4umang2001 u4umang2001 is offline Offline
Light Poster

Re: drop down list selected index change doesn't work in mozilla

  #8  
Nov 13th, 2007
if i write on the page
Page.RegisterClientScriptBlock("scriptcode","<script language=javascript src=\"scriptcode.js\"></script>");
Response.Write("<script>alert('hit');</script>");

it shows the message hit.
but if i write the same code on the user control it doesn't show the message.
Thanks & Regards
Umang
Reply With Quote  
Join Date: Sep 2007
Posts: 1,058
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: drop down list selected index change doesn't work in mozilla

  #9  
Nov 13th, 2007
then I guess the only thing I can suggest to you is put your code on that page instead of in the include file. I've had that problem before and that was the way I solved it. Sorry that I can't be of more assistance. Try the javascript forum as well!
Reply With Quote  
Join Date: Nov 2007
Posts: 28
Reputation: u4umang2001 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
u4umang2001's Avatar
u4umang2001 u4umang2001 is offline Offline
Light Poster

Re: drop down list selected index change doesn't work in mozilla

  #10  
Nov 13th, 2007
its ok and THANKS A LOT for that much assistance...
see u later with another problem
till than bye and take care
Thanks & Regards
Umang
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 7:18 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC