---
title: "Radio Button Redirect"  
description: "Radio Button Redirect"  
author: "mathieu cupryk"  
published: 2014-03-31  
updated: 2014-04-03  
canonical: https://www.mindstick.com/forum/2005/radio-button-redirect  
category: "asp.net mvc"  
tags: ["asp.net mvc"]  
reading_time: 3 minutes  

---

# Radio Button Redirect

How can I [fix](https://yourviews.mindstick.com/view/80763/donald-trump-ki-jeet-fix-hai) the above so that :

if the [user](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) selects jobseeker [redirect](https://www.mindstick.com/interview/23316/how-to-redirect-from-one-page-to-another-page-without-url-change) them to \
JobSeeker/jsRegistration.cshtml otherwise go to\
Employer/empRegistration.cshtml

```
<div class="wrap">   <div class="content">        @Html.AntiForgeryToken()       <div class="box_title_h1">Are you a Job Seeker or an Employer?</div>       <form action="~/Registration/Registration" method="post">           <div class="inner-content" style="border:none">               <span><input type="radio" onclick="selecttype('jobseeker');" name="account" id="jobseeker" value="0"> I am a Job Seeker seeking WORK </span>               <span> <input type="radio" onclick="selecttype('employee');" name="account" id="employee" value="1"> I am a Company seeking to HIRE </span>               <input id="regtype" type="hidden" name="regtype" value="0" />               <span style="float:right">                   <input type="submit" class="home_buttonNext" value="Next Step">               </span>               <span style="clear:both"></span>           </div>       </form>   </div></div><script>   function selecttype(type) {       if (type == 'jobseeker') {            $('#regtype').val('0');       }       else {            $('#regtype').val('1');       }   }</script>
```

## Replies

### Reply by Anonymous User

Nice Answer.

### Reply by mathieu cupryk

Fantastic I appreciate the help.\
I am getting into this mvc.\

### Reply by Chris Anderson

Yes you need to add two controller in Controller folder:\

JobSeekerController.cs\
EmployerController.cs

\

In order to handle post requets you need to create action for post as given below:\

```
public class JobSeekerController : Controller{    public ActionResult jsRegistration()    {        return View();    }       [HttpPost]    public ActionResult jsRegistration(FormCollection form)    {        return View();    }}public class EmployerController : Controller{    public ActionResult empRegistration()    {        return View();    }       [HttpPost]    public ActionResult empRegistration(FormCollection form)    {        return View();    }}
```

\
To hadle it from the view, modify the view code as given below:\

```
@using (Html.BeginForm()) {           <div class="inner-content" style="border:none"><span><input type="radio" name="account" id="jobseeker" value="0"> I am a Job Seeker seeking WORK </span><span> <input type="radio" name="account" id="employer" value="1"> I am a Company seeking to HIRE </span><input id="regtype" type="hidden" name="regtype" value="0" /><span style="float:right"><input type="submit" class="home_buttonNext" value="Next Step"></span><span style="clear:both"></span></div> }
```

\
Thanks.

### Reply by mathieu cupryk

```
<form action="~/Registration/Registration" method="post">
            <div class="inner-content" style="border:none">
                <span><input type="radio" name="account" id="jobseeker" value="0"> I am a Job Seeker seeking WORK </span>
                <span> <input type="radio" name="account" id="employer" value="1"> I am a Company seeking to HIRE </span>
                <input id="regtype" type="hidden" name="regtype" value="0" />
                <span style="float:right">
                    <input type="submit" class="home_buttonNext" value="Next Step">
                </span>
                <span style="clear:both"></span>
            </div>
        </form>
```

I am not sure how to handle the form action?

What should I have?

### Reply by mathieu cupryk

I also wanted to mention your article was really done nicely.

### Reply by mathieu cupryk

This looks great and makes sense.

Should I create a controller these two controlers

JobSeekerController.cs

EmployerController .cs

?

### Reply by Chris Anderson

In order to acheive this:\
\
**create Controllers:**\
\

```
public class JobSeekerController : Controller{    public ActionResult jsRegistration()    {        return View();    }}public class EmployerController : Controller{    public ActionResult empRegistration()    {        return View();    }}
```

\
then modify your client script code as given below:\
\

```
function selecttype(type) {       if (type == 'jobseeker') {            $('#regtype').val('0');            window.location = "/JobSeeker/jsRegistration"              }       else {            $('#regtype').val('1');           window.location = "/Employer/empRegistration"         }   }
```

\
Hope this works for you.\


---

Original Source: https://www.mindstick.com/forum/2005/radio-button-redirect

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
