Hi!! I have a master page in asp.net and a content page with some basic asp.net controls like textbox,buttons,treeview....i have a jquery script in the content page and reference set to the jquery file..The script changes the text property of a button on the
keydown event set for the textbox...the script works fine if i copy and paste it in a normal page...the script only ran once when i worte it for the first time the next day when i tried to run the script it was not working..i m facing this problem for running
the script in content page and i a m not aware of how to write jquery script for the content page.. i m really not finding any solution where i am wrong i have even tried setting the internet explorer security setting to low..plz plz plz plz plz plz help me
on Thanks!!
p.priyank
Member
49 Points
65 Posts
Problem running jquery script in Content Page
Sep 14, 2010 04:02 PM|LINK
Hi!! I have a master page in asp.net and a content page with some basic asp.net controls like textbox,buttons,treeview....i have a jquery script in the content page and reference set to the jquery file..The script changes the text property of a button on the keydown event set for the textbox...the script works fine if i copy and paste it in a normal page...the script only ran once when i worte it for the first time the next day when i tried to run the script it was not working..i m facing this problem for running the script in content page and i a m not aware of how to write jquery script for the content page.. i m really not finding any solution where i am wrong i have even tried setting the internet explorer security setting to low..plz plz plz plz plz plz help me on Thanks!!
JQuery with jquery
medelbrock
Member
729 Points
153 Posts
Re: Problem running jquery script in Content Page
Sep 14, 2010 05:06 PM|LINK
This is because your content page elements are actually renamed. Example:
If you use .NET 4.0 they have what they call "Predictable" IDs where you just append the content placeholder name then an underscore, then the ID.
Look at your page source when you debug in the browser and just copy those element IDs into your javascript.
Abdalmohayme...
Member
466 Points
89 Posts
Re: Problem running jquery script in Content Page
Sep 14, 2010 07:42 PM|LINK
writle your code
but when use button id you must specify the ClientId I mean
$("#<%=textboxid.ClientId%>")
$("#<%=buttonid.ClientId%>")
raghav_khung...
All-Star
32835 Points
5563 Posts
MVP
Re: Problem running jquery script in Content Page
Sep 14, 2010 08:30 PM|LINK
Please show your code..
hemant.yadav
Contributor
2263 Points
684 Posts
Re: Problem running jquery script in Content Page
Sep 15, 2010 05:21 AM|LINK
You can get your control in following way in master or normal page control
(1)
$("[id$=TextBox1]")
(2)
$("#<%=TextBox1.ClientID %>")
Can you share your code????
Please remember to click “Mark as Answer” on the post that helps you