.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

How can we show and hide iframes progarmmtically in javascript, calling the function from a seprate

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :ASP.Net
I have currently placed 5 iframes inside 5 divs and i m trying to show and hide iframes by following code if (docid == idpath_array[1])             {                document.all("div1").style.display = 'block';                document.all("div2").style.display = 'none';                document.all("div3").style.display = 'none';                document.all("div4").style.display = 'none';                document.all("div5").style.display = 'none';            } but the problem is that after setting style of one div as display:none,I am not able to display the same div latter by setting display:block hence programmically I am not able to display an already hidden iframe by making display:block in div

View Complete Post

More Related Resource Links

way of calling "javascript function of parent window from child window."

The article way of calling "javascript function of parent window from child window." was added by raja.s on Sunday, June 06, 2010.

Hi,Here i am going to explain how to call the javascript function of a parent window from the child window(pop-Up).Some may know before reading this post.Parent Java Script Function:script language="Javascript" type="text/javascript">

calling a javascript function within aspx

i have a js method i wrote myself called sumAlert();  i want to call it in my aspx like this, when a user clicks on a button<asp:Button ID="Button" runat="server" Text="Submit" OnClientClick="if (confirm('WARNING! You will be unable to save again if you proceed')) sumAlert();"                        OnClick="Button_Click" />How can i get it to call the function if the user confirms OK?

Calling a Server side function from Javascript without using PageMethods

Good Day alli have used PageMethods to access the server side functions in javascript , but now my problem is that with pagemethods your controls will not go throught the full page lifecyle and these leads me to have "Object not set for an instance of an object" error. Now can someone come with a differnt approach without using pagemethods. What i want is to call a server side function , i dont want to pass any parameters to itthanks

calling JavaScript Function


Hi all,

I given lot of tried to call JavaScript function get the return value but always i am getting error in namescape.

Error : Cannot find the script or external object that implements prefix 'urn:custom-javascript'.

Here is code :

Java Script function in seperate .js file.

 function findPosY(obj)
    return 123p;

--------------XSL file
<xsl:stylesheet version="1.0" 
                xmlns:asp="remove" xmlns:cc1="remove"
                exclude-result-prefixes="msxsl js"

Now calling the function.

