It is just the name of my div. The syntax works fine if the div is in my content page (by eliminating the Master.), but this div is in a master page. I have it declared in codebehind of the master page as a public control and can access it with javascript
using the traditional document.getElemtentBy ID…. but want to access it with jquery.
when a masterpage is used and the control is in the master page then its Client ID Doesn't change but when the Control is in the content Page then its control is changed. so first find out the length of the jQuery object
$('control ID according to you').length
it should result you as 1. if its equal to 0, that means the id is not the correct one.
if you are using the .net 4 then you can set the ClientIDMode to static and then use the same id to identify the control.
I would like to suggest you try $('#<%= Master.pnl %>').slideDown("slow");
at first, plesae check if $('#<%= Master.pnl %>') can get the correct div object, and then apply slideDown effect.
JAYHAWKER
The following will show it but it doesn't slide down. var pnlRef = document.getElementById('<%= Master.pnl %>'); pnlRef.style.display = "inline";
in above code pnlRef can show div, but can not slide down, please try to remove pnlRef.style.display = "inline"; and add code to explicitly set the "top" and "left" of div, you can refer article below
JAYHAWKER
Participant
1252 Points
1896 Posts
How do I use the slideDown with a control that exists on the masterpage from javascript on a cont...
Apr 06, 2012 10:54 PM|LINK
I have tried the following but it doesn't work. I already have access to the control using javascript, but am trying to use jquery to do it instead.
Something like this
$('div[id*=master.divAddAnotherProduct]').slideDown("slow");s.
BrockAllen
All-Star
27512 Points
4895 Posts
MVP
Re: How do I use the slideDown with a control that exists on the masterpage from javascript on a ...
Apr 06, 2012 10:59 PM|LINK
That selector looks odd... is "divAddAnotherProduct" part of the id or is that a class on the <div>?
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
JAYHAWKER
Participant
1252 Points
1896 Posts
Re: How do I use the slideDown with a control that exists on the masterpage from javascript on a ...
Apr 06, 2012 11:04 PM|LINK
It is just the name of my div. The syntax works fine if the div is in my content page (by eliminating the Master.), but this div is in a master page. I have it declared in codebehind of the master page as a public control and can access it with javascript using the traditional document.getElemtentBy ID…. but want to access it with jquery.
Thanks!
BrockAllen
All-Star
27512 Points
4895 Posts
MVP
Re: How do I use the slideDown with a control that exists on the masterpage from javascript on a ...
Apr 06, 2012 11:09 PM|LINK
Put single quotes around the "master.divAddAnotherProduct" part.
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
JAYHAWKER
Participant
1252 Points
1896 Posts
Re: How do I use the slideDown with a control that exists on the masterpage from javascript on a ...
Apr 06, 2012 11:12 PM|LINK
It won't let me do it syntax error says "expecting , or )
BrockAllen
All-Star
27512 Points
4895 Posts
MVP
Re: How do I use the slideDown with a control that exists on the masterpage from javascript on a ...
Apr 07, 2012 12:36 AM|LINK
Right, you need this:
$("div[id*='master.divAddAnotherProduct']").slideDown("slow");
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
asteranup
All-Star
30184 Points
4906 Posts
Re: How do I use the slideDown with a control that exists on the masterpage from javascript on a ...
Apr 07, 2012 07:19 AM|LINK
Hi,
If master.divAddAnotherProduct is the name of your div then try-
$('div[name*=master.divAddAnotherProduct]').slideDown("slow");Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog
ceenu4u
Member
98 Points
29 Posts
Re: How do I use the slideDown with a control that exists on the masterpage from javascript on a ...
Apr 07, 2012 11:16 AM|LINK
when a masterpage is used and the control is in the master page then its Client ID Doesn't change but when the Control is in the content Page then its control is changed. so first find out the length of the jQuery object
$('control ID according to you').length
it should result you as 1. if its equal to 0, that means the id is not the correct one.
if you are using the .net 4 then you can set the ClientIDMode to static and then use the same id to identify the control.
JAYHAWKER
Participant
1252 Points
1896 Posts
Re: How do I use the slideDown with a control that exists on the masterpage from javascript on a ...
Apr 07, 2012 01:42 PM|LINK
I could not get any of the above to work. The following will show it but it doesn't slide down.
var pnlRef = document.getElementById('<%= Master.pnl %>'); pnlRef.style.display = "inline";I can't get anything else to work.
Thanks for the tries!
Yanping Wang...
Star
14863 Points
1527 Posts
Microsoft
Re: How do I use the slideDown with a control that exists on the masterpage from javascript on a ...
Apr 09, 2012 03:15 AM|LINK
Hi JAYHAWKER,
I would like to suggest you try $('#<%= Master.pnl %>').slideDown("slow");
at first, plesae check if $('#<%= Master.pnl %>') can get the correct div object, and then apply slideDown effect.
in above code pnlRef can show div, but can not slide down, please try to remove pnlRef.style.display = "inline"; and add code to explicitly set the "top" and "left" of div, you can refer article below
http://forum.jquery.com/topic/jquery-effects-like-slidedown-that-leave-display-set-to-inline
Hope this helps, thanks.
Feedback to us
Develop and promote your apps in Windows Store