Click here to Skip to main content
15,886,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How i apply width to razor control @Html.RadioButtonFor in mvc4?

UserModel.cs
C#
public string Emp_Gender{get; set;}

index.cshtml
@model MvcApplication.Model.UserModel

@using (Html.BeingForm())
{
@Html.RadioButtonFor(m=>m.Emp_Gender,"Male")Male
@Html.RadioButtonFor(m=>m.Emp_Gender,"Female")Female
}
Posted
Updated 3-Jun-15 23:03pm
v2

1 solution

C#
@using (Html.BeingForm())
{
@Html.RadioButtonFor(m=>m.Emp_Gender,"Male",new { @class = "cssclass" })Male
@Html.RadioButtonFor(m=>m.Emp_Gender,"Female",new { @class = "cssclass" })Female
}
 
Share this answer
 
Comments
Karmesh_Madhavi 4-Jun-15 5:10am    
It's work thanks KF...
King Fisher 4-Jun-15 5:10am    
ohh, welcome :)
Karmesh_Madhavi 4-Jun-15 5:17am    
And can we apply style separately.?Like...........
@Html.RadioButtonFor(m=>m.Emp_Gender,"Male", new { @style = "width:100px"})Male
King Fisher 4-Jun-15 5:23am    
like below:
@Html.RadioButtonFor(m=>m.Emp_Gender,"Male", new { style = "width:100px"})Male

and search for html helpers in google, eg:
Apply css for html helpers, apply styles for html helpers,etc.

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