<msxsl:script language="JavaScript" implements-prefix="js">
      function getResult (thisGuess) {
      var thisResult;
      thisResult = findPosY(document.getElementById("yahoo"));
      return thisResult;


Return Value: <xsl:value-of select="js:getResult()"/>

error calling javascript function in asp link button


I am using a asp link button in grid template field which calls a pop up,i need to find the link button's control in cs page.

my link button code

<asp:LinkButton runat="server" ID="hlQName" Text='<%# Eval("QuestionnaireName")%>' OnClientClick

Using Javascript to show/hide asp elements


I have an address page that validates via USPS.  The user inputs their address and clicks the "validate" button.  The "validate" button goes away, the validated address is displayed and a "submit" button shows up.  If a user makes a change to their address after they have validated, they need to be forced to validate again.  However that's not happening.  The visibility doesn't change at all.

Here is my script:

<script language="javascript" type="text/javascript">
    function HideValidated(form) {
        document.getElementById('<%= trValidate.ClientID %>').style.display = "inline";
        document.getElementById('<%= trCorrected.ClientID %>').style.display = "none";
        document.getElementById('<%= trSubmit.ClientID %>').style.display = "none";

Here is part of my HTML:

<asp:TableRow runat="server" ID="trValidate">
        <asp:TableCell><asp:LinkButton ID="btnValidate" runat="server" OnClick="btnVa

Calling a javascript function from server side, using AJAX timer



I am developing a ASP.NET ajax application.
I am using a timer:

<asp:Timer ID="Timer1" runat="server" OnTick="Timer_Tick" Interval="5000" />      

The only thing I want to do is to call a javascript function on every tick of the timer:

 protected void Timer_Tick(object sender, EventArgs e)
            ClientScript.RegisterClientScriptBlock(this.GetType(), "blink", "<script>blinkit('2');</script>");

This doesn't work.
The javascript function is being called only if I put the 'RegisterClientScriptBlock' in the Page_Load.

How can I call the javascript every couple of seconds?

Thank you

Toggle show/hide details in datalist using javascript



I have a datalist bound to a sql source having two columns: Name and Description. The datalist contains a "Show Description" link as follows on clicking on which it calls the javascript which shows the description div.


    <script type="text/javascript">
        function toggle_visibility(id) {
           var e = document.getElementById(id);
           if(e.style.display == 'block')
              e.style.display = 'none';
              e.style.display = 'block';

 The asp.net page source for itemtemplate of the datalist is as follows.The problem is that since the div id "Description" is applicable to multiple records, no matter I click on whichever "show details" link, the description of first record in the datalist is shwon and hidden since its the first div encountred by the javascript. In other words, I want a way to show/hide the description of each record in datalist indivigdually. Please provide your input. Thank you in advance.

<asp:Label ID="TPlaceLabel" runat="server" Text

unwanted postback when calling javascript function


i am executing a javascript method when a button is pressed, but the page keeps getting posted back.  what am i doing wrong?

this is the javascript portion of the page

<script src="Scripts/soundmanager2-jsmin.js" type="text/javascript"></script>
<%--<script src="Scripts/soundmanager2.js" type="text/javascript"></script>--%>
    <script type="text/javascript">
soundManager.url = '/Scripts/swf/'; // directory where SM2 .SWFs live

// Note that SoundManager will determine and append the appropriate .SWF file to the URL,
// eg. /path/to/sm2-flash-movies/soundmanager2.swf automatically.

// Beta-ish HTML5 audio support (force-enabled for iPad), flash-free sound for Safari + Chrome. Enable if you want to try it!
// soundManager.useHTML5Audio = true;

// do this to skip flash block handling for now. See the flashblock demo when you want to start getting fancy.
soundManager.useFlashBlock = false;

// disable debug mode after development/testing..
 soundManager.debugMode = false;

here is the button code

<button onclick="var aSoundObject=soundManager.createSound({
      id: 'aSound',
      url: '/MP3s/rain.mp3'});aSoundObject.play()">

Problem in calling javascript function from code behind


Hi All,

  how can i call Javascript function on Button click after doing some server side operation?

  Though i am using ClientScript.RegisterStartupScrip(), sometime it is working(for alert) but when i am using for display confirm message it is not showing Confirm message.

ClientScript.RegisterStartupScript(GetType(), "ConfirmMessage", "javascript:return ConfirmMessage('" + lMessage + "');");

this is not working.

Please help me out.

Thanks & Regards,



Content page control passes as argument to javascript function


Here is the content page:


<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="JavaDynamicCopyValue.aspx.cs" Inherits="JavaDynamicCopyValue" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 <script type="text/javascript" >
 function copyValue(input, output )
   ouput.value = input.value;
   return true;
 <asp:TextBox ID="txt1" runat="server" onchange="copyValue(this,document.getElementById('<%=txt2.ClientID%>'))"></asp:TextBox>
    <br />
    <br />
    <asp:TextBox ID="txt2" runat="server"></asp:TextBox>


I got a javascript run time error says output is undefined. if I view source of the page, the txt1 markup became:

<input name="ctl00$ContentPlaceHol

>>>How to use javascript function in aspx file?



I have a file util.js and there some funtions in same file.

For example functions name are keyUp, keyDown, isNumeric, isAlphaNumeric

I have used these functions in aspx code behind in a textbox to restrict user that he may not be able to input any special character.

Before, I used the code directly in aspx file but I have do it for different textboxes therefore to avoid much coding in aspx file I created util.js and put all code in this file but how to use these particular functions in aspx file I couldn't find the way.

Anyone have idea. Do share with me.

I used the reference like this:


' Font-Names="Verdana" Font-Size="8pt" Onkeyup= "keyUp(event.keyCode)" Onkeydown="return isAlphaNumeric(event.keyCode);" onpaste="return false;">

SharePoint Blog - Admin web part - newBlogPostOnClient JavaScript function


In the Admin Links web part in a default blog site, there are several links, the last one of which launches Microsoft Word and allows you to manage your posts from the Word blog template.  Cool feature.  But that web part is not configurable and I can't figure out how to duplicate that functionality.  It appears to have 3 GUIDS that are part of the function, part of the last parameter looks like the Posts list GUID, but it is concatenated with another GUID.   I want to either create my own web part or modify the XSL of the page to call the function, but I'm not sure what those other GUID parameters are.  Does anyone know?  The last one seems to be two of the separated by the # character.


Run a javascript function after UpdatePanel.Update()


I thought that adding the javascript within the ContentTemplate would cause it to run every time the UpdatePanel was updated.  For example, I would assume that for the following:

<atlas:UpdatePanel ID="UpdatePanel1" runat="server" Mode="Conditional" >
        Hello from inside the update panel!!!!
        <asp:Button ID="foo" runat="server" OnClick="foo_Click" Text="Click me to postback!" />
        <script type="text/javascript">alert('Javascript, baby!');</script>

 would cause the function alert() to run every time the UpdatePanel returns from the button click.  This is not the case, however.

How do I do this?  My update panel contains a scrolling Div and I

Passing value from asp to javascript function


Here is the problem 

private void Page_Load(object sender, System.EventArgs e)

private void Page_Load(object sender, System.EventArgs e)




                                      int flag = 1;

                                       btn_ModifyApprove.Attributes.Add("onClick", "return ValidateModifyApproval('" + Flag + "');

javascript function not working with datalist


I have a datalist and there is a check box within this datalist in a .ascx page.  But I have to have an image out side the datalist.  So here is the code and its not owrking.  When I click on the image, I dont see any alert box. 


<script Language="JavaScript" type="text/javascript">


function validate_checkbox()



// set var checkboxSelect to zero

var checkboxSelect = 0;

var sProducts = "";


var multiCheck = window.document.forms["frmCompare"].CompareCheck.length;


if (multiCheck != null)


    // Loop from zero to the one minus the number of checkbox button selections

    for (counter = 0; counter < window.document.forms["frmCompare"].CompareCheck.length; counter++)


        if (window.document.forms["frmCompare"].CompareCheck[counter].checked)


            var seperator = (checkboxSelect > 0)?",":"";

            sProducts += sep

Show/hide dashboard items Sharepoint



I'm having a problem with trying to filter the appearence of items on a sharepoint site by having a dropdown list and filter according to the current value, The method i am using atm is by having javascript and by looping through all the <td> on page. This works for list views, But not for Performance point dashboard objects/web parts, +

Is there a way to somehow get the title of all performance point objects on a page, fill the dropdownbox show/hide depending on the selected item in the box?



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend