Web Forms :: Can Use Some Javascript Functions In A .net 3.5 Web Site
May 27, 2010
I wanted to use some javascript functions in a ASP.net 3.5 web site. I have added a javascript1.js page in the Sites Folder with a Javascript Test function.
<script
src="~/Scripts/Javascript1.js"
type="text/javascript"></script>
View 4 Replies
Similar Messages:
Apr 12, 2010
I think I summed up the question in the title. Here is some further elaboration...I have a web user control that is used in multiple places, sometimes more than once on a given page.The web user control has a specific set of JavaScript functions (mostly jQuery code) that are containted within *.js files and automatically inserted into page headers.However, when I want to use the control more than once on a page, the *.js files are included 'n' number of times and, rightly so, the browser gets confused as to which control it's meant to be executing which function on.What do I need to do in order to resolve this problem? I've been staring at this all day and I'm at a loss.
View 2 Replies
Mar 22, 2010
I'm new to ASP.NET MVC and i want to create a class to contain site wide functions for my application.what is the best practice to do this?
where should i create the class ? in what folder?should i create a new folder?
edited:I need a function that return base uri, and it have be available to call from any controller.A date formatting function, or any other simple logic , but is going to be used repetitively
View 2 Replies
Jan 16, 2011
All of my scripts run fine in my Master page, and all of the functions run when called in the content pages, but for some reason, all of the sudden contentPageLoad() doesn't run anymore in any of them. I am sure that I have changed something somewhere, but I can't figure out what it is.
View 1 Replies
Nov 17, 2010
I knew how to apply Javascript function in html file. How to use javascript(including functions) in code behind file?
View 2 Replies
Jan 26, 2010
Is there a way to run server side functions by javascript? There are two things I need to do:
1. Either emulate clicking a link/button, or calling the OnClick function directly (not OnClientClick)
2. Control the back and forward control of the wizard control by using the keyboard
View 2 Replies
Jan 27, 2010
i think The javascript function called by using RegisterStartupScript or RegisterClientScriptBlock executed after the code in the method is executed.I want to execute the javascript function called by RegisterStartupScript or RegisterClientScriptBlock to be executed before the code in buton click method is executed. For that what should i do?
View 5 Replies
Mar 2, 2011
I have two web application. one is A and another is B. I want to send the data from Site B to Site A from javascript so that it should come as a pop up on site A. How can i achieve this thing? Is it possible or not? Need Response as soon as possible.
View 2 Replies
Sep 28, 2010
I am trying to call some javascript functions which I ahve written in some file. Eg.
function OpenPopup() {
alert("OpenPopUp");
return false;
}
when I call this from button from OnClientClick = "OpenPopup()" it is not called but when I put this function on MasterPage it is able to call the function.I added this is the MasterPages's Head
<script src="Scripts/something.js" type="text/javascript"></script>
View 4 Replies
Feb 3, 2011
I've looked at about 5 Questions here on SOF and haven't really found a useful answer for this. How am I supposed to invoke my javascript functions from client-side events in my .ascx controls? Here is my .ascx file.. what most the answers have led me to:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="UIMenu.ascx.cs" Inherits="controls_UIMenu" %>
<script language="javascript" type="text/javascript">
function insetItem(myMenu)
{
myMenu.setAttribute("class", "myClass");.......
I'm getting different errors when doing it this way. ".....ascx does not contain a definition for "insetItem"", and my other pages that use this file don't recognize it anymore. When I try to put the js on the actual .aspx pages that will be using it, I get the same no definition error.
I just started learning jscript, still pretty noob. I'm trying to make it so when the user down clicks a menu item, I want that item's borderstyle to change to "inset". I'm not sure how to change that attribute for the specific item that gets clicked either in javascript >_< but that's another question.
View 3 Replies
Feb 21, 2010
I'm not familier with Javascript, and I have to convert a Project's Javascript codes to Jquery scripts.
ofcourse I'm not project leader or something like it, I'm just elaborating that this process may has what kind of issues and may face with what kind of needness ?
So if you know any solution to convert Javascript Functions to Jquery ones
View 3 Replies
Feb 24, 2010
I have a JavaScript-based timeline which needs to use data from an SQL server. The queries and the JSON conversions have been worked out in the form of C#.NET functions within a code file related to an .aspx page. So for a complete newbie to ASP.NET, how do you set up a function call like this from JavaScript?I would love it if someone had some simple example code I could learn/get some pointers from.Edit: I am using .NET 3.5
View 1 Replies
Oct 31, 2010
[Code]....
What's wrong with it?
View 3 Replies
Mar 31, 2011
I have a user control which opens a new window for some item selection. Once an item is selected on that window, the item ID should be passed to a callback javascript function in the user control. In order to have a unique callback function name in the user control (it may have multiple instances on the same page), I added the user control ID to the function name as follows (defined in the ascx file):
function OnItemSelection_<%=this.ID%>(selectedItemID)
{
OnItemSelection("<%=SomeControl.ClientID%>", selectedItemID)
}
Where OnItemSelection is defined in an external js file:
function OnItemSelection(controlID, selectedItemID)
{
$(controlID).do_something(selectedItemID);
}
The issue is that now I'm not sure how the new page can call the "right" function (of the user control instance where it was opened from). The only idea I have in mind so far is passing the name of the callback function in the query string:
var CallbackFunction = function(selectedItemID)
{
window.opener.<%=Request.QueryString["CallbackFunctionName"]%>(selectedItemID);
}
or maybe just the opening user control ID:
var CallbackFunction = function(selectedItemID)
{
window.opener.OnItemSelection_<%=Request.QueryString["UserControlID"]%>(selectedItemID);
}
My questions are:
1) Is it a bad practice passing javascript function names (or user control IDs) like that (I suspect it is)?
2) What could be better way to handle this scenario? Edit: Another way I'm considering now is declaring a global variable in the user control (registering it from the code behind so it'll appear only once). Then, when opening the new window, it's possible to assign the relevant function to it (OnItemSelection_<%=this.ID%>), and call it from the new window. Seems much cleaner than passing user control data through the query string.
View 1 Replies
Feb 20, 2010
I have an application which use some javascript functions,As all javascripts include in Masterpage, most of them which comes withpage are not necessary, and some of those are repeated ( cause used in some different JS file. )So I want to check if there is a way to determine duplicate functions and remove them ?
View 4 Replies
Aug 16, 2010
I have a page with three HTML labels and their corresponding ASP.NET gridviews contained within divs. Now while learning jQuery, I am trying to achieve two things:1. Change the css class of the lables upon mouse hover/out.2. Slide up/down the grid div upon clicking of the labels.It looks to be working as expected, but I wish to know if I am doing it the right way.My complete jQuery code is:
$(function ColorChange(ID) {
$("#" + ID).toggleClass("gridLabel");
});
$(function ShowHide(GID) {
$('#' + GID).slideToggle('slow');
});
And I am calling these function from onmouseover, onmouseout and onclick events of the label controls passing in the label ID as parameter. As an example:
<label id="lblWebComp" class="gridLabelDefault" onmouseover="ColorChange('lblWebComp')"
onmouseout="ColorChange('lblWebComp')" onclick="ShowHide('gvDivWC')">
Web Components
</label>
Kindly let me know if this is the best way to achieve these effects? Don't I have to right the document ready function in the jQuery code?
View 1 Replies
Feb 5, 2011
I have a webcontrol that will exist multiple time on a page. I have some javascript (JQuery) in the control and when I have multiple controls on a page the functions get confused.I have seen plenty of stuff on why this is the case - basically my functions use set id's but i need to somehow make them relative.An example of a function ...
function showUploader() {
var img = $('#<%=ImgID.ClientID %>');
$('#<%=UploaderIFrame.ClientID %>').attr('src', '<%=ResolveUrl("~/Controls/EditableImageControl/ImageUploader/ImageUploader.aspx") %>' +[code]....
how to get references to the html elements in the web control?
View 1 Replies
Aug 13, 2010
I am trying to figure out why javascript functions I create with declared return types are not giving me intellisense hints. See code below, specifically updateNextItemTime in Sample.TodoList.
[Code]....
View 9 Replies
Jan 26, 2011
is it possible to set a user defined timeout value on an asp.net website...i have a table that stores the time out value for each user of my website...i need to set the time out based on who logged in...i know that the default aspnet timeout setting is 20 mins of inactivity...is there any way i can circumvent this...and yes i do need to show a modal when the timeout expires and need to reset the timeout value if the user wants to continue the session or log them out if they choose not to continue...
View 1 Replies
Mar 31, 2010
I have a Site.Master in my ASP.NET project which defines a HEAD section as follows
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title id="MasterTitle">MyApp</title>
<link rel="icon" href="Content/icon.ico" type="image/x-icon" />
<link href="Content/mycss.css" rel="stylesheet" type="text/css" />
<script src="Content/mycode.js" type="text/javascript"></script>
</head>
In the mycode.js file, I have a function called GetSels();
function GetSels()
{
//do stuff
}
If the GetSels function is defined in Site.Master, GetSels is callable. If it's in mycode.js, it's not. Every code example I've seen seems to say this should work.
View 2 Replies
Feb 7, 2011
I am using AJAX in some pages. this causing my website to grow. 300K is ajax. I would like to lower this to a normal size so the site can be loaded quicly.I have IIS7 and I already have encription for files. What else should I do to handle this problem?
View 4 Replies
Dec 20, 2010
is there any websites that holds common functions such as Check the input is string or not, convert date in different format etc.,?
View 4 Replies
Apr 12, 2013
How to call Sci lab functions in Asp.Net. How to downlaod its API
View 1 Replies
Feb 17, 2011
I have a need to display our application widget within a third-party website (think things like GetSatisfaction, UserVoice and other feedback widgets that people use). What is the safest and most reliable way to do this? I can think of some criteria and issues already: The code needs to be framework and language independent. Even though my app is ASP.NET, the 'launcher' will be run in any HTML page that belongs to our customers. So I suppose that limits me to HTML and Javascript only. The function needs to be very easy to call. So that implies a <script scr='mywebsite.com/widget.aspx' ...> as the sole thing to give to my customer. There is to be no use of CSS. Or rather, I can style things, but without a CSS file, as that could pull in styles that conflict with what my customer is running. There must be no use of libraries such as JQuery. I mention this because I can imagine problems if we pull in a JQuery version that differs from our customer's, thus ruining their site with our code.
View 1 Replies
Mar 22, 2011
In my company we have setup an architecture where all applications share the js scripts to avoid duplicate files and update hundred of files everytime we do an update to the javascripts functions.
The issue that I am having is when I create a reference to those scripts from website A to a function in website B, the intellisense doesn't work. Copy the javascript to website B is not an option. What I am asking if there is a way to make the intellisense work when i am working with projects in this architecture.
View 3 Replies