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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

MVC Controller .ajax post wired issue.. - Don't know how to solve - Please help

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :ASP.Net

I am using .ajax Post to submit (not form). I will post code but Here is the scenario:

On a I have a telerik mvc grid which has drop down and a few buttons, plus other grid etc. When press button with Id = "Submit" I am invoking .js function call. In this function, I first loop thro downdown list value and build array of (name/value pair). Than I invoke .ajax which will call Controller action.

In controller action I check following:

- if drop down value is desired value or not.. if not I return Json and display message in pop up and remain on same page.

- If all dropdown value are valid, I make web service call .. if web service response says "action I performed is unsuccessful, I return Json and display message on pop up. On pop up "OK" I navigate to "Home" 

- If web service response says record is valid and action I performed is successful, I need to navigate to "Home". I am not able to achieve that.

Here is sample for .js file:


$(function () {
    $('#btnSubmit').click(function () {


        var grid = $('#TreeGrid').data('tGrid');
        var indexOfIdColumn = GetGridColumnIndexByName(grid, "EntityId");

        var results = new Array();

        $("#TreeGrid tbody > tr, #TreeGrid .t-grid-content tbody > tr").e

View Complete Post

More Related Resource Links

how i can solve this issue in sql server



when i open my sql database in webmatrix then i got this error.  i already install sql server 2008 r2 and he work fine everywhere in my system.

how i can solve this issue.

How to solve concurrent site issue


Hi All,

I have developed a ASP.NET2.0 web site with SQL 2000 backend and number users to site is approx. 5-10.

I have developed one Administration page which controls user roles to access this site; onclick of Update button in admin page the role gets updated into the system. I have written simple query in the code to update the user roles into database; Ajax implemented in admin page;

Issue: If 2-3 users tries to update the admin roles; latest update reflected in the database and same displayed in the admin page;

I am looking for a solution to solve this problem by application code change since i dont have flexible to change the database end; if one users update the system, it should not allow other users to perform any operation; please let me know if any standard approach can be implemented with minor code change.

Thanks in Advance,

Saravana Prakash P.

$.ajax post from asp.net page and __viewstate causing call to fail



Now I know that I won't be sending viewstate and eventvalidation in my ajax calls and that I will only want to send the actual form fields for efficiency purposes but I will need to know the answer to this question, to inform the more junior members of the team and my manager, so if anyone has any answers they are most welcome.

I have a simple form as follows

<form id="form1" runat="server"> 
<p>Field1: <

Issue with new controller method added

I have created an ASP.NET MVC 2 web application that runs beautifull, not a massively complex application, only 2 controllers (Home and Treatment). I have an XML data store that holds page data to be displayed for each of a set of treatments.All pages display exactly as I want them to.I have now added a new controller method for the Treatment controller with the associated XML data and it displays fine in my development environment (displays exactly as I would expect).When I deploy the new XML data and the new TreatmentController.cs file to the new site the link becomes available, but when navigated to I get a 404 page not found exception. All existing links work absolutely fine as they should.The code below shows a working controller method and the controller method that gives the 404 exception, which is pretty much identical, apart from the method and parameter names.public ActionResult Gift_Vouchers(){    GetMasterData(ViewData);    GetTreatmentData("Gift_Vouchers");    return View("Treatment");}//The above method workspublic ActionResult First_Aid_Training(){    GetMasterData(ViewData);     GetTreatmentData("First_Aid_Training");     return View("Treatment");}//The above works in dev environment, fails in liveI would assume that this is something

AJAX Form POST Request to a DLL Problem

I am using AJAX javascript for POSTING a complete HTML form to the server which is an external dll on a different server and displaying the response. The server-response is displayed in a "div" . basically i need to show a poll in a .aspx page which is basic a question with 3 options & a button. Now on click of submit button i need to post the data to a dll & show the result from the dll itself. Any idea how to do this? is it possible..any code???

Ajax issue: delay in getting data from web service using innerHTML, please guide

I am working on an ajax application which will display about a million records in an html table. Web service returns records from server, I build a logn string by concatinating data and tags and than put this string using innerHTML (not using DOM for getting better performance). For testing I have put 6000 recods in database (stored procedure takes about 4 seconds in completion of its execution). While testing on local system (database and application on same machine) it took about 5 minutes to display the records in page. After deplying on web server it did not responde even for more time. It looks very low performance. I put records in a CSV file and its weight was less than 2 MB. I couldn't understand why string concatinations to build html table and putting string in innerHTML is taking such a huge time (if it is the issue). Requiment is to show about million records in web page but performance on just 6000 records is disappointing. I am not gettign what to do to increase performance. Kindly guide me and help me.  

wired issue while modifing Report Desgn tab?

Hi Experts, When ever I modified anything on my rdl file through BIDS 2008, (SSRS 2008), any dam thing (like "rearrange the position of any report item" or "changing any report item property", etc) it is adding below code into the rdl (xml) file , which results into the below error message:- <ConnectionProperties> <ConnectString /> <IntegratedSecurity>true</IntegratedSecurity> </ConnectionProperties> Error Message:- An error occurred during local report processing. The definition of the report'/rdl_file_name' is invalid. The report definitio is not valid. Details: The report definition element 'ConnectionProperties' is empty at line 8, position 9. It is missing a mandatory child element of type 'DataProvider'. How to get rid of this wired issue? Any Help? Thanks Regards, Kumar

Loading graphics without Ajax on submit and before Post Back

Hi, In order to maintain the view state information, I have decided not to use update panel for the loading image. Instead is there a way where I can simply make an image invisible, and display the image on click of the search button and hide it when the page post back again ?    Please advise.  

AJAX Upgrade Issue


We have a DNN site and we use the AJAX Toolkit.  We upgraded from AJAX 30930 to 40412.  We changed the script manager to a ToolkitScriptManager.  I have a image button that posts back and calls a modal popup.show() method.  When I click the button I get a javscript error before the post back:

Error: Sys.WebForms.PageRequestManagerServerErrorException: This version of MicrosoftAJAX does not offer the ScriptManager.RegisterClientScriptBlock method.

Any suggestions would be helpful.  I will obviously provide more detail if needed.

ASP.NET AJAX Post back happening in IE7 but works good in Firefox


Hi all,

I am debugging one of the project which is implemented using .Net Framework 3.5.

in the home page the project has 5 widgets.

In one of the widget contains a two radio buttons and a save button.When ever the user tries to change the Radiobutton option and Save the results will be displayed properly in Firefox.

But in Internet Explorer 7 the page gets a post back and all the widgets will be reloaded and finally the default radio button will be selected as default instead of the option which i selected.

Can any one help me to resolve this issue.

thanks in advance

Ajax timer issue



              I have an timer outside of UpdatePanel that refreshes every 30 seconds. In the timer's OnTick function, I check the status of some operation from database. If the operation is complete i disable the timer otherwise I enable it. I call timer.Enabled = true. will this cause problem, until the process is complete I keep setting timer.Enabled = true. What happens is that after few hours when multiple users do the same operation the database connection goes down and I cant connect to database at all. the database connection and recordset are closed everytime I checked it.. Any clues on this issue??





Ajax Post Form


Ok I have an interesting new assignment that I am trying to come up with the best solution for. Basically I have a web application that needs to provide access to another system from within a secured login, each application is at a different site. Basically the third party company that has the system I need to connect with wants me to access their site via a form post. This would typically not be a problem other than I need to have the option to connect from inside of pretty much every existing page withn the primary application. Each connection option will be some type of hyperlink that will then in turn target a new browser window to display the content from the third party. So obviously I cannot use the standard form post methods as the page form is already in use.

So my thought was to use Jquery Ajax Post, I use it all the time for typical Ajax functionality with other applications, but that is normally interaction with a webservice or webmethod. What I was thinking, is to create a post function to send all the required fields along to the third party company, without the need to actually create the form. Typically in the past when I have used this functionality I am returning some type of data that I just redisplay or interact with, but now I need to target a new browser and open the returned page. The third part

Asp.net Cross Page Post Back issue


Dear All,

I have two web pages, say SourceWebPage and TargetWebPage, on the TargetWebpage I have a directive like:
&lt;%@ PreviousPageType VirtualPath = "~/SourceWebPage.aspx" %&gt;

These are the code behand on TargetWebPage Page_Load Event:

if (!Page.IsPostBack)
                if (Page.PreviousPage != null &amp;&amp; Page.PreviousPage.IsCrossPagePostBack)
                    DateTime reportDate = PreviousPage.DTReportDate;
                    string serialNo = PreviousPage.SerialNo;

AJAX Control Toolkit - Rating Issue



I have implented the AJAX Control Toolkit and added the Rating Control to my page. It displays exactly as it should and even performs postback correctly, however it refuses to do anything on mouseover. The stars just continue to display whatever I set as the 'Current Rating'.

Here is the code I'm using; I believe I've correctly stripped out anything that's irrelevant:

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>


<style type="text/css"> /* Rating */ .ratingStar { font-size: 0pt; width: 13px; height: 12px; margin: 0px; padding: 0px; cursor: pointer; display: block; background-repeat: no-repeat; } .filledRatingStar { background-image: url(Images/FilledStar.png); } .emptyRatingStar { background-image: url(Images/EmptyStar.png); } .savedRatingStar { background-image: url(Images/SavedStar.png); } </style>
<form id="form1" runat="server&q

Unable to get to the webservice using ajax POST jQuery



I need to pass a customer id to get some data back for a customer from a webservice. I can't figure out how to get to the webservice, I have a breakpoint set in the webmethod but it's not being hit and the alert box is not popping up either.  For a test I am just trying to show some value from the returned data in an alert box.  Note I am just hard coding the customer id of 1001. The webmethod takes a parameter of string customerid.

//Webmethod code:

        public customer fetchcustomer(string customerid)
            customerDL custDL = new customerDL();
            return custDL.getData(customerid);



//jQuery code:
   $(document).ready(function() {

            type: "POST",
            contentType: "application/json; charset=utf-8",

how to add multiple ajax ratings issue...


I am using visual studio 2008 C# 2.0. I have an issue adding multiple ratings...What i have of code so far is:


im adding this to datalist:

  <cc1:Rating ID="LikeRating" runat="server"
                    style="float: left;">
    </cc1:Rating><br />



 protected void r_Changed(object sender, AjaxControlToolkit.RatingEventArgs e)

        Rating r = (Rating)sender;
        string id = r.ClientID;

        string s = e.Value;


and this is some of the xml file:


<entry... (some other attributes comes here)... ... ratingid="Guestbook_ctl00_r" ratingclicks="3" ratingresult="9">some text comes here..</entry>

so now the problem is how can i control ever

Integration issue with ajax toolkit


My application sets the css styesheet via code.  The <link> statement below is how it is set.

On my main form, I had to add the runat=server tag on the <head> in order to get my Editor control to work.  When I add runat=server, the stylesheet no longer gets set.  When I look at the source, the "<%" is changed to "&lt;%" (second line below).  I assume this is why my stylesheet is not being set.  How do I repair this?

<link href="<%= _stylesheet %>" type="text/css" rel="stylesheet" />

<link href="&lt;%= _stylesheet %>" type="text/css" rel="stylesheet" />


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