How To Pass The Values To A Javascript Function From Page

Feb 26 09

I've a a javascriptfunction in my master page JavaScript Function:

var meetingID=null;
var panelID=null;
var fileGridID=null;
function openPopup(meetingId,panelId,fileGridId)

now what i want to do is i want to pass values for this function from page. suppose say from the eventhandler given below.

protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
/* some code here to get the values */

Now i want to pass the values to the javascript function.

i tried this one



How To Pass JavaScript Function As A Parameter In The Route Values Of Ajax Actionlink

Apr 20 10 at 6:51

I need to pass javascript function as a parameter value to the ajax actionlink in mvc app. how can we achieve this?

View 1 Replies View Related

Javascript - How To Pass A Value From The Serverside Page To A Function In .JS File

Jul 30 10 at 15:31

I have to pass a string value from the server side page (.aspx.cs) to a function in .JS page. I need to call the function in JS page from server side page along with string as a parameter.

View 1 Replies View Related

C# - Pass Model Values As Javascript Function Parameters From Inside Mvc Html Helper Such A Html.Radio?

Jul 20 10 at 16:38

I think I need to drop in some escape characters, but I'm not quite sure where. Here is the javascript function I'm attempting to call:

function setData(associateValue, reviewDateValue) {
var associate = document.getElementById("Associate");
var reviewDate = document.getElementById("ReviewDate");
associate.value = associateValue;
reviewDate.value = reviewDateValue;

Here is the asp .net mvc line where I'm attempting to create a Radio button with a click event that calls the above function and passes data from the model as javascript parameter values.

<%= Html.RadioButton("Selected", item.Selected, new { onClick="setData('<%=item.Associate%>','<%=item.ReviewDate%>' )" } )%>

The above throws a bunch of compile issues and doesn't work. A call such as the following does call the javascript, but doesn't get the data from the model.

<%= Html.RadioButton("Selected", item.Selected, new { onClick="setData('item.Associate','item.ReviewDate' )" } )%>
<%= Html.RadioButton("Selected", item.Selected, new { onClick="setData('item.Associate','item.ReviewDate' )" } )%>
<% String functionCall = String.Format("setData('{0}','{1}')", Html.Encode(item.Associate), Html.Encode(item.ReviewDate )) ; %>
<%= Html.RadioButton("Selected", item.Selected, new { onClick=functionCall } )%>

View 2 Replies View Related

C# - Pass Value To Javascript Function ?

Jul 11 10 at 6:41

I have this code

<asp:GridView ID="gvCentersList" runat="server" AutoGenerateColumns="False"
DataKeyNames="CenterID" DataSourceID="SqlDataSource1" CssClass="gv-classic">
<asp:TemplateField HeaderText="">
<asp:CheckBox ID="GridCheckBox" runat="server" onclick="javascript:func1150(this,<%#response.write(CenterID)%>);" />
<asp:BoundField DataField="CenterID" HeaderText="CenterID" SortExpression="CenterID" />
<asp:BoundField DataField="CenterName" HeaderText="CenterName" SortExpression="CenterName" />
</Columns></asp:GridView><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnectionString %>" SelectCommand="SELECT ROW_NUMBER() OVER (ORDER BY CityName ASC) AS ROWID, * FROM [CentersList]"></asp:SqlDataSource>

my question in this line


how can I pass the CenterID to the func1150 ?

View 2 Replies View Related

Pass Javascript Value To Function?

Jan 3 at 15:20

the question says it all : i have a linkbutton to which i pass through CommandArgument a value and i need that value to be a javascript value.Edit : here is my linkbutton tag :

< asp:linkbutton id="prevBut"
runat="server" OnCommand="load_com"


View 3 Replies View Related

Pass A Value To A Javascript Function?

Aug 12, 2009 11:56 AM

I need to call a Javascript function to launch Word on the client's machine. I also need to execute a macro (named PopulateTemplate) to populate some terms on the Word document. I can get all of this to work so long as I pass a hard-coded string in the code as below:


The real need though is that the parameter 24 as above changes dynamically for each user. In the back-end code of the ASP.NET page I retrieve this from a database. I need to pass this parameter to the Word macro. I've tried populating a HiddenField on the form but I can't get the Javascript to pick it up. I have wrapped single quotes and double quotes around the Hidden field's ID but neither seem to work. I get no error message.


View 5 Replies View Related

Pass ID From GridView Row To JavaScript Function?

Sep 3 10 at 19:42

The first commented line below is working with a hardcoded ApplicantId, and all I need is to make it work by passing the current ApplicantId column on the same gridrow.

I've tried for many days now, and something like the second commented line does not work for me.

<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
DataKeyNames="ApplicantID" >
<asp:TemplateField HeaderText="Select">
<asp:CheckBox ID="CheckBox1" runat="server" />
<!-- works -->
<asp:HyperLinkField NavigateUrl="javascript:popUp(3)" Text="Select" Target="_parent"/>
<!-- doesn't work -->
<asp:HyperLinkField NavigateUrl='"javascript:popUp("<%# + DataBinder.Eval(GridView1.DataItem,"ApplicantId") %> + ")"' Text="View" />

View 1 Replies View Related

Pass The Value Inside A Javascript Function?

Sep 10, 2009 02:33 AM

i want to pass the value of abcd inside a javascript function. below are my codes. am i doing it right? cause i do not seem to be able to get it working

this is the url

default.html?test=abcd and this is the body onload <body onload="highlightSearchTerms('<%=Request.QueryString("test")%>')">

View 6 Replies View Related

Pass Xpath Value In Javascript Function?

Apr 5 at 6:00

here my code that gives error-

OnClientClick='javascript:DragRevId(<%# XPath("ReservationId") %>);return false;'

View 1 Replies View Related

Web Forms :: Pass Control Id To Javascript Function

Nov 23, 2009 06:18 AM

I had few linkbuttons.i need to call a javascript function on a linkbutton click .i need to send the clicked linbutton id as input parameter to the javascript code is below

<asp:LinkButton ID="lbtnWelcome" PostBackUrl="..aspx" OnClientClick="return changeColor(this);" runat="server" CssClass="linkbutton" Text="Welcome"></asp:LinkButton> |
<asp:LinkButton ID="lbtnHome" PostBackUrl="...aspx" OnClientClick="return changeColor(this);" runat="server" CssClass="linkbutton" Text="Home"></asp:LinkButton>

function changeColor(id) {
var idd = document.getElementById(id);
return false;

but the idd value is null always

View 7 Replies View Related

How To Pass A List Of Values To Compare In A SQL Function In SQL Server 2008?

Feb 18 10 at 16:08

I have an SQL Function with the following SQL within:

FROM Stock
WHERE CategoryCode LIKE @CategoryID) AS Info
WHERE RowNum BETWEEN @startRowIndex AND (@startRowIndex + @maximumRows) - 1

I have a Parameter @CategoryID - however I need to take in a category ID such as "BA" and translated this to a list of Category IDs such as "IE","EG" etc so my WHERE clause looks like:

WHERE (CategoryCode LIKE 'IE' OR CategoryCode LIKE 'EG') AS Info

I have a Lookup Table which contains the "BA" code and then all the real category codes this means such as "IE" and "EG".How do I have the CategoryID expand to multiple "OR" statements in my SQL Function?

At the moment the query as shown can cope with one CategoryID such as "IE", this is done as I want a category page such as category.aspx where a parameter "BA" is passed such as category.aspx?category=BA and this page will list all items with the category codes "EG" and "IE".

The reason I need this is there is a "parent" category code which has multiple "children" category codes which are different to the parent code. I am using ASP.NET and .NET 3.5 on the front-end if this helps.

View 2 Replies View Related

Web Forms :: Pass Name Of The Textbox Control To Javascript Function

Dec 22, 2010 11:29 AM

pass name of the textbox Control to javascript function


var sum = 3;
var textboxObj,ObjName;
function validate(textboxObj,ObjName) {
var arrayOfObjects = document.getElementsByName(ObjName);
for (var i = 0; I < arrayOfObjects.length;i++) {
alert('Inside for loop');............................

View 9 Replies View Related

Pass Parameter As Text To JavaScript Function From Code Behind

Mar 23 10 at 14:33

Basically, I have a gridview that is opened in a new window from the parent window. It has a bunch of records with a view button to view the details of each record (which stays in the same newly opened window). I have a calendar in the parent window that accepts a Date querystring parameter to set the current date on the calendar at page load. I'm just trying to refresh the calendar in the parent window to match the date of the label in the newly opened window. All the code below is in the newly opened window. The .Net code-behind below refers to when that view button is clicked and everything is populated. At the end, I call the js to refresh the parent window and pass the value of the LabelScheduleDate as the querystring parameter. Now the label comes through as '03/25/2010' in the code-behind, but when I pass it to the js, it comes through as '0.00005970149253731343' in the end querystring. I'm not really sure what is making the value change, and I want to pass it as just text. Do I need to pass it as a string object? I tried but I don't think I was doing it right.

JavaScript Function
function RefreshParent(inputDate) {
window.opener.location = window.opener.location + "?Date=" + inputDate;
.NET Code-Behind
Protected Sub RadGridOnlineRequests_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGridOnlineRequests.ItemCommand
If e.CommandName = "ViewOnlineRequest" Then
' populates LabelScheduleDate among other controls values
ScriptManager.RegisterStartupScript( _
Me, Me.GetType(), "clientScript", "RefreshParent(" & LabelScheduleDate.Text & ");", True)
End If
End Sub

View 1 Replies View Related

Web Forms :: Call Javascript Function - Can't Pass The 2 Argument

Jan 19, 2010 06:13 AM

in aspx:

function checkFunction(no,name){

in cs:

string test_name ="hello";
StringBuilder Strname=new StringBuilder();
Strname.AppendLine("<td ><input type=checkbox onclick='checkFunction("+no+","+test_name+");' runat='server' name='checkbox_name' value='XX'</td>");

when i call the checkFunction(), i can't pass the 2 argument as there is error.

View 3 Replies View Related

Pass Eval As Javascript Function Parameter In Gridview?

Jun 25 10 at 16:26

I have the following:

<asp:Button ID="wrqst_need_ind_btn" runat="server" Text = "Create WR"
CommandArgument='<%# Eval("dvc_nm") + "|" + Eval("data_orgtn_yr") %>'/>

I want to pass in as two additional params the Eval("dvc_nm") and Eval("data_orgtn_yr") to the popup function.


I tried by removing the single quotes from insode the <% %> tags. Which gave me this:

onClientClick='<%# "javascript:popUp(popup_createWR.aspx," + Eval("dvc_nm") + "," + Eval("data_orgtn_yr") + ")" %>'

which complied, but when I clicked the button I did not get a pop up, the page just posted back and reloaded and said errors on page, but no popup...

View 2 Replies View Related

Javascript - Ajax Call Pass Parameters To Function?

Feb 7 at 21:04

What is wrong with this code? I am trying to pass parameters to a WCF function. I couldn't get this to work. I am getting Ajax error.

url: applicationPath + "/Test.svc/GetData",
type: "POST",
dataType: "json",
data: '{GId":' + sender.get_value() + '"GName":' + sender.get_text() + '"mId":' + testId + '}',
contentType: "application/json; charset=utf-8",
success: function(result)
//trying to fill combobox here

View 1 Replies View Related

Pass An Anonymous Array Of Strings To A JavaScript Function?

Apr 5 10 at 17:48

I want to pass to an array of controls' IDs to a javascript script function so it will switch control's enable state.

For example, in C# it would be like this:

func(false, new[] { "Control1", "Control2", "Control3" });

In that function I want to find corresponding controls and disable/enable them. For one control I do this next way:

<script type="text/javascript" language="javascript">
function switchControls(value, arr) {
for (var n = 0; n < array.length; n++)
document.getElementById([n]).disabled = value;
<asp:CheckBox runat="server"
'<%= Control1.ClientID %>',
'<%= Control2.ClientID %>'
Text="Take?" />

How to implement this properly? Have I to use jQuery?

View 3 Replies View Related

Web Forms :: Pass Variable As Html Control Through To Javascript Function

Jan 24, 2011 11:59 PM

I have a function that gets the position of a control.


All the function needs is an htmlcontrol being fed to it as the parameter (elemRef). I can declare a variable in Javascript of the same content page but different function and pass the parameter successfullly getting returned values. For example, if I have the following function:

function (getPosition)
{ var txtBox1 = document.getElemendById('<%=txtBox1.ClientID %>');

I will get the coordinates of the control txtBox1. But how can I accomplish this if I am calling this function from a javascript function or codebehind of the Master Page, or codebehind of the same content Page.

View 4 Replies View Related

Web Forms :: Using Javascript, Call One Function From Another, Pass A Variable That Represents?

Jan 20, 2011 06:41 PM

I have a variable created to manipulate a contorl on a page:

var pnl= document.getElementById('<%=pnl1.ClientID %>');


View 1 Replies View Related

Forms Data Controls :: Pass A Datafieled Value In Javascript Function?

Nov 19, 2009 03:50 AM

I want to pass a datafieled value in javascript function. Here is my code

<asp:Button ID="btn1" Text="abc" OnClientClick='<%# Eval("CID","return fnDisp( {0} )")%>' runat="server"></asp:Button>

The CID datafield have the value as "37,98,99". But I'm getting only the first value in the fnDisp. i.e 37.

View 1 Replies View Related

MVC :: Pass Parameter To Javascript Function From OnSuccess Event In Ajax.ActionLink?

Apr 27, 2009 06:50 AM

When I use:

new AjaxOptions { UpdateTargetId = "VoteCount" + indx, OnSuccess = "AnimateVoteMessage" }

everything works fine...but I am trying to animate items in a list, with automatically assigned ID's. Since I want each of these to be addressable from my javascript, I believe I need to pass a parameter to my javascript. But when I use:

new AjaxOptions { UpdateTargetId = "VoteCount" + indx, OnSuccess = "AnimateVoteMessage(2)" }

I get an " Sys.ArgumentUndefinedException: Value cannot be undefined." exception. Well I get that when using the debug versions of MicrosoftMvcAjax.js. When using the compressed version I get a "Microsoft JScript runtime error: 'b' is null or not an object" So my question is, can I pass a parameter to my javascript function using the OnSuccess event for a ActionLink? Is this the right approach? How else am I going to have one javascript function have the ability to be run on 10 items (in my case the IDs of multiple DIVs) on my page?

View 6 Replies View Related

How To Pass Values To Javascript From Code Behind

Oct 28 10

Basically I want to display a popup box only at a specific time in application. so i'm using the following


but this code is not working. the alert box is not popping up. is this a correct method to pass values to the script?. or what else to be done to meet the requirement?.

View 1 Replies View Related

How To Pass Values From Querystring To JavaScript

Nov 4 10 at 8:05

Now that i learned how to pass values to an SWF object via flashvars, how can i pass values from a querystring to javascript?

What do i mean? In the following example i hard-code the xml file to load in the SWF object.

<script type="text/javascript">
var so = new SWFObject("preview.swf", "", "100%", "100%", "9", "#ffffff");
so.addParam("allowFullScreen", "true");
so.addParam("scale", "noscale");
so.addParam("menu", "false");
so.addVariable("xmlPath", "xml/exampleData.xml");

Since the Xml file is created dynamic, the xml should be loaded from the value of a query-string. (I guess).

Supposing my url is

How can i pass it to the javascript side? Like..

so.addVariable("xmlPath", "xml/<% SomeData %>.xml");

or whatever it needs to make it work.

UPDATE: Besides the above example, is there any way of creating the JavaScript, in server-side?

View 3 Replies View Related

JQuery :: How To Pass TextBoxs Value In Repeater Control In JavaScript Function On Click Of Button

Jan 25, 2011 04:57 AM

In a repeater control there is TextBox and corresponding to each TextBox there is Button control.On click of Button how can i pass TextBox's text that user has just entered ?

Below is the code:


Means on click of each Button how to pass there respective TextBox's data to a javascript function ?

View 17 Replies View Related

Forms Data Controls :: Pass And Get A Div Id Inside A Gridview As Parameter To A Javascript Function?

Oct 02, 2009 04:30 AM

In my gridview iam having a Div, which i expand and collapse on a button click through a Javascript fun, by passing the div id as paratmeter to JS fun, the code is



The problem is, here iam getting null for 'e',because during runtime the gridview div id got changed. i tried div1.ClientID also it didn't worked. how to pass div id to Javascript function.

View 6 Replies View Related

Forms Data Controls :: Pass EditTemplete Textbox Id To JavaScript Function On GridView Row Databound

Dec 28, 2009 06:28 AM

I've a textbox inside the editItemTemplate of a gridview. I want to write a javacsript to be called on thsi textbox.It should check the date is greater than or equal to today's date or not.

In RowDataBound event of the gridview , i'm findng this textbox control, passing it's clientId to the javascript function that is written


View 2 Replies View Related

Passing Database Values To Javascript Function?

Nov 20, 2009 06:09 AM

i have javascript file named as sample.js,


above i need to pass lat long values from server methods,means from .CS file.

how do i do this stuff.

View 7 Replies View Related

AJAX :: How To Pass 2 Variable Values Using JavaScript To A Web Service

Mar 07, 2010 09:28 PM

How can I pass two variable values to a web service web method using JavaScript and a DynamicPopulateExtender?

Some background of my issue:

I have a fully working cascading drop down list accessing a database.

My parent Cascading Drop Down List is a list of countries and the child displays the relative regions i.e.: USA returns Iowa, Maryland, Oregon etc.

I also have a 3rd Drop Down List control that allows the user to select the language to display the region details i.e.: Selecting the language of Chinese will return a list of regions of the USA in Chinese (held in the database).

I now want to display the translated country name from the 3rd Drop Down List in a label on the page.
I cannot just use the text from the country drop down list as this text value remains in English. The translated value must be returned from the database.

So far, I have installed a DynamicPopulateExtender:


I then wrote a web method (in the Cascading Drop Down local Web Service) to return the translated country name. To do this I have had to hard code the countryID (10663) and the translationLanguageID (1331) asshown below:


This does return the translated country name, but the variables are hard coded!

My question is how do I pass the countryID and the translationLanguageID to the Web Method GetTranslatedCountryName() from the DynamicPopulateExtender? Or even if there is a better way to achieve my task?

View 2 Replies View Related

JavaScript Function Checking The Values Before Inserting Into Database?

Feb 19 09

I've been searching for a solution ..but not yet found.Here is my requirement.

In my webpage one button ,Edit, is available whenever user clicks on tht button will displays one modalpopup window contains an updatepanel.. and inside that we've 10 textboxes and two buttons update and close.whenever user clicks on the update button has to check whether all the textboxes has values or not ..if it yes continue if not alert the user saying tht so and so textbox is empty plz provide the value.

How can i do this in ASP.NET 2.0 ,im using AJAX.

My doubt is tht how can we display a popup from upon a it possible ?

View 4 Replies View Related

Call Javascript Function Of Child Page From Master Page Javascript?

Jul 28 10 at 14:27

I am writing an ASP.Net application. I am making use of master page in it. I have several child pages with me, which consist of some java script functions; Let's say;

function ChildPageFunction()
//Do something;

And master page java script function as;

function MasterPagefunction()
//Need to call ChildPagefunction(); here

Now is it possible to call ChildPageFunction() from MasterPageFunction()?

View 2 Replies View Related

Forms Data Controls :: Pass The Fields Values To The JavaScript Variables

Mar 13, 2010 02:18 PM

i am still stcuk with my project and unabale to perform calculation on my edited gridview..

here is my problem :

i have fields (f1,f2,f3, f4...) pulled from my sql data base table. into a gridview.

the "f4" field value is based on some calculation done on f1, f2 & f3 field values..

1- i need to have the same calculation done when i edit and update f1, f2 & f3 on my gridview...

more complicated..

2 -my calculation are based on a javascript function ...

a- how can i pass the fields values to the JavaScript variables...perform the calculation....then reassign back the result varibale to the f4 field ?? ..then update my gridview with the new calculation..


View 6 Replies View Related

Forms Data Controls :: GridView Passing Values To JavaScript Function?

Dec 08, 2009 05:56 PM

I am using a Gridview in n-tier architecture. And populated it programatically. Each GridView row have two fields. Name and Id.

I want to pass the Id to a javascript function whic will be attached to the Name.

View 4 Replies View Related

Forms Data Controls :: Passing GridView Row Bound Values To JavaScript Function

Oct 28, 2010 03:07 PM

I have a GridView with an image button in a TemplateField in the last column.

I would like to pass the GridView row values (Bound Field Values - a record) to a JavaScript function to create another html table of selected records in ClientSide (like jCart-A shopping cart).

I would like to know how to pass all GridView column values to the javascript when the image at the end of the respective row is clicked.

View 5 Replies View Related

How To Use Javascript Function To Hide And Show One Table Using Checkbox List Values In Content

Dec 04, 2009 08:30 AM

I have a Master Page . then I have created one Content Page.I have one checkbox List in Content Page .I want to Hide and Show one table/text box/div/image according to the check box select item.So I want to use Javascript function and which will be client side and then it ll be faster to use.

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="EduMaster.master.cs" Inherits="Education_EduMaster" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

View 6 Replies View Related

AJAX :: JavaScript Function To Pass Value From MasterPage.aspx To Default.aspx And Then Refresh UpdatePanel

Feb 26, 2011 11:47 PM

For example, I have master page MyMasterPage.aspx and content page MyDefault.aspx. I have many UpdatePanels at MyMaterPage.aspx, and also I have many UpdatePanels at MyDefault.aspx.


I want JavaScript functionClickMenu(this) at input button [id="ButtonMaster1" @ MyMasterPage.aspx] pass its value ["Menu-1"] into text box [id="TextBoxDefault1" @ MyDefault.aspx], and then performing update / doing post-back to server ONLY FOR UpdatePanelDefault1.

I am looking forward an example code for JavaScript functionClickMenu(this).

View 4 Replies View Related

Javascript - How To Pass Page Or Master Page Object To AJAX Page Method

Oct 5 10 at 5:18

I wrote a page Page method in my aspx page. in web service method I need to call FindControl method return textbox and get text box value. But my findControl will take MasterPage object to iterate.

code.<script type = "text/javascript">
function ShowCurrentDateTime() {
$.ajax({ [code]....

But I am getting compiler error when use Page.Master: Reference to non-shared member requires an object reference

How to pass Master Page object or Page to Page method?. So I can use in Sared method.Is there any way I can access Textbox value directly in Page method? I need access couple of controls in Page Method.

View 4 Replies View Related

Pass Values From One Page To Another?

Mar 17, 2010 11:13 AM

i have one scenario in which i have to pass values from one page to another for that currently i am using querystring but now the values are more so i want to remove querystring and i dont want to user session as well and so i have tried using Hiddenfields but after redirecting to another page the values are cleared from all the hidden fields.

View 14 Replies View Related

How To Run The Javascript Function On The Page Onload Event In Content Page Of Master Page

Nov 4 10 at 10:12


means i have masterpage and the content page of master page namely default.aspx in

My problem was that .

i wanna run javascript function in Default.aspx and i have called the function

body onload in master page..

when i run my website it shows the error

"" Microsoft JScript Runtime Error : Object Expected ""

View 4 Replies View Related

Web Forms :: How To Pass Values From One Page To Another Page Using Querystring

Dec 07, 2010 05:37 AM

in my webpage pass values from one page to another page Querystring

in first page there two textboxes both textbox values pass to them ,but sometime only one value select if am entering only

first textbox value it will pass,if am entering only second textbox value it wont pass value the value taken like that

Response.Redirect("~/Admin/VegaFABS.aspx? symbol=" + txtSymbol.Text);
second page
string s2 = Request.QueryString["symbol"];

View 3 Replies View Related

Copyrights 2005-14, All rights reserved