Click here to Skip to main content
15,905,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

How to postback to a method, by retaning all the values entered in the present page with Image button.

Thanks,

Kaurn Kumar

Please find below is the code I have.

//This is the Controller method
public ActionResult owners_Registration_step2_33()
{
return View();
}

[HttpPost]
public ActionResult owners_Registration_step2_33(FormCollection collection)
{
string FirstName = collection["FirstName"];
return RedirectToAction("owners_Registration");


}

In the view I had a inputbutton and a image button like the below.
<input id="Submit1" type="submit" value=""/>
XML
<a href="@Url.Action("owners_Registration_")"  class="btnRegisterNow" title="Register Now">
                   &nbsp;</a>


From the above code I am able to postback to the method owners_Registration which declaerd as [HttpPost] and able to access the values from collection object. But it is not happening with the href.
Posted
Updated 5-Dec-11 22:11pm
v2
Comments
[no name] 6-Dec-11 2:30am    
Your question isn't clear.
Member 8371764 6-Dec-11 2:49am    
give all the methods inside the
if(!ispostback)
{
//methods
}
Member 3975858 6-Dec-11 4:07am    
//This is the Controller method
public ActionResult owners_Registration()
{
return View();
}

[HttpPost]
public ActionResult owners_Registration(FormCollection collection)
{
String FirstName= collection["FirstName"];

return RedirectToAction("owners_Registration_step3_33");
}

In the view I had a inputbutton and a image button like the below.

<input id="Submit1" type="submit" value=""/>
 

From the above code I am able to postback to the method owners_Registration which declaerd as [HttpPost] and able to access the values from collection object.
But it is not happening with the href.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900