C# - Using Server Side Method From Javascript Without AJAX?

Mar 9, 2011

I have a tricky problem. I am in a situation where I need to use a method defined in a .cs file from a javascript function. The problem is we are using .NET 1.1 and AJAX cannot be used for the application.

Also, I will need to pass a string from the javascript to the server side method. The page where I am implementing the javascript is a .as

I have tried doing a post back and creating a RaisePostBack event handler method (both in the .aspx page and the .ascx user control) but no luck.

The javascript is called from a span's onclick event. The javascript function's input parameter would be a string which I will need to use to instantiate an Attachment.

I created a method which instantiates an Attachment using a string and calls the corresponding Delete() method for the Attachment object.

Now, I will need to pass the string from javascript function to the method I have created. I cannot use PageMethods.

The Javascript function is like:

[code]....

View 3 Replies


Similar Messages:

AJAX :: How To Call A Server Side Method From Client Side

Jul 16, 2010

I am using VS2010 and .NET4 for a web app. I have a script manager/update panel that has a couple of grids.

The client just leaves the page opens and views an updated grid every 30 seconds or so.

I want to refresh the grid by calling the server side method to load the grid, but not load the whol page using meta refresh or similar (too much screen flicker and unnecessary bandwith).

Is it possible to set some timer using javascript or something and call a specific server method to refresh controls?

View 3 Replies

How To Call C# Server Side Method Through Javascript

May 3, 2010

I need to call a c# server method through the javascript. I have a gridview in which i have a column with dropdown list. When i change the dropdown's value i need to call a server side method through javascript and change the value of another text box in the gridview.

I am able to do this on the selected index change. but i am slightly worried about the performance.

i am using asp.net c#.

View 2 Replies

AJAX :: Can Send An Object From Client-side JavaScript To Server-side Code Via AJAX

Mar 16, 2011

I know that I can receive an javascript object from the server via ASP.NET AJAX using Json. But I am not sure how can I send an javascript object from my client-side javascript to my server-side code. And if I can, how can I extract this object in my server-side code and access its members?

View 1 Replies

Web Forms :: How To Call Javascript From Server Side Method

Jan 21, 2010

