Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: Partial view method only triggered once on button click

Tags: adhoc

userdp:

I have a review form that generates a set of questions and set of answer options with the ability to generate a new Adhoc question when you click the adhoc button.

The adhoc is a partial view that appends to the main view right below it. When I click the button to generate the adhoc question, the adhoc partial view appears.

I am able to enter in my question and select a radio answer option. When I click the adhoc button again, the form appears, but when I try to select an answer for the second adhoc question, it removes the answer I selected for the first adhoc question!

I put a break point on PartialViewResults Adhoc() and I noticed that on the first adhoc button click, Adhoc() executes. The method executes and gives the partial view an id. On the second button click, the method does not execute. It appends to the main view with the same id as the first adhoc partial view.

I cant seem to figure out how to have the method execute on each button click. The link below contains the code/html.


$(function () {

$('.btnAdhoc').click(function (event) {
event.preventDefault();

$.ajax({
url: '/ProjectManagers/Forms/Adhoc',
//data: JSON.stringify(model),
type: 'get',
success: function (result) {
$('#adhoc').append(result);
}
});
});
});

UPDATE 1

Link below to my previous question before contains all the HTML/CODE

How to pass Model from View to Controller, add items to list, pass back to view

UPDATE 2

Rephrased my question, I hope this clears the confusion.

UPDATE 3

Seems to be an Internet Explorer related issue. It works in chrome, but I need this to work in IE.

UPDATE 3: FIXED

Fixed by adding cache: false in function script.



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: Partial view method only triggered once on button click

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×