Web Forms :: Passing Data To Javascript?
Nov 9, 2010
Is there any way to pass a List<T> that's generated during the page load process to a Javascript function that's called when the user presses a button without having to manually serialize/deserialize the data every time (such as is the case with XML/JSON cookies)?
View 2 Replies
Similar Messages:
Mar 26, 2011
i am passing two parameter in javascript and open popup window.... but geeting mid value "undefined" here is my code:
<asp:TemplateField HeaderText="comments">
<ItemTemplate>
<a href="javascript:replycomments('<%# Eval("projectid")%>'),('<%# Eval("milestoneserial")%>')">Reply comments</a>
</ItemTemplate>
</asp:TemplateField>
and
function replycomments(id,mid)
{
window.open("replymilestone.aspx?id="+id+"&mid="+mid,"mypage","width=400,height=500,scrollbars=0,menu=0","");
}
this is working fine if i am passing single value like:
<asp:TemplateField HeaderText="comments">
<ItemTemplate>
<a href="javascript:replycomments('<%# Eval("projectid")%>')">Reply comments</a>
</ItemTemplate>
</asp:TemplateField>
and
function replycomments(id)
{
window.open("replymilestone.aspx?id="+id,"mypage","width=400,height=500,scrollbars=0,menu=0","");
}
View 1 Replies
Nov 2, 2010
In this datelastmodified is Datagrid Column Name. I m displaying that column value in DIV. Now, I want to display another column Value in that DIV. that column name is Document Type. May I know how to pass that value.
[Code]....
View 1 Replies
Sep 16, 2010
I am collecting user roles into a single dimension string array.
I have a repeater that its source set to that array. The repeater template includes list of checkboxes for the values in the array.The checkbox text is set to: Text='<%# Container.DataItem %>'
All is good till this point.
But I am trying to call a javascript function triggered by clickign a checkbox and pass it the container.dataitem, but the javascript doesn't seem to be reading the value and either complain about string not being in correct format or that treats the container.dataitem as a liter. This is the trial that didn't work (I tried many different things too):
DetermineVal(<%# DataBinder.Eval(Container.DataItem) %>);
determineval is my javascript function
Can I do that with a single dimension array?
View 2 Replies
Oct 14, 2010
in aspx page
<cmp:MenuItemInfo Text="Delete" onclick="javascript:deleteRow('## DataItem.ClientId ##')" />
In Javascript
function deleteRow(rowId)
{
Projectgrid.deleteItem(Projectgrid.getItemFromClientId(rowId));
}
but the arument is coming as a string '## DataItem.ClientId ##' instead of correct clientID.
View 2 Replies
Oct 28, 2010
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
Oct 16, 2010
I have been stuck on how to pass multiple to a JavaScript function in a item template of a list view. Below is my code. Does anyone know the process?
[Code]....
View 5 Replies
Apr 28, 2010
I want to pass data to id
<script language="javascript" src="/foo.aspx?id=1"></script>
I have this code in a aspx page.
The data should be passed on load, before this code is being executed.
how can i do that?
View 3 Replies
Oct 22, 2010
I have got a drop down list in a gridview and would like to pass eval() as parameter to javascript..
<asp:DropDownList ID="ddl_grprowcutter" runat="server" onchange='<%# "fn_ddl(" +Eval("Order_No") + " );" %>'
View 15 Replies
Jul 1, 2010
protected void saveMergedFile(string[] ReportFiles)
{
foreach (string item in ReportFiles)
{
[code]...
View 24 Replies
Feb 11, 2012
If a value is stored inĀ a session object. How do I retrieve the session value in a function in javascript. I tried
var background1 = '<%=Session["test"]%>'
But I get blank
View 1 Replies
Feb 11, 2011
How would I pass an Object or Array to a function using the ICallBackEventHandler (RaisCallbackEvent)? It allows for a string argument only, if you change it to another datatype it error out. Sample Below...
[Code]....
[Code]....
View 6 Replies
Dec 3, 2010
I have the following HTML
<tr>
<td class="label" valign="top">
Affiliate Party
</td>
<td class="field">
<input type="hidden" name="ctl00$MainContent$ExternalAccountAttributes$AffiliatePartyId" id="AffiliatePartyId" />
<input name="ctl00$MainContent$ExternalAccountAttributes$AffiliatePartyName" type="text" id="AffiliatePartyName" class="PartyLookup" />
</td>
</tr>
and the following Javascript/jQuery
$(".PartyLookup").after("<img src='Images/book_open.png' class='PartyLookupToggle' style='padding-left:4px;' />");
$(".PartyLookupToggle").click(function () {
window.open("PartySearch.aspx", "PartySearch", "width=400,height=50");
return false;
});
I need to be able to flag ANY PartyId input field with class="PartyLookup" so that it will modify the DOM and include the image next to the input field. The popup window returns data to populate both the hidden and text fields, but since the click() is generic I need to pass it the ID of the input field.
View 2 Replies
Nov 15, 2010
I just need to know how to pass a javascript variable to c# when i click on a button
View 2 Replies
Nov 1, 2010
I have an ASP.NET Image control declared as:
<asp:Image runat="server" ID="SortOrder"
AlternateText="Ascending"
ImageUrl="~/images/sort_ascending.gif"
CssClass="Ascending"
EnableViewState="true"
/>
[code]...
View 2 Replies
Jun 17, 2010
I tried to pass a string value into a JavaScript function like below: <%= "'" + prop.property_description + "'") %>) But it does not seems to be the best option, is there a better way to do the above without concatenate the string values with "'"?
View 2 Replies
Mar 24, 2010
I'm playing around with a asp.net page that's using the IScriptControl interface to pass data from the code-behind to the custom javascript object running on the browser.I'm passing a number of properties via IScriptControl.GetScriptDescriptors(), and they're all working fine, except for one.That one is a class derived from System.Collections.Generic.Dictionary<>. And even that one has been working for me, so long as the elements in the collection were scalars - ints, doubles, and strings. But when I tried to pass a member of a class, it showed up as a null object in the javascript. The class in question is marked [Serializable]. I changed it to a struct, and got the same behavior.It looks as if the serializer used in IScriptControl does a shallow copy.
View 2 Replies
Dec 1, 2010
I have settings in AppSettings (web.config) and I need to pass them to an external javascript file.
In ASP.NET I would think of an ASHX handler to write the javascript file to the response replacing placeholders with the settings values.
View 1 Replies
Jun 18, 2010
i have a simple model [Code]....
when i render a view to show the data inside the model, i also need to write some javascript
how to get the ID value in the script from the View?
View 3 Replies
Feb 24, 2011
I am using ASP.NET MVC 3 and the YUI library.I created my own helper method to redirect to an edit view by passing in the item's ID from the Model as such:
window.location = '@Url.RouteUrl(Url.NewsEdit(@Model.NewsId))';
Now I am busy populating my YUI data table and would like to call my helper method like above, not sure if it is possible because I get the item's ID by JavaScript like:
var formatActionLinks = function (oCell, oRecord, oColumn, oData) {
var newsId = oRecord.getData('NewsId');
oCell.innerHTML = '<a href="/News/Edit/' + newsId + '">Edit</a>';
};
View 1 Replies
Nov 2, 2010
I am trying to pass parameters to a popup window via query string(a hidden field id & a textbox id). However, since I am using master pages the id's are very long (ct100_someid). Is there a way to elegantly pass my ids ? Can I shorten my id's or not show them to the user at all?
View 2 Replies
Mar 7, 2011
I have the following javascript. Problem is if I enter one row in the table "ingredients" but I am getting 2 rows in the resulting pass to controller action after seralising into my C# object. But the second object is null? I checked the javascript and the variable "cnt" is 1 not 2. Why would that be?
[code]
$("#Save").click(function () {
var title = $("#recipetitle").val();
var category = $("#category").val();
var preptime = $("#prepTime").val();
var preptimeperiod = $("#lstPrepTime").val();
var cooktime = $("#cookTime").val();
var cooktimeperiod = $("#lstCookTime").val();
var rating = $("#rating").val();
var method = $("#method").val();
var jsontext = '{ "RecipeTitle": "' + title + '",';
jsontext += '"CategoryID":' + category + ',';
jsontext += '"PrepTime":' + preptime + ',';
jsontext += '"PrepTimePeriod":"' + preptimeperiod + '",';
jsontext += '"CookTime":' + cooktime + ',';
jsontext += '"CookTimePeriod":"' + cooktimeperiod + '",';
jsontext += '"Rating":' + rating + ',';
jsontext += '"Method":"' + method + '",';....................
View 1 Replies
Aug 11, 2010
I have this javascript
function myFunction(source) {
window.open(source, "Title", 'width=400, height=400');
}
and in c# code I call it by
HtmlPage.Window.Invoke("myFunction", source);
which opens up a aspx page and goes to its OnLoad function:
protected override void OnLoad(System.EventArgs e)
{
base.OnLoad(e);
how do I pass in parameters to the event args in the aspx page? or is that even possible? and how can I pass these parameters from my c# code to the javascript?
View 2 Replies
Oct 26, 2010
Is there a way to assign/pass/copy a javascript variable to a server side variable in C#? For the sake of argument, let's say that I was able to parse some JSON for variables that I want to store and assign them on the client (ie. var = FirstName and var = 25 and var = someDateTime, etc) .
View 4 Replies
Mar 4, 2011
I have an ASP.NET MVC controller action with the following VB.NET signature:
<HttpPost()>
Public Function ClosestCities
(ByVal position As MapCoordinate, ByVal citiesCount As UInteger) As JsonResult
The MapCordinate class is:
Public Class MapCoordinate
Public Latitude As Double
Public Longitude As Double
End Class
If I'm trying to send an Ajax POST in jQuery to the ClosestCities action, what should my request look like?
When I use the following code to POST to this action, in the debugger window of VS, position.longitiude and position.latitude are equal to 0.0 (0D):
[code]....
View 2 Replies