.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 to get client id at external javascript file

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

hello. when i try to get client id with embedded javascript function i can get with this way


document.getElementById('<%=buttonXXX.ClientID%>' )


but i created an external js file and now i am calling it

but this code does not work any more at external javascript file 


any help is appreciated


using asp.net 2.0 , netframework 3.5 , c# , iis 7.5

thank you

View Complete Post

More Related Resource Links

secure javascript file on client browser


hi i want to secure my javascript file on client browser i dont know how to do it. any way to encrept the file and acess decrepted file. so no one can acess my file on browser.

Calculate Client Height in javascript

The article Calculate Client Height in javascript was added by amoljk2009 on Monday, May 31, 2010.

Hi, Following code will help the developer to calculate exact client height in all browsers.script language="javascript" type="text/javascript">var winW = 630, winH = 460;if (parseInt(navigator.appVersion)>3) {if (navigator.appName

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

SSRS 2005 external images won't display - images on DIFFERENT file server

Hi, Been having trouble getting external images to display in reports rendered on SSRS 2005. Images are displayed as a red X. However, my scenario is different from some of the examples I have read about. - The images are stored on a file server that is DIFFERENT from the box on which the Report Service is running. For various business reasons I cannot copy the images locally to the Report Service box. I am using "file://fileserver/path/to/image.jpg" to retrieve the images. - Since the file server does not have IIS installed, I cannot access the images using the URL method (http:// access). I need to use the file:// method. Currently I am prototyping this setup on my test box, which is running XP Pro and IIS 5.1. The Report Service is installed on this same box. I am currently testing this through the Report Manager web site (http://servername/Reports). The images are displayed using the Image control, which I added to the report using the visual report designer in Visual Studio 2005. It is set up with source=External and with "file://fileserver/path/to/image.jpg" path values. File names are retrieved from our database and file paths are built dynamically using a data processing extension I have written. My best guess as to why this is happening is that the ASPNET service account on my test box does not have access to the particular share on the file serve

Microsoft.SharePoint.Client.File.OpenBinaryDirect - returns a 404 error if the file being requested

Hopefully someone can help with this. I'm using Sharepoint 2010. On the server I have manually created a folder in the "Shared Documents" folder called "bin" and uploaded a file into this folder If I attempt to access the files in this folder using the Microsoft.SharePoint.Client.File.OpenBinaryDirect function,  I receive the following error: A first chance exception of type 'System.Net.WebException' occurred in System.dll: System.Net.WebException: The remote server returned an error: (404) Not Found.    at System.Net.HttpWebRequest.GetResponse()    at Microsoft.SharePoint.Client.SPWebRequestExecutor.Execute()    at Microsoft.SharePoint.Client.File.OpenBinaryDirect(ClientContext context, String serverRelativeUrl). Any other files in any other folders under the shared documents folder are accessible. Here is my example code: ClientContext clientCTX = new ClientContext(SPURL);             //Pass the credentials to the client context             clientCTX.Credentials = credentials;             List DeployFilesList = clientCTX.Web.Lists.GetByTitle("Shared Documents");             CamlQuery caml

Saving Image File in a Folder on Sever from Client Machine using Sql Server

  Hi EveryOne... Can anyone help me Saving an Image file in a Server folder from a client machine using Sql server 2005....   

How to put text from an external text file into a text box on a report.

Hi all, We're moving from our legacy reporting app to SQL Server Reporting Services 2008 and I'm converting our reports slowly but surely.  In our organization, one of our departments sends out letters that have standard marketing messages and disclaimers that they put into .rtf files.  Currently, our reporting application has an RTF box control that can do that fairly easily.  I've not found a similar control in SSRS 2008.  My thought, then, was to use a piece of embedded code in the report to grab the necessary text from the file and reference it in the Value of a Placeholder (using a Code.<FunctionName>.ToString() statement) - using HTML tags for the necessary formatting for those files. I don't care if I have to convert the existing RTF files to HTML files to do this, that's not an issue.  The code I'd come up with is this:  Public Function GetTextFile(ByVal strFileName as String) As String Dim oFile as System.IO.File Dim oRead as System.IO.StreamReader oRead = oFile.OpenText(strFileName) GetTextFile = oRead.ReadToEnd() End Function And the Expression I was using to get the text from the file is:  =Code.GetTextFile("HTMLTest.txt").ToString() Where "HTMLTest.txt" is the file name that I'm using.  The text itself is just a line of text with some HTML tags included for formatting - bold, color,

javascript pageLoad() & client side isPostBack property?

Hello and thanks for your help in advance. I have some javascript code that I have placed in the pageLoad() function like this:function pageLoad() { var x = 5; }But I only want this to happen on the first time the page loads... Is there an isPostBack property on the client site?

Client download .csv file from server using Response.TransmitFile

I am using the code below to enable clients to download a .csv file from my server.The problem I am having is that when the file is saved to the client computer the file name is prefixed and suffixed with an underscore which leads to a file type of .csv_ which is obviously not a recognised file type.How can I strip the underscores from the file name at the transmit stage?        Dim FileName As String = LstBox1.SelectedItem.ToString        Dim FilePath As String = "~/temp" & FileName        Response.Clear()        Response.ContentType = "text/csv"        Response.AddHeader("Content-Disposition", "attachment; filename=\" & FileName & "\")        Response.TransmitFile(FilePath)        Response.End() 

Calling Serverside PageMethod function from an external page Client Side Code ?

there is many examples on the net about this issue .like this :http://sappidireddy.wordpress.com/2008/03/31/how-to-call-server-side-function-from-client-side-code-using-pagemethods-in-aspnet-ajax/But all javascript codes are in same aspx file including codebehind WebMethodsI wantto call a pagemethod from a js which is in another page.something like this : (javascript code but not in same aspx)PageMethods("www.externalpage.com").GetContactName(ctrl.value, CallSuccess, CallFailed, dest)).or calling WebMethods from javascript must only be defined in codebehind with linked aspx fileonly avaible in same aspx ?cant I call a Webmethod in a.aspx from a javascript in b.aspx ?any clue ?thanks.

Client Javascript runs, but then page errors out when clicking on a control that uses postback

Using this script on a button click <script language="javascript"> function printdiv(printpage) { var headstr = "<html><head><title></title></head><body>"; var footstr = "</body>"; var newstr = document.all.item(printpage).innerHTML; var oldstr = document.body.innerHTML; document.body.innerHTML = headstr + newstr + footstr; window.print(); document.body.innerHTML = oldstr; return false; } </script> After it is done, I can't click on my calendar control.  I was hoping to add somethign that would force a refresh in the script, but nothing I do works. Any thoughts?  Thanks! 

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  

The external column "CLIENT" (2639) has no mapping to the XML schema

Hi, I am having validation errors when moving between test and production servers.  I have a package which is reading and XML file and loading the data into staging tables.  The XML source is configured to use a variable for the file name (which is getting populated through a foreach loop.  The default value points to a file that was on the production server when the package was created).  The XSD is stored on a network share.  This all looks fine in test.  When I deploy it to production there are no validation errors, but when I run it, I get errors about the first few columns in the schema complaining: "The external column "<Column Name>" (2639) has no mapping to the XML schema" If I open the package while pointing to the production server, I can double click the XML Source and clear the errors.  I can then redeploy it and the package will run without issue in production.  However, if I open it back up and the package is again pointing to the test server, these metadata errors come up again.  I have rebuilt this component and the XSD a dozen times, thinking that the component was corrupted, but nothing seems to help.  I even rebuilt the entire dataflow.  Any ideas on to make this transition from test to production more smooth?  Is there a more reliable way that I can configure t

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

Get the Dropdownlist text and value using Javascript from client side

Hi, I am encountering a problem about how to get the Dropdownlist text and value using Javascript from client side. I am using C# in Visual Studio 2005 and Javasript . The example codes are like: ( In this example code, I would like to access the text and value of the DropDownListReports in the run() function of Javascript. How can I do that? Any ideas? Thanks a lot. ) protected void Page_Load(object sender, EventArgs e) {              if (!Page.IsPostBack)               {                     DropDownListReports.Items.Clear();                     ListItem listItem = new ListItem();                     listItem.Text = "aText";                     listItem.Value = "aValue;                     DropDownListReports.Items.Add(listItem);         &nbs

How to call javascript from file

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 /> 

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.      
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