javascript - Is it possible to update a Partial view / with AJAX helper Method when Java Script is disabled -



javascript - Is it possible to update a Partial view / <div> with AJAX helper Method when Java Script is disabled -

i know similar question posted , ansered: how gracefully handle ajax partialview update when javascript disabled

but solution isnt satisfying me.

is possible, update element ajax helper method when java script disabled, show partial view in same page , not in tab?

i want tag in index view updated partial view (_details), when click on ajax actionlink. pview 1 method, same result js enabled , disabled. dont linke pview 1 solution (as suggested in similar question), because makes partial view class useless. why need when reload hole page anyway. prefer solution similar pview 2. there partial view opened in new tab when js disabled.

my simplified code far:

homecontroller class

public class homecontroller : controller { public actionresult index() { var obj_str = new simplestring { astr = "nothing yet" }; homecoming view(obj_str); } public actionresult pview1() { string str_posted = "string of pview 1"; var obj_str = new simplestring {astr = str_posted}; if (request.isajaxrequest()) { homecoming partialview("_details", obj_str); }else { homecoming view("index", obj_str); } } public partialviewresult pview2() { var obj_str = new simplestring {astr = "string of pview 2"}; homecoming partialview("_details", obj_str); } }

index.cshtml

<h2>ajax actionlink index</h2> @ajax.actionlink("click me pview 1", "pview1", new ajaxoptions { updatetargetid = "partv", insertionmode = insertionmode.replace, httpmethod = "get" }) @ajax.actionlink("click me pview 2", "pview2", "home", new ajaxoptions { updatetargetid = "partv", insertionmode = insertionmode.replace, httpmethod = "get" }) <h3>partial view here!</h3> <div id="partv"> <p>@model.astr</p> </div>

_details.cshtml (the partial view)

@model mvcpartialviewtest.models.simplestring <p>this partial view cshtml</p> <p>@model.astr</p>

simplestring class (the model)

public class simplestring { public string astr { get; set; } }

javascript asp.net-mvc asp.net-mvc-4 asp.net-ajax

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -