Help in Java script
-
I have a gridview control, which contains multiple rows. Each row has a link-button and a detailsview control. Using the link-button, i want to show or hide the detailsview control. Initially all the details view have their css property
Display=None
set. If the link button in any of the grid-view row is clicked, i want a java-script to make the details -view in that row visible (Display=Block
) So i wrote the following javascript:While showing the details-view control, it shows momentarily, and again become invisible automatically ...
What could be the problem ...<div class="ForumSig"><i>Apurv</i>
“Never trust a computer you can’t throw out a window.”
(Steve Wozniak)“There are only two industries that refer to their customers as ‘users’.”
(Edward Tufte)</div></x-turndown> -
I have a gridview control, which contains multiple rows. Each row has a link-button and a detailsview control. Using the link-button, i want to show or hide the detailsview control. Initially all the details view have their css property
Display=None
set. If the link button in any of the grid-view row is clicked, i want a java-script to make the details -view in that row visible (Display=Block
) So i wrote the following javascript:While showing the details-view control, it shows momentarily, and again become invisible automatically ...
What could be the problem ...<div class="ForumSig"><i>Apurv</i>
“Never trust a computer you can’t throw out a window.”
(Steve Wozniak)“There are only two industries that refer to their customers as ‘users’.”
(Edward Tufte)</div></x-turndown>The script looks fine. I assume your code is calling the show and then the hide script right away.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
The script looks fine. I assume your code is calling the show and then the hide script right away.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
do i need to add the
return;
statement at the end ... ?Apurv “Never trust a computer you can’t throw out a window.” (Steve Wozniak) “There are only two industries that refer to their customers as ‘users’.” (Edward Tufte)
Depends where you mean. I'm yet to see what code calls these methods, returning a true or false from these methods may stop the other events from triggering, but I can't say, because you've not posted the code that is relevant. your code has no bugs that I can see, it's just being called in ways you don't expect.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
I have a gridview control, which contains multiple rows. Each row has a link-button and a detailsview control. Using the link-button, i want to show or hide the detailsview control. Initially all the details view have their css property
Display=None
set. If the link button in any of the grid-view row is clicked, i want a java-script to make the details -view in that row visible (Display=Block
) So i wrote the following javascript:While showing the details-view control, it shows momentarily, and again become invisible automatically ...
What could be the problem ...<div class="ForumSig"><i>Apurv</i>
“Never trust a computer you can’t throw out a window.”
(Steve Wozniak)“There are only two industries that refer to their customers as ‘users’.”
(Edward Tufte)</div></x-turndown>Replace your code with this ...
function ShowReplyBox(PMBox) {
var myElement = document.getElementById(PMBox);
if (!myElement){
alert('element not found');
return;
}
if(myElement.style.display != "block")
myElement.style.display = "block";
}
function HideReplyBox(PMBox) {
var myElement = document.getElementById(PMBox);
if (!myElement){
alert('element not found');
return;
}
if(myElement.style.display != "none")
myElement.style.display = "none";
}:cool::cool:
Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.
-
Replace your code with this ...
function ShowReplyBox(PMBox) {
var myElement = document.getElementById(PMBox);
if (!myElement){
alert('element not found');
return;
}
if(myElement.style.display != "block")
myElement.style.display = "block";
}
function HideReplyBox(PMBox) {
var myElement = document.getElementById(PMBox);
if (!myElement){
alert('element not found');
return;
}
if(myElement.style.display != "none")
myElement.style.display = "none";
}:cool::cool:
Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.
Would setting the display to block if it already is, cause it to disappear ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Would setting the display to block if it already is, cause it to disappear ?
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
No. I dont think so. if I set
display = ""
it will act similar todisplay="block"
I dont know what is wrong with his code... Might be his code calling thedisplay="none"
just after settingdisplay="block"
:cool:Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.
-
No. I dont think so. if I set
display = ""
it will act similar todisplay="block"
I dont know what is wrong with his code... Might be his code calling thedisplay="none"
just after settingdisplay="block"
:cool:Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.
Yeah, the problem has to be that his code is calling both methods. Funny how people ask for help, then don't answer with the details you need to help them
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Yeah, the problem has to be that his code is calling both methods. Funny how people ask for help, then don't answer with the details you need to help them
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
Yes. you are right.. :laugh: :rose:
Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.