how can i call client side javascript from server side method (c#)

View 6 Replies

Javascript - Enhance A Composite Control's Client Side, My Approach Is To Recreate All Method On JavaScript?

Aug 30, 2010

I want to enhance a composite control's client side, my approach is to recreate all method on JavaScript, so here I have some troubles:Can I call onclick event on client side otherwise on server side?the statement table.onclick=SelectRow(event) fires a bug!Code:

function Control_Init() {
if( !(document.getElementById) ) { return; }
for( var i = 0; i < Controls.length; i++ ) {

[code]...

View 1 Replies

Ajax - Pass A Javascript Value In Server Side?

Sep 6, 2010

how can I pass a client side (JS) value in server side (C#)?

e.g.

I have a generated table (after uploading images) and it contains images and I want to select the image and throw the ID back in server side.

The uploade I used was JQuery Uploadify and I have a "onComplete" function

[code]...

View 2 Replies

AJAX :: Run Javascript When A ModalPopupExtender Is Shown Server-side?

Feb 1, 2010

I have a panel extended by the ModalPopupExtender that is sometimes shown using the .Show() method in my code-behind. I have a javascript function that resizes the popup and am able to get it to run when I use the client-side show function but how do I run the same javascript function when using the server-side Show() function?

View 3 Replies

AJAX :: Calling A Server Side Function From Javascript Without Using PageMethods?

Sep 17, 2010

i have used PageMethods to access the server side functions in javascript , but now my problem is that with pagemethods your controls will not go throught the full page lifecyle and these leads me to have "Object not set for an instance of an object" error. Now can someone come with a differnt approach without using pagemethods. What i want is to call a server side function , i dont want to pass any parameters to it

View 6 Replies

Server Side Web Programming Model Replaced By JavaScript / Ajax?

Dec 14, 2010

ASP.NET server controls has a few categories, for example, normal ones e.g. TextBox, Button which can be done in HTML/JS; Validation controls: can be done in JS; Login controls: I have seen them implemented in JS. Data bound controls: not sure, but maybe JS can work directly with databases, implementing controls like photo slider. So in the time span of next 5-10 years, will server-side web programming model fall out of mainstream and be replaced by JS/Ajax that interacts directly with databases?

View 2 Replies

Javascript - OnBeforeUnload - How To Call A Server-side Function Without Ajax

Jul 22, 2010

What I want to do: dispose of a session upon detecting an "OnBeforeUnload" event in the client. I know it doesn't fire 100% of times (90% accuracy works fine for me)

Here I saw how to do it with ajax, this system, however, breaks down with ajax: I can't use it at all.

View 3 Replies

AJAX :: Uploading Files Using Javascript And Ashx On Server Side?

Mar 26, 2010

i want to build a custom control using javascript on client side and ashx on server side.

I know about SWFUpload, how can i configure it with ashx on server side.

any tutorial how i can use FLASH objects to transfer files from client to server. i been looking for such tutorial for a while that uses flash object on client side and sends file info using bytes array to the server. also i want to reduce the size of the file on the client side before sending to safe bandwidth.

basically my client side is pure HTML/CSS/Jquery and Javascript using Ajax and my server side is ASP.NET with C# and most ASHX

View 2 Replies

AJAX :: Server Method Timed Out - Calling Webservice From JavaScript

Apr 20, 2010

I get this error "The server method xxx timed out." calling a WebService that internally does a hard query to the database, and takes some time. I use this method to change the webservice timeout, but it does not seems to do anything (the timeout errors appears in less than a second).
MyService.set_timeout(100000);

View 2 Replies

AJAX :: Fire A Javascript Onclick Function Before The Server Side Event(SelectedNodeChanged) Called?

May 12, 2010

I have developed a web application which contains aspdotnet treeview control. In this treeview control has binded with some database value.. that controls has one parent node and more than one child nodes for each parent node.

my problem is here, when the user clicks the parent node, I need to fire a javascript onclick function before the server side event(SelectedNodeChanged) called..

If I provide javascript to the parnet node when it is binding, then I could not fire the server side event(SelectedNodeChanged).

How to provide onclick javascript event for parent node in treeview control even the parent node has SelectedNodeChanged event.

View 6 Replies

Access Server Side Variable On Client Side And Vice Versa And JavaScript?

Dec 9, 2010

I have a requirement of adding server side variables in client side and other way round. Because I need to set a value from client side using javascript and access the same in code behind page.

I have to use C#.Net and JavaScript.

View 2 Replies

JavaScript - Exposing Server-side State Through Client-side Controls

Feb 11, 2011

I have a list of items on an ASP.net page. That list is selectable in that whenever the user clicks on one, the page does a postback and the server code stores the index or some unique identifier of the picture in a ViewState property indicating that it is currently selected.

I would like to minimize the load on the server and therefore I would like to store the index or unique identifier representing the image in some way on the client side. The best way I can think to do this is to store said information in a hidden field ), however I had two questions about this before I go crazy:

Is this a security risk in any way, shape or form (i.e., exposing implementation details of the page)?
Is there a better/best way to do this that is more industry-standard? Does ASP.net provide a framework to do this that is cleaner than my idea? Seems like this would be a fairly common requirement to me...

View 1 Replies

C# - Calling Server Side Function From Client Side JavaScript?

Sep 14, 2010

Possible Duplicates: how to call server side function from client side - asp.net Calling ASP.NET Code Behind function from Javascript Calling ASP.NET server side method via JQuery While loading an aspx page, how is it possible to call a server side method with the client side code?Can u show one example?

View 4 Replies

JavaScript - Pass Arguments From Client Side To Server Side?

Feb 11, 2011

I have two comboboxes and would like pass selected value and text to the server method (RadComboBoxItemsRequestedEventArgs) when the first combobox selected index changed.

Here is my code. But I am getting Javascript error message at this line. RadComboBox2.requestItems(item, false).

[code]....

View 1 Replies

JavaScript - Detecting Client-side DOM Changes Server-side - Is It Possible

Mar 7, 2010

I'm working on developing a custom control to select items from a predefined list. This is accomplished via 2 ASP.NET ListBox controls, with a few buttons to trigger the movement of ListItems from one ListBox to the other (lets call these ListBoxes lstSelected and lstDeselected).

This is easy enough to do in ASP.NET or JavaScript independently: I have both working. However, if modifications are made via JavaScript, ASP.NET retains no knowledge of this. Is there any way to register the creation of of options in a select tag without AJAX?

View 2 Replies

How To Convert Server Side Vb.net To Client Side Javascript

Mar 20, 2010

I've got a function I wrote quite some time ago that works fine, but I'd like to speed up the process and lessen server load by doing the same job in Javascript.I seem to be able to GET textbox values ok, but I can't seem to SET textbox values (I'm'-a JS noob). Can anyone lend a hand in converting my VB.NET code to it's JS equivalent?

Protected Sub txtSellingPrice_TextChanged(ByVal sender As Object, ByVal e As EventArgs) _
Handles txtSellingPrice.TextChanged
Dim SellingPrice As Double = Double.Parse(txtSellingPrice.Text.Replace("$", ""))
[code]...

View 2 Replies

Javascript - Get The Value Of Client Side Variable In Server Side?

Mar 24, 2011

I want to ask how to get the value of var title :

From this code :

protected void btnSubmit_Click(object sender, EventArgs e)
{
string script = "var title = $('.rsApt').attr('title');";
ClientScript.RegisterStartupScript(GetType(),"popup", script, true);
}

View 2 Replies

AJAX :: Calling Webservices From Javascript: OnError Method, How To Identify The Method

Aug 26, 2010

I have an application that has JS calling ASMX files to do asyncronous requests, using ASP.NET AJAX.

The problem is that I use always the same "onError" function, and now I don't know how to identify the method that rised the error, and it is giving me a lot of problems to debug errors. The parameter "data" of the onError method does not give enough information, for
example:

en System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
en System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeInternal(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object& convertedObject)
en System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeMain(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object& convertedObject)
en System.Web.Script.Serialization.ObjectConverter.ConvertObjectToType(Object o, Type type, JavaScriptSerializer serializer)
en System.Web.Script.Services.WebServiceMethodData.StrongTypeParameters(IDictionary`2 rawParams)
en System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target, IDictionary`2 parameters)
en System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams)
en System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)

Is there any way to know the webmethod that raised the error?

View 1 Replies

How To Call Server Side Method From JS

Feb 15, 2013

How to call server side method from. js?

View 2 Replies

Javascript - $.ajax Json Method Does Not Hit The Web Method?

Sep 22, 2010

When this function is hit , it does not call my function in code behind? Why could it be doing this? How can I fix this error.

$(document).ready(function() {
$('[id$=btn_Update]').click(function() {
var reten = $('[id$=txt_Reten]').val();
var i=0;
var selectValues = "";
var ProdID = new Array();
$("#lst_ProdId option").each(function() {
selectValues = selectValues + $(this).text() + ",";
ProdID[i] = $(this).text();
i++;
});
for(var j=0; j < ProdID.length;j++)
{
// alert(ProdID[j]);
}
var params = "{'ProdID':'" + ProdID + "','RetenP':'" + reten + "'}";
$.ajax({
type: "POST",
url: "/ProductPricing/Products/RetenPeriod.aspx/UpdateRetenPeriod",
data: params,
contentType: "application/json; charset=utf-8",
datatype: "json",
success: function(result) {
alert("sucess");
},
error:function(e) {
alert(e.statusText);
// if(errorThrown != null)
// alert(textStatus+ ":"+errorThrown);
// else
// alert("fail");
}
});
return false;
});
return false;
});

This is my webmethod in code behind:

[WebMethod]
public static bool UpdateRetenPeriod(string[] ProdID,string RetenP)
{
for (int i = 0; i < ProdID.Length; i++)
{
update(ProdID[i],RetenP);
}
return true;
}

View 3 Replies

Call Server Side Method From JSON?

Apr 3, 2010

How to call a method on a server side from JSON. Below is the code I am using

SERVER SIDE:

[Code]....

Now I want that on button click, I would call the function at the client side [JSON], which pass the textbox value to the function.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved