Tracking Forums, Newsgroups, Maling Lists
Home Submit Tracker Forums
  Advanced Search


MVC :: Ajax.BeginForm Opening New Page?

I've got problem with Ajax.BeginForm in ASP.MVC 3. I want to search textbox for my database. So I've got this code in my Index view:

[Code].... Which calls this method in controller, which return detail partial view of patient

public ActionResult GetPatientByRC(string RC)
IPatientService svc = new PatientService(_PacientRepository);[code]....

after clicking on submit button, I'll get partial view open in new webpage (not in GetPatientByRC div). Does somebody know what is wrong?

View 1 Replies (Posted: Mar 19, 2011 06:41 PM)

Sponsored Links:

Related Forum Messages For ASP.NET category:
Force Unobstructive Syntax Without Html.BeginForm - Ajax.BeginForm In Partial View
When I put a part of my form in a partial view, all form parts get unobstructive syntax except the form elements in the partial view. The only way I found how to "apply" the unobstructive syntax, is by starting another form inside the partial view.

@using (Ajax.BeginForm("SubmitHandler", new DefaultAjaxOptions()))
@Html.EditorFor(m => m.Name)
@Html.Partial("MyPartialView", Model)


@Html.TextBoxFor(m => m.SomeContent)

<input class="text-box single-line" data-val="true" data-val-required="This field is required." id="Name" name="Name" type="text" value="">
<input id="SomeContent" name="SomeContent" type="text" value="0">

So only the input element from the View has the unobstructive syntax and the partial view hasn't... Is there a way to apply unobstructive syntax inside a partial view, wich doesn't require you to begin a new form?

Posted: Jan 27 at 10:53

View 2 Replies!   View Related
How To Prevent Ajax.BeginForm From Loading A New Page
I have an Ajax form with a single input and a button. On submit, the form should only post the entered value to an action method. My form is correctly posting to the User controller's Log method but when done, the page redirects to /User/Log.

How can I avoid this?


Posted: Feb 25 10 at 21:03

View 1 Replies!   View Related
MVC :: JQuery Validation Plugin In Ajax BeginForm On Page?
I am wondering how i can use JQuery validation plugin in Ajax Beginform for client side validation.

Here is my code:


Controller Method:


I am wondering how i can use JQuery validate plugin before the controller method is called. These are the validation rules.

Password field is required field. Minimum length is 6. I am not sure where to specify this


. Ex:


Posted: Feb 10, 2010 06:59 PM

View 3 Replies!   View Related
MVC :: Ajax.BeginForm Not Displaying PartialView Always Redirects To New Page?
I have a very simple app where a user enters 2 text values and presses a button, I want a confirmation message to be displayed on the same page however it keeps redirecting to show the partial view as a full view.

This is my home View:


This is my ContactController:


And finally this is my Confirmation PartialView


This is using MVC 3/.Net 4, I have downloaded an MVC 2/.Net3.5 sample project from the web that is doing exactly the same which works fine. What am I doing wrong?

Posted: Feb 09, 2011 08:30 AM

View 7 Replies!   View Related
AJAX :: Error Messages When Opening Page In IE
Im using ASP.NET 2008 C#, And Ajax control toolkit 3.0.302290.0 . I have a ajax control in my page when i open this page in IE its showing following Error message

ASP.NET Ajax client-side Framework failed to load
Type is undefined
'Sys' is undefined

The page is showing the following error, but the same program running perfectly in my friend system.

Posted: Jun 24, 2008 11:29 AM

View 8 Replies!   View Related
AJAX :: Opening A New Page Using ModalPopup Extender?
How to open a new page using ModalPopup extender

Posted: Jan 04, 2011 01:08 PM

View 3 Replies!   View Related
MVC :: Trying To Use Ajax.BeginForm() To POST?
I'm trying to use Ajax.BeginForm() to POST A Json result from my controller (I'm using MVC3). When the Json result is called it should be sent to a javascript function and extract the object using:




The strange thing is that the exactly same code works in MVC2 - Is this a bug, or have I forgot something?

Posted: Dec 27, 2010 02:03 PM

View 6 Replies!   View Related
MVC :: Ajax.BeginForm: OnFailure?
I'm usingAjax.Begin form with MVC validation.When I'm in the server code and there's a validation error then ModelState.IsValid isfalse and that's good.If I have OnSuccessdefined in my AjaxOptions why does my OnSuccess functionget called when the ModelState is not valid?In my parital view:

using (Ajax.BeginForm("ProfileEdit",
new { controller =
"Account", action =
"ProfileEdit", id =
}, new
AjaxOptions { UpdateTargetId
= "profileEdit", OnSuccess
= "OnSuccess" }))

In my controller I always just return PartialView();

I just want to display a success message in the view but OnSuccess gets called even if there is a modelstate error. If I try to throw a HttpException then I lose my ValidationSummary andother error messages.

To work around, I'm setting a ViewData["Success"] and displaying the message divin the .ascx if ViewData["Success"] != null.

Posted: Jul 09, 2010 04:26 PM

View 3 Replies!   View Related
MVC :: Set The Form Id On An Ajax.BeginForm?
how to set the form id on an Ajax.BeginForm, i currently have:


This produces the following html:


For some reason it appends the following ?Length=8 onto the action, i've tried moving the id around and removing the @ butthen the ID displays form01

I'm using MVC3

Posted: Mar 10, 2011 03:23 PM

View 4 Replies!   View Related
MVC :: Use The Ajax.BeginForm () - Looking For Ajax Reference In Code?
i was trying to use the Ajax.BeginForm() and instead of updating my targetId it wouldreturn a new page with just the data. The problem was i didn't have the ajax reference in my code. however,it took a while to figure thatout because itwouldflash the error too quicklyin firebug for me to see. is there another way to get this error to show up?

Posted: Oct 07, 2009 07:29 PM

View 2 Replies!   View Related
File Upload Using Ajax.beginform ?
is there a way i can file upload using ajax.beginform as i am using jquery dialog and can't use html.beginform

Basically i am implmenting a sort of wizard for initializing website on jquery dialog which need to have ajax there

Posted: Jul 14 10 at 10:23

View 1 Replies!   View Related
MVC :: Ajax.BeginForm And Remote Validators. MVC 3 RC2?
I have RemoteValidators working correctly on Html.BeginForm. However when I turn this from in Ajax.BeginForm and perform following:1. Type in Textbox whose viewModel Property is bound to a Remote Validator RC2 MVC3
2. Press Submit Button immediately.3. What I observe = data is saved before it the validation completes.
4. On Server UpdateModel works and it finds no issues (even though the remote Validator would have noticed the problem).

Posted: Jan 06, 2011 09:57 PM

View 1 Replies!   View Related
MVC :: Ajax.BeginForm And TempData / ViewData?
I've noticed that when I change from Html.BeginForm to Ajax.Begin form, I don't have access to TempData or ViewData. I'd like to show a message such as "You created x records" or similar after POSTing.

I realize I can use the AjaxOptions.OnSuccess to maybe hit the server again, but is there a way to do this with one request?

Posted: Jul 24, 2009 01:15 PM

View 8 Replies!   View Related
MVC :: Ajax.BeginForm() Posting Back Only Once?

I have the above code, on the get method I do the following.


It only hits the index once after loading the page. It never goes to the index method.

Posted: Dec 23, 2010 09:00 AM

View 2 Replies!   View Related
MVC :: Ajax.beginform Inside A For Loop?
so I am using a foreach loop to iterate through comments. The comment section is wrapped inside "Comments" div. My function **DeleteComment** fetches comments again once you delete a comment and rebinds it to the control. However, after you delete a comment, anytime you try to delete another comment, the commentId of the very first deleted comment would keep getting passed to **DeleteComment** function instead of the passing the commentId of the comment you are trying to delete. If you refresh the page, then you can delete ONE comment again, and the same problem if you try to delete another.

Posted: Oct 02, 2010 11:43 AM

View 1 Replies!   View Related
MVC :: File Upload Using AJAX.BeginForm?
I am new to ASP.NET 3.5 MVC, I want to upload file using AJAX form. When I am using html form then I am able to upload files but my requirement is that I am using user control for edit profile, I am using tabs for the same where in we are having multiple tabs for edit profile, change password, etc.

