HttpException A public action method was not found on controller
Hi all,
I have view to load Profile details, in controller i am taking currently logged in user and assign values to model and return view.
to hit this method on page load , I have call html.Action method in macro so i get profile details loaded in to forms.
Then user allow to edit profile details and post update which then call HttpPost action in Controller to update details.
after page load with Profile details if I edit details and click Update button my view not finding edit form action its looking for LoadProfile action from macro call.
public class ProfileController : SurfaceController
{
// GET: Profile
[HttpGet]
public ActionResult LoadProfile()
{
ProfileModel pmodel = new ProfileModel();
try
{
var m = Membership.GetUser();
if (m!=null)
{
myicMyService ms1 = new myicMyService();
string myaccountid = "";
string mycontactid = "";
string email = m.Email;
_myAccount acc = ms1.get_MyIcAccount(myaccountid, myICHelper.read_request_key()); //methods to get data
_myContact con = ms1.get_contact_byEmail(email, myICHelper.read_request_key()); //method to get contact details
pmodel.accountid = myaccountid;
pmodel.accountname = acc.name;
pmodel.address_city = acc.address1_city;
pmodel.address_county = acc.address1_county;
pmodel.address_line1 = acc.address1_line1;
pmodel.address_line2 = acc.address1_line2;
pmodel.postcode = acc.address1_postalcode;
pmodel.address_name = acc.address1_name;
pmodel.companyReg = acc.new_companynumber;
pmodel.telephone = acc.telephone1;
pmodel.fax = acc.fax;
pmodel.trade_name = acc.new_tradingname;
pmodel.trade_type = acc.new_tradetype;
pmodel.trade_typename = acc.new_tradetypename;
pmodel.contactid = mycontactid;
pmodel.DDI = con.telephone1;
pmodel.email = con.email;
pmodel.firstname = con.firstname;
pmodel.lastname = con.lastname;
pmodel.mobile = con.mobilephone;
pmodel.salutation = con.salutation;
pmodel.jobtitle = con.jobtitle;
pmodel.partner = acc.parentidname;
pmodel .accountstatus= acc.account_status;
}
}
catch (Exception ex)
{
}
return PartialView("Profile", pmodel);
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult EditProfile(ProfileModel pmodel)
{
try
{
var m = Membership.GetUser();
if (m != null)
{
string s = " c id : " + pmodel.contactid + " a name : " + pmodel.firstname + pmodel.lastname;
ViewBag.test = s;
}
}
catch (Exception ex)
{
}
//return CurrentUmbracoPage();
return PartialView("Profile", pmodel);
}
if I use return PartialView () option i get the view back but not under master layout
please advise how to manage this situation so that i can load details on page load and then post back on update button click .
HttpException A public action method was not found on controller
Hi all, I have view to load Profile details, in controller i am taking currently logged in user and assign values to model and return view. to hit this method on page load , I have call html.Action method in macro so i get profile details loaded in to forms.
Then user allow to edit profile details and post update which then call HttpPost action in Controller to update details.
after page load with Profile details if I edit details and click Update button my view not finding edit form action its looking for LoadProfile action from macro call.
if I use return PartialView () option i get the view back but not under master layout please advise how to manage this situation so that i can load details on page load and then post back on update button click .
is working on a reply...