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

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

how to set jquery function in a seprate file and resuse

Posted By:      Posted Date: October 22, 2010    Points: 0   Category :ASP.Net

 i have jquery function but i require all function in a seprate file , when i put simple copy and paste in an other file all of function is not work

<script language="javascript" type="text/javascript">
		$(document).ready(function () {	
				$("input[id$='Bu_SaveTarget']").click(function() {
									alert(" Context  is not selected.  Please select Track in Tree view and retry.");return false;						
     					/*	 if(($('#Txt_NewTarget').val())==""){
								alert( Please Enter  Target and retry.");return false;	
							else if(($('#Txt_Pdc').val())==""){
								alert( Please Enter  PDC Date and retry.");return false;			
								else if(($('#Txt_ReDate').val())==""){
									alert( Please Enter  Release Date and retry.");return false;						
							else if(($('#dbo_Company').val())==""){
									alert("Company is not selected.  Please select any Context in Tree view and retry.");return false;						
							}		*/
  					  	$("input[id$='Bu_SaveTarget2']").click(function() {

View Complete Post

More Related Resource Links

Upload Multiple File using JQuery in asp.net

In this article I have explained how to upload multiple files using file upload control. I have used jQuery plugin for uploading multiple files.

I have also explained how to check for file type, file maximum size limit using jQuery & also using server side validation code.

Multi File Upload Using JQuery!

Everyone knows about the file upload in .NET. But the multi file upload is some what difficult in .NET. For that purpose we can have some AJAX or JQuery!. Jquery is the latest advanced version. It will give some animated upload. You can try it for your own!!!!

>>>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;">

Error "The process cannot access the file ....." occurs while using function "ExportToStream"


Dear all,

   I sometimes get the following error while printing crystal report to pdf:

   System.Runtime.InteropServices.COMException (0x80004005): The process cannot access the file because
it is being used by another process. at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export
(ExportOptions pExportOptions, RequestContext pRequestContext) at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream
(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
 at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportOptions options) at
 CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportFormatType formatType) at
 CommonWA.CommonFunc.GetPDFMemoryStream(DCMSReportDoc _dcmsreportdoc, Boolean& _DataExist) in E:\wwwroot\ASPWA\CommonWA\CommonCom.vb:line 382

  The error not occurs frequently but sometimes it will happen, can someone tell me why the error occurs and how can I solve the problem?

Thank you very much.


Is there a function in Jquery which run only one time no matter load page or PostBack

In asp.net, I can use Method A to run somethings A one time, and somethings A will nor run when page is postback but In JQuery, I hope to run something B one time when the page is loaded, but if I use Method B, the "Somethings B" always run even the page is pastBack, how can I do? Thanks! ------------------Method A------------protected void Page_Load(object sender, EventArgs e){    if (!IsPostBack)    {       //Do Somethings A    } }   ------------------Method B------------$(document).ready(function () {   //Do Somethings B})

Query DB and update Check Box List on JS/jQuery Function

Hey guys.  I'm not sure if this is the right forum to post this in but I've come to a roadblock in my app and I'm not sure which way I should go.  Currently, I have a slider control and two text boxes used to set the Start and End times of a section of a video.  Let's say the video is of some Music Awards.  In my database, I've tagged the start and end time of each celebrities on-screen appearance.  When the user adjusts their start and end times on the page, I want to query the database table and pull back all celebrities within that range.  The problem is I don't know how to do this in JS.Can I use the Check Box List and bind the values to it?  Do I need to render a table of Check Boxes in JavaScript?  Do I call the Server-Side code via Ajax and then partially render the page?Any help, comments or suggestions would be great.

how to call a function or event using jquery Ajex

<asp:Button id="Bu_DocShareSave" runat="server" Text="Save Share" OnClick="Bu_DocShareSave_Click"/>protected void Bu_DocShareSave_Click (object sender, System.EventArgs e){            string S_DocShareID=CCUtility.ToSQL(Utility.GetParam("txt_DownloadFileID"),FieldTypes.Number);            string S_DocStorage=CCUtility.ToSQL(Utility.GetParam("dbo_Storage"),FieldTypes.Text);            string S_DocShareToEmp=Utility.GetParam("dbo_Emp");            string[] SA_DocShareToEmpSplit = S_DocShareToEmp.Split(',');                        int a=0;                         foreach (string Empid in SA_DocShareToEmpSplit){                        if(!Empid.Equals(""))                   {                      

how to jquery call a other call function other class is not static

how to jquery call a other call function other class is not static[WebMethod]    public static bool Verify(string username, string password)    {        //Do your logic with username, password  here        //I am just checking with admin/admin credentials            Console.WriteLine("Ritu");        string s="SELECT p.RETMSG FROM P_DOCSHARE(1001,1453,'1002,1012,1011','Add') P";                 CCUtility c;                c=new CCUtility();             c.JavascriptMessage(c.Insert_P(s));        return (username == "admin" && password == "admin");    }

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

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

Accessing ASPX page elements from ASCX'S jquery function


Hi Friends, I need your help.

I have aspx page and in that page i registerd ascx page. i want to access the aspx page <div id = "idofdiv"> from ascx page jquery function. i have jquery function in ascx page. i want to access idofdiv in that function. how could i achive this?



how jquery function one time writen and call many butoon


how to call this function in two or more button one time wirtten

<asp:Button id="Bu_DocShareSave" runat="server" Text="Add Share"  OnClick="Bu_DocShareSave_Click"/>
                                     <asp:Button id="Bu_DocRemoveShare" runat="server" Text="Remove  Share" OnClick="Bu_DocRemoveShare_Click" />

<script type="text/javascript">  
     $(function () {  
           $('#btnFoo').click(function () {  
               var commaSeparated = $('#<%= ListBox2.ClientID %> option')  
                .map(function () {  

Simple return value from WebMethod from Ajax function using JQuery


I have an Ajax function called from JQuery that goes to a webservice to return a value.  I need a SIMPLE example on how I can do this.  I've been going nuts with serializing and every other aspect of this topic. 

I need to return either an ArrayList with ONE string field or a DataTable of some kind.  Either way, I'm populating it into a DropDownList.

I'm willing to consider alternatives to this idea. (Background info - I get a value from a textbox and I need to run it through a DB to get an associated value or set of values).  I'm being really general so that someone can show a simple example.  Thanks.

How to read all function/method names from .cs file


 Hi everyone,

Normally i answer to the peoples questions here but today i am posting a question for a answer :)

I have a .cs file and i want to read all function/method names from it.

This .cs file is not part of my project or solution other wise i would have used reflection or codedom to do so.

The .cs file is a file on a disk to which i can accessing by giving its physical path say "C:\Sample.cs"

Is there any possibility that i can fetch all the function names declared in Sample.cs

Note: I am doing this for one of my requirement to find out dependencies in code

For example If class A is using some function from class B then class A is dependent on class B. this i need to find out and both this class files are simply a files residing on disk not even part of my project. 

User will select a directory first then any one of the .cs file in that directory and will click on button to find dependencies of that .cs file.

The application should traverse all other .cs files in that directory and find out on how many other .cs files the selected file is dependent.

Execute jquery function after updatepanel.update


I want to execute following function after I have called updatepanel.update:

Public Sub StartScroller()
        Me.Page.ClientScript.RegisterClientScriptBlock(Me.[GetType](), "startscroll", "$(document).ready(function () {$('.scrollable').scrollable();});", True)
    End Sub

It doesnt work. I also tried RegisterStartupScript. I would expect the scrollable() method to be executed. But it doesnt.

    <asp:UpdatePanel ID="upnlCompareLocations" runat="server">
<a class="prev browse left"></a>
<div class="scrollable">   
   <!-- root element for the items -->
   <div class="items">

        <asp:ListView ID="repLocationsToCompare" ItemPlaceholderID="itemsGoHere" DataSourceID="XMLDSCompare" GroupItemCount="4" runat="server">
                <asp:PlaceHolder runat="server" ID="itemsGoHere"></asp:PlaceHolder>
                    <%# XPath("title&

"..." is not a function when intellisense detects the jquery function


Hi, I have a problem I am using a date picker ... jdpicker and I also tried with UI DatePicker and I keep getting this error "..." is not a function even though intellisense detects the function.

My code is as simple as using the default options such as 





How to call a JQuery Sorting Function ?


Hi everyone

I found the following sorting code. People are saying the code is working.

But I don't know how to call it so that it is not working for me.  Please

let me know how to call the JQuery function.



<html xmlns="http://www.w3.org/1999/xhtml">

    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>   
    <script type="text/javascript">

 * jQuery.fn.sortElements
 * --------------
 * @param Function comparator:
 *   Exactly the same behaviour as [1,2,3].sort(comparator)
 * @param Function getSortable
 *   A function that should return the element that is
 *   to be sorted. The comparator will run on the
 *   current collection, but you may want the actual
 *   resulting sort to occur on a parent or another
 *   associated element.
 *   E.g. $('td').sortElements(comparator, function(){
 *      return this.parentNode; 
 *   })
 *   The <td>'s parent (<tr>) will be sorted instead
 *   of the <td> itself.
jQuery.fn.sortElements = (funct

Using vb function in ..aspx file


i have this line of code:

<li><a href="/TrainingOptions.aspx?pageID=<%#UrlEncode("Online Training") %>">

but it does not encode and my urls are pageID=(blank)

please help. is it even possible without having to do it via backend in a literal?

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