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


Top 5 Contributors of the Month
Kaviya Balasubramanian
Velemoochi
Imran Ghani
Post New Web Links

How to call javascript from file

Posted By:      Posted Date: September 12, 2010    Points: 0   Category :ASP.Net
 
Hi, i want to call javascript from file JScript.js. I write in head section (in master site) code <script src="JScript.js" type="text/javascript"></script>. How i can call this file from default.aspx(not from master site)? Everything is fine then all code is in master page, but i need this script in other pages.<asp:DataList ID="DataList1" runat="server" RepeatColumns = "2"  RepeatLayout = "Table"  Width = "500px">     <ItemTemplate>         <br />         <table cellpadding = "5px" cellspacing = "0">         <tr>             <td>                 <asp:Image ID="Image1" runat="server" ImageUrl = '<%# Eval("FilePath")%>'                  Width = "200px" Height = "200px" onclick = "LoadDiv(this.src, this)" style ="cursor:pointer" />             </td>         </tr>         </table>         <br /> 


View Complete Post


More Related Resource Links

call JavaScript that has Return Value to C# (.cs File)

  

hai guys...i got trouble with javascript , please help me up to solve this problem

i have a javascript to check is client file exist in the client folder like this : 

function FileExists(strURL) {
    var x = new ActiveXObject("Scripting.FileSystemObject");
    return  x.FileExists(strURL);
}

this function will call in server side , but im getting trouble how to call that function in server side , some function in cs will consume that js function before loading image , so that function will check in the client file the file exist or not , if exist i will load the image from the local file

please help me guys....thx for ur help


regards angela.


call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side

How to call an .exe file in .net

  
Sometimes a developer has to call an EXE from another EXE. While calling EXE there can be a requirement to pass parameter.

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

  

Hi,

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:

Javascripts/util.js

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


Call Server Side Code from Javascript in VB.NET

  

Hi

Could anyone give me an example how to call Server Side Function from javascript and then I want to call that javascript function on Button OnClick () Event.


Thanks in Advance

Shabbir



how to call an dll file dynamically from (.cs )

  

hi,
i have  an  microsoft .office.interop.excel(dll) located  at an directory d:\abc\.  now i do not want to add them  as an web reference in my projet   and  call them

rather  call the dll dynamically  from my code behind(.cs)
is ther any way  we can do dynmically

 anyhelp would be  great
 thank  you


Call a web method in Javascript

  

Hi All,

I am first time working on web service and Javascript and trying to call a Web Method (web service) on a button click in Javascript.

What I want to achieve is as followed: When the button is clicked, call the web method, get the return URL value and store it to a session variable, the redirect the page to another page. However, this works only when the internet traffic is fast, it give me error when internet is slow as the Javascript is executed much faster than the web service. Is there any way to handle this?  Would be much appreciated for your help! Cheers.

Code as below:

JavaScript:

function emailButton_onClick()
{
getCurrentMapURL(function(){getCurrentMapURLOnSuccess();});

}

function getCurrentMapURL(getCurrentMapURLOnSuccess)
{
var proxy_url = 'WebService/GPSWebService.asmx/GetCurrentMap';

var response = map.print([proxy_url]);

if(getCurrentMapURLOnSuccess)
{
getCurrentMapURLOnSuccess();
}

}

function getCurrentMapURLOnSuccess()
{
emailAddress = document.getElementById('txtEmailAddress').value;

if(emailAddress != null)
//{alert(emailAddress);
alert('Do you want to send report

How to call ASMX from Javascript

  

I am very new to web services so this may be a very silly question: how do you call an ASMX web-service sychronously, so that the web-page doesn't finish loading until the web service has sent its response?  I need my Javascript calling function to sit tight until the web-service returns its response; at the moment, it continues execution without waiting.

I have a web service defined in an ASMX file:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data.SqlClient;
using System.Configuration;

/// <summary>
/// Summary description for MyService
/// </summary>
[WebService(Namespace = "http://www.myservice.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
[System.Web.Script.Services.ScriptService]
public class MyService: WebService 
{
    public MyService() 
    {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod]
    public string ValidateInfo (string arg 1, string arg2)
    {
        ...
        return response;
    }
}


In my ASPX file I have a reference to my web service:

call a server side C# method from javascript

  
http://forums.asp.net/t/1591584.aspx Hi friends, can anyone provide me the C# code of the above post answer(pls go to the link)..i didnt understand the VB code... i dont know VB.. my problem also same.. i have a method in a class in App_Code folder... i want to call that method from javascript.. the method takes one parameter which is list box cotrol id... the list box control also available in the same page..   Please can anyone help me on this..

Call a Protected sub from JavaScript

  
Hi there,                first at all I would like to ask your opinion on what we are doing. Having a ModalPopupExtender, the idea is to run a delete process from a SqlDataSource when Cancel button is clicked. Our approach is as showed below:     <script type="text/javascript">        function deleteRec() {            alert("Call a Protected Sub btnNo_Click!");                    }            </script>                    <asp:ModalPopupExtender ID="Panel1_ModalPopupExtender" runat="server"                          PopupControlID="Panel1" DynamicServicePath="" Enabled="True"                         TargetControlID="btnFirePopup" BackgroundCssClass=&quo

Can you call a javascript function from code behind?

  
Call you cal a javascript function from the code behind? If so how??? 

How to include a javascript file in a custom action?

  
I need to call a custom javascript function from a ribbon button, how do I include the javascript file within the custom action solution in order that it will be properly referenced by the html output? I am not allowed to define a custom masterpage at this point. So what can I do?   Thanks, Stephan  

Can you call Javascript function from the codebehind?

  
 Can you call Javascript function from the codebehind?  How???

Access Javascript from an aspx file through another aspx file

  
Hello, So.. I have a file called myFile.aspx which is linked to a js file called myJS.js    There is a file linked to an entirely different frame called theOtherFile.aspx.  I want to access a function is myJS.js called myFunc in theOtherFile.aspxI am not entirely sure how I would accomplish that..I am quite new to MVC2 and JS, so I am quite confused as to how to do this.  Any suggestions would be much appreciated.~Anath

Cached Javascript file using feature VS 2010 - Bug?

  
Hi, I am using a custom action in an element.xml to reference an external script in my SP2010 solution - by adding a SP 2010 layouts folder and adding the script in there. Everything deploys and runs fine, however, if i update the javascript file and redeploy the solution, when debugging the javascript, the old (non updated) file is loaded and executed. I have tried retracting the feature and re-deploying, cleaning the solution, rebuilding and deploying, yet the javascript file loaded dynamically is still the old file. It seems to be updated intermittently, however, this is quite awkward as I cannot accurately guage when the file is refreshed. I am closing the IE window after every debug session.  Is there a process I should be following to ensure that the script is updated every time? Any help would be greatly appreciated. Cheers.      

How to call javascript function in master page

  
helloi have javascript file 'script.js' where i have writt en a function for print. but this function is working fine if i am not using master page in my report page but the question is i want to use master page for my report page where i am calling javascript function but it is not working . Do help me regarding MasterPage and Javascript function.
Categories: 
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