While using AJAX form having enctype = "multipart/form-data" then following statement did not get the files
foreach (string filename in Request.Files)

Posted: Jul 24, 2009 07:49 AM

View 7 Replies!   View Related
MVC :: AJAX.BeginForm And Html.ValidationSummary?
I am trying to make an AJAX Form work correctly with Client Validation, but I can't seem to figure out how to make it work together.Currently I have a view like this:


My model:


The client validation works on the Required and Stringlength attributes, but if I put an incorrectly formatted email, it still returns successful. Is there a special way to do the regular expression attribute? Or am I doing it wrong?

Posted: Mar 22, 2010 08:39 PM

View 8 Replies!   View Related
MVC :: Ajax.BeginForm Not Reaching Action?
Using the following Ajax.BeginForm, it`s not reaching the controller. What is wrong with the following code? The $('#editForm').submit(); is reached but after that, it doesn`t reach the action.


Posted: May 20, 2010 09:15 AM

View 4 Replies!   View Related
MVC :: Ajax.BeginForm With Multiple Buttons?
can i have more than one AjaxOptions in Ajax.BeginForm targetting different controls?Actually I want to exchange data between two listboxes placed in a single ajax.beginform.

Posted: Aug 25, 2010 09:50 AM

View 1 Replies!   View Related
MVC :: Ajax.BeginForm Keeps Looking For An .aspx File?
I'm using VS2008 and .net 3.5. I want to invoke a javaxcript hide() when user clicks the Search button and before running the action code. Previously I didn't need to run the javascript yet I use the (Html.BeginForm.

After I modified the code to use the Ajax.BeginForm I get the Error below. "SearchSurveyResults" is my action's name and "SurveyResults" (The file name is SurveyResultsController.cs )is the controller name that contains the action. The Javascript that I want to run when user clicks the Search button is hide().

What am I doing wrong here? Why is it looking for a /SurveyResults.aspx file? SurveyResults is the name of my controller where the form submit should send ti one of its action.

<% using (Html.BeginForm("SearchSurveyResults", "SurveyResults", FormMethod.Get, new Dictionary<string, object>() {{@"class", "communitysearch"}}))
{ %>
<legend>Search by Keyword</legend>


Server Error in '/' Application.

The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. review the following URL and make sure that it is spelled correctly.

Requested URL: /SurveyResults.aspx

Version Information:Microsoft .NET Framework Version:2.0.50727.3082; ASP.NET Version:2.0.50727.3082

Posted: Feb 19, 2010 01:58 AM

View 3 Replies!   View Related
MVC :: IE7 And Ajax.Beginform Which Not Retrieve Data?
I have an issue on IE7 (not in IE8) when i want to retrieve Data of the Ajax form (request.form["myDataName"]) it is always at "", with others browser the request.form is populated.


Posted: Dec 01, 2009 11:23 AM

View 5 Replies!   View Related
Ajax.BeginForm Switches From Async To Sync?
I'm running into an issue with an async call to the server that only works one time, then it appears to become a synchronous call. Let me try to explain.

It's an MVC 2.0 site, using ASP.NET and Ajax. I'm using the Ajax.BeginForm helper, like so:

<% using (Ajax.BeginForm("Start", null,
new { virtualMachineId = xyz },
new AjaxOptions { UpdateTargetId = "VirtualMachineForm", OnBegin="OnStartingVm" }


Within the updateStartingStatus function, the first part runs every second, every time. However, within the Ajax call, the success result works every second on the first time only. Then on the second time I click on the start button all of the requests queue up. After the starting has completed, about 20 seconds later, I get a bunch of alert windows back to back. So, I can tell that updateStartingStatus runs every second every time, but the ajax call appears to switch to become a sync call after the first time.

I have to fully close it and open it again. The same occurs in IE and Chrome.

One more thing to note is that the updated div (VirtualMachineForm) contains most of the page, including the button being pressed. So it basically replaces the page from under itself. Not sure if that would cause any issues.

Additionally, if I debug in Visual Studio 2010, the call isn't made to the controller action when the issue occurs. So, it appears to be something client-side. I've ruled out any issues server-side.

Posted: Dec 9 10 at 6:56

View 2 Replies!   View Related
MVC :: EnableClientSideValidation In A PartialView (jQuery Tab) With A Ajax.BeginForm?
I got a problem with client side validation not firing, after reading many posts I believe it as to do with the HTML being loaded "afterwards". But I can not seem to find any solution.You got any ideas how to solve it?




Posted: Oct 14, 2010 09:59 AM

View 1 Replies!   View Related
MVC :: Displaying Actual Exception In AJAX.BeginForm
I have a situation where I need to display an actual error/exception that happened during processing after the OnFailure event of the AjaxOptions class fires. Is this possible? I know the OnFailure allows me to write a method that can display a custom error message. Instead of this error message, I'd like to display the actual exception.

Here is my code for the ajax form init.:


And then here is my Javascript method:


As you can see, I am currently displaying an errorMessageDiv which has the code:


I would love it though if I could show them the actual Exception message (which i have wrapped) so I can tell them the exact cause of error.

Posted: Apr 19, 2010 06:33 PM

View 3 Replies!   View Related
Call Ajax.BeginForm From A Custom Helper Method ?
Can I call Ajax.BeginFrom from a custom helper method ?

AjaxHelper is not available in a custom helper method, so I tried to pass the "Ajax" available in ViewPage to Helper method while calling it, but then in method, BeginForm is not available on that passed "Ajax" parameter.

Posted: Mar 20 at 8:42

View 1 Replies!   View Related
MVC :: Client Side Validations With Ajax.BeginForm Not Working?
I have a webform in which i am using Ajax.BeginForm.

But due to this my client side required fields are not working.

Posted: Sep 28, 2010 10:05 AM

View 1 Replies!   View Related
Jquery - Use Ajax.BeginForm OnSuccess And OnFailure MEthods?
I using this Ajax.BeginForm

<% using( Ajax.BeginForm( "Create","Mandate",
new AjaxOptions( ) {
OnSuccess = "GoToMandates",


Posted: Apr 1 at 19:14

View 1 Replies!   View Related
MVC :: Handling Form Controls After Ajax.BeginForm Submission?
Currently I have a comments section integrated into a blog I am writing. The comments are Ajaxified, when you post a comment the comment list auto updates with the comment you just added.Everything is working great but I would like to do some cleanup after a comment is successfully posted. Specifically I would like to disable the textarea and submit button which I would have no issues doing through javascript by using the AjaxOption OnComplete parameter. To avoid double posts or just plain abuse. I know I will need other safegaurds as well but this is my first step. The thing is Ajax.BeginForm does not give the form an id or name so I can not reference the form in javascript. Is there a workaround here? Can I disable these form controls from the controller?

Here is my code.


Posted: Oct 12, 2010 05:21 AM

View 2 Replies!   View Related
MVC - Multiple Html.SubmitImage Buttons For One Form That Uses Ajax.BeginForm
ASP.NET MVC - Multiple Buttons on a Form this is what I am trying to do too, except the first answer doesn't satisfy my requirements and the second one uses formcollection. I am not passing formcollection. I am passing values to the ActionResult method, because in my scenario, it doesn't make much sense to use formcollection, because user is hardly filling out any data. I really prefer using SubmitImage at the moment, so I would prefer if your solution doesn't involve me switching to css or input type etc. EDIT: I'm using Ajax.BeginForm and that seems to be the problem rather than Html.SubmitImage

Posted: Nov 6 10 at 9:29

View 1 Replies!   View Related
MVC :: Ajax.BeginForm Does Not Update/show The Result In Partial View?
I have a view.On which i havetwo partial viewMy m ain is like this ->.(Note i am using
Ajax.BeginForm here.)


butmy issue is this that i have a button in SearchRequestCriteria partial view on which a function from my controller is called.And the result is bind into theSearchRequestResultspartial view.but from when i am using Ajax,BeginForm is does not bind the result to thisSearchRequestResultsPartial view.I have debug theprogram & found that the result is came into the SearchRequestModel & but it does shows in the
SearchRequestResultspartial view.i want the result in this by using Ajax.

Posted: Sep 24, 2010 05:32 AM

View 1 Replies!   View Related
MVC :: Ajax.BeginForm Doesn't Work Properly With AjaxOptions.OnSuccess?
I want to use Ajax.BeginForm instead of Html.BeginForm.

I can use it with out OnSuccess option. When I include it, i doesn't save and give validaiton messages.

Posted: Sep 27, 2010 02:51 PM

View 2 Replies!   View Related
MVC :: Using Thickbox For Modal Window And Ajax.BeginForm, Problem After Posting?
I am using Thickbox along with Jquery to create model windows that contain ajax forms. I can successfully get this to work, i can validate my form and i can post the data. My problem is that after I have successfully posted the data I need to redirect the user to a different page where they can then continue to add additional information. However when I use redirecttoroute or redirecttoview all that happens is the contents of the route that i have redirected to is then loaded into my modal window. This must be something simple but I am stuck,

Posted: Mar 03, 2010 02:03 PM

View 1 Replies!   View Related
MVC :: How To Validate HTML Input Fields Using JQuery Inside Ajax.BeginForm?
How to validate HTML input fields using jQuery inside Ajax.BeginForm?


Posted: Jan 24, 2010 09:20 PM

View 1 Replies!   View Related
MVC :: Ajax.beginform Using Multiple Submit Doesn't Work From Firefox / Opera / Chrome
this code does not work in any other browser other than Internet Explorer, I could tell that happens, I've seen that in MVC2 was a known bug, I thought I updated to MVC 3 this was corrected, but still the same.The problem itself is that it shows as null ActionResult and I have no idea how to detect, the code I use is:

<% using (Ajax.BeginForm("CmdApply", new AjaxOptions { HttpMethod = "Post", UpdateTargetId = "RenderPartialId", Confirm = "Seguro de continuar", OnComplete = "showCurrentPage", OnBegin = "ShowBeginSearch", OnSuccess = "CloseDialogSearch" }))
<input id="GoPageSubmit" type="submit" name="GoPageSubmit" value="<%=Resources.s2olMVC.Search_GoPageTitle %>" />
<input id="SubmitNext" type="submit" name="SubmitNext" value=">"/>
<input id="SubmitNextLast" type="submit" name="SubmitNextLast" value=">>" />

In ActionResult, the two n submit it recognizes, as if none, shown in Null There is another way to implement this type of submit? In Internet Explorer everything works fine.

Posted: Nov 11, 2010 05:32 PM

View 4 Replies!   View Related
Web Forms :: Opening Page In New Window From A Master Page's Child Page?
I have amaster page in my website.Ithas a child page which contains a treeview controlonit. Every node of the treeview redirects to a new page (Not a master page's child page) Now I just wantthat when auser selects a node, therequestedpageshouldopen in new window.Remaining child pages would be shown in the same window.

Posted: Nov 11, 2009 02:14 PM

View 5 Replies!   View Related
AJAX :: .net MVC Ajax.BeginForm Not Working In Firefox But Working In Chrome And IE
I have a problem with partial postback in FireFox in my index.aspx I have following code:


Finally my Partialview has following content:


This code is working fine when using IE or Google Chrome, but when using FireFox the code in my controller is never reached. I just can't figure out what I am missing

Posted: Feb 11, 2011 06:44 AM

View 1 Replies!   View Related
MVC :: Ajax.BeginForm Not Working In Firefox But Is Working In Chrome And IE
I have a problem with partial postback in FireFox

in my index.aspx I have following code:


Finally my Partialview has following content:


This code is working fine when using IE or Google Chrome, but when using FireFox the code in my controller is never reached.

Posted: Feb 09, 2011 08:59 AM

View 1 Replies!   View Related
Web Forms :: Opening A Page Inside Another Page?
i want to open an existing page insid my other page inside can i do this ? i thought with Panel? but don't se any connection there...

Posted: Jan 11, 2011 01:57 PM

View 3 Replies!   View Related
AJAX :: Opening ModalPopupExtender In JavaScript?
I want to open a modal popup in javascript - so is there something like this:-


I thought that should work but it returns a null is null or not an object error.

I know that I should use targetcontrolID on the extender in this case, but there is some other javascript logic going on.

Posted: Feb 15, 2007 06:30 PM

View 14 Replies!   View Related
Copyright 2005-08, All rights reserved