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

Top 5 Contributors of the Month
Sandeep Singh
Post New Web Links

How to send parameters to the AJAX callback function

Posted By:      Posted Date: August 27, 2010    Points: 0   Category :ASP.Net

I need to send som parameters to the callback function of my AJAX call, how can i do that:



function DoSomething(id, textbox1)
  AjaxHandler.FindSomethingInDB(id, Callback);

function Callback(result, eventArgs)
  // Here i need to know the value of textbox1 from the function "DoSomething"


View Complete Post

More Related Resource Links

XAML - ValueConverter Parameters and PropertyChanged callback

Hi I am trying to use a IValueConverter on the flowdocument of a richtextbox. However, ideally I'd like to be able to inject some dependencies into the converter on construction or perhaps with a setter of some sort. Previously I've been using an IoC to construct a formatter-type object and can obviously specify the constructor dependency quite easily. However, I was hoping to use XAML and the IValueConverter as much as possible, but specifying the converter in the Grid.Resources requires a parameterless constructor. Are there other ways in which I can do this or do I need to think about the problem differently. In addition, because you cannot bind to a RichTextBox, I have introduced an AttachedProperty. Here's some code     Public Shared ReadOnly DocumentProperty As DependencyProperty = DependencyProperty.RegisterAttached("Document", GetType(FlowDocument), GetType(RichTextBoxExtensions), RichTextBoxFrameworkPropertyMetaData) Private Shared Function RichTextBoxFrameworkPropertyMetaData() As FrameworkPropertyMetadata Dim metaData = New FrameworkPropertyMetadata metaData.BindsTwoWayByDefault = True metaData.AffectsRender = True metaData.PropertyChangedCallback = New PropertyChangedCallback(Sub(obj, e) If _recursionProtection.Contains(Thread.CurrentThread) Then Return Dim rtb = CType

How to get jquery/ajax parameters on the server

Hi, It is my code: $.ajax({            type: "POST",              url: "Default.aspx",              data: "category=2&city=Boston",              contentType: "application/json; charset=utf-8",              dataType: "json",              processData :false,              error: function (json) {                  alert(json.statusText);              },              success: function (json) {                  alert(json.statusText);                }          });  How can I get my parameters(category,city) on the server? Request's parameters is always null.   Thanks, katzraya

Send To function needs checking out of all copies?

I have set up two document libaries: for both check out is required for editing documents. I made a custom destination for the send to command from document library A to document library B. I created a document in library A and have sent it to document library B: so far so good. Now I am editing the original source document in document library A. After my edition, I checked it back in document library A. I try to send it back to document library B, but this fails: "Copying to the destination did not complete successfully". After investigating the log files (cause the error message is very unclear: it doesn't work to copy, but why is a mystery), I found out that the document in document library B needs to be checked out. So I checked out the copy in document library B, tried again the send to from document libary A to B and now it succeeds. My question: is this behaviour as expected? Because if you need to check out the copies first before being able to do the send to function, it will become very annoying if a certain source documents has been copied to various destinations. Moreover, the error message is very unclear, so it won't be very clear for end-users why this copy fails.

i have two programs , how to send parameters from one to another ?

Hello ,  i have two programs , how to send parameters from one to another ? Thanks in advance :)Kareem Naguib

Can i override the sqlexcption object into ajax OnError function?

Hi Dude, I am little stranger to web service. i do not know how can i implement your given functionality? i will show my webservice and web method. Please let me know how can i override the sqlexption error object to ajax error object? Please help me as soon as possible.. <WebMethod()> _       Public Function AddDetailPageData(ByVal strTableQuery As String, ByVal strFieldName As String, ByVal strFieldData As String, ByVal strWherCond As String)        Dim intRecCount As Integer = 0        Try            Dim param() As SqlParameter = New SqlParameter() _                                {New SqlParameter("@strtableQuery", SqlDbType.NVarChar, 50), _                                New SqlParameter("@strFieldList", SqlDbType.NVarChar, 4000), _                           

Using HttpWebRequest to send POST data with parameters and a file

I have a form that has the following<form action="http://site" enctype="multipart/form-data" method="post"> <input type="hidden" name="action" value="the action" /> <input type="hidden" name="apiKey" value="key here" /> <input type="hidden" name="name" value="racing" /> <input type="hidden" name="title" value="Race Cars" /> <input type="hidden" name="signature" value="sig here" /> <input type="file" name="file" /> <input type="submit" name="_upload" value="Upload" /> </form>I know its not .net controls.. but hat doesn't matter for now, what I need to do is post this form with all it's data, but entirely in code.I have found this post: http://www.developmentnow.com/g/36_2005_3_0_0_300351/Using-HttpWebRequest-to-send-POST-data.htm this describes how to do it but I am not getting it.I will have a file upload on my page and a textbox for name and title, but the rest are generated in code.I know it's a long shot, but can anyone give me an example of exactly how I would do it for  my scenario? I have been at it all day and I am struggling! I keep getting bad gateway errors when

Send multiple parameters SSIS execute process task



We are using Execute Process Task in SSIS package to execute a batch file to house keep the generated flat files which are older than a week from the archive folder.

The same batch file is used to delete the some temp files generated in the process.

As the Archive folder and temp folder paths are configurable, we are trying to pass the folder paths as parameters to batch file.

I used Expressions tab of Execute process Task Editor to map the variable to Arguments property. This is working fine. but I need to pass one more variable as an Argument.

Can some one help me how to achieve this. Thanks in advance.


Sreekanth ABS



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.

howto call callback function in c#



I need to call some c++ properity dll in my c# code and not sure how to implement a callback function call in c#

I saw the vb 6.0 code it was implemented like this

        NC_registerOnServiceAvailable m_link, AddressOf DllInterface.OnServiceAvailable

' typedef void ( __stdcall *tOnServiceAvailable )( const tTOResultEnum );
Public Sub OnServiceAvailable(ByVal result As Long)
End Sub

and not sure how to do equivalent in C#

I appreciate your suggestions,



Problem with WCF CallBack function



I have a problem with WCF CallBack function (DuplexChannel). The main problem is that when I invoke that method on the client I got a message format like that below:

<ClientCallBackFunc xmlns="http://tempuri.org/ ">

where ClientCallBackFunc is name of callback method.

I made service:

public interface IClientCallBack



    void ClientCallBackFunc(string IssueId, string AgreementId, string LimitId);




public interface IService


    string ServerMethod(string IssueId, string AgreementId, string LimitId);


but I should prefer to get like this:




So, when I want send message from server side (callba

AJAX HTML Editor insertHTML() function



I have editor and I want to add a HTML to it with a button from a toolbar. I have been searching through this forum and came up with this, but it does not work:

Here is the code on the .aspx page:

<script type="text/javascript">
        function addHTML() {
            var editor = $find("editor");
            var editPanel = editor.get_editPanel();
            var designPanel = editPanel.get_activePanel();

    <customEditors:MyHtmlEditor ID="editor" runat="server"></customEditors:MyHtmlEditor>

And this is a class for my custom editor:

Public Class MyHtmlEditor
        Inherits Editor

        Protected Overrides Sub FillTopToolbar()

            Dim newBtn As New AjaxControlToolkit.HTMLEditor.ToolbarButton.MethodButton
            newBtn.Attributes.Add("onmouseover", "addHTML();")

encoding function parameters and return values when binaryMessageEncoding is used


Dear All,

I'm creating simple web service that will accept some parameters (such as customer name and file name) and return content of an xml file as a string and WS client will save it on his side. I'm using custom binding with binaryMessageEncoding and httpTransport. The question is if it is possible to have these input parameters as well as returned xml content binary encoded somehow?

Thanks in advance for your help!


How to send parameter in query string on ajax call in asp.net mvc


I want to send selected page value on querystring while navigating through paging. URL that is generating on paging are like this

Link/Index?page=2  or Link/Index?page=3

but on my URL it only shows Link/Index and perform Ajax call but if i disable my Javascript and then navigate through paging it gets Postback and have URL like


which is perfect. But i want this type of URL in Ajax call as well how can i do this? Issue is if we navigate through pages when Javascript is enable it shows Link/Index and when user goes to page no 2 then 3 then 4 and press back button it goes to press page instead of page 3 then page 2. For reference if writing the code which generate paging

<%= Ajax.Pager(new AjaxOptions { UpdateTargetId = "divGrid", LoadingElementId = "divLoading" }, ViewData.Model.PageSize, ViewData.Model.PageNumber,
    ViewData.Model.TotalItemCount, new { controller = "LinkManagement", action = "Index" })%>

How to use ajax for recursive call of a function in asp classic


I have a asp page with parent and child relation  task when i click on + sign the task with the parent id of the first should open. it may go up to nth level


1 >2







so to go to 8 we have 1>2>5>7>8

so first i have to click on 1 which will open its child then i have to select 2 which opens its child.

If i am doing it on same page recursively it hits performance.

as it is a asp page and each time it is hiting the server so i have to use ajax and build the page out side and append this to my parent page 

can any one help me in this regards,


Please Mark the answers and give points it will help users Thanks & Regards, Kamal Agarwala

How to call a ajax recursive function


I have a asp page with parent and child relation  task when i click on + sign the task with the parent id of the first should open. it may go up to nth level


1 >2


commonShowModalDialog callback function?


I need to callback Javascript function in my code, but not firing. I am providing details what I am doing?.

1.I have input button in the page that calling javascript function. There I am loading another ProfilePic.aspx page. ProfilePic.aspx has FileUpload, OK and cancel button

<input type=button value="Change Image" onclick="javascript:SelectUserImage()" />

2.Javascript functions are

<script type="text/javascript"> 
function SelectUserImageCallback(ret) { 
  var imgId = 'ctl00_PlaceHolderMain_prof_imgUser'; 
  var clearId = 'ctl00_PlaceHolderMain_prof_hidImageURL';

Jquery GetJson,callback function can't be executed.


developing website with  vs2010, asp.net4.0 , mvc2 ,jquery version 1.4.2?I get the dropdownlist data by jquery.getJson in scripts,but the callback function can't be executed.  my code:


        function GetItems() {

            var url = "/CurePlan/GetItemList";
            $.getJSON(url, { type: $("#RType").val() }, function (json) {


                $.each(json, function (i, item) {

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