The Resource cannot be found . ASP.NET MVC - c#

The resource cannot be found.
Requested URL: /Home/Home/Signup_User
However it should be /Home/Signup_User
where Home is the controller and Signup_User is the function in Home Controller.I have checked the spelling its correct.
My Sign Up Form as follows.
<form action="~/Home/Signup_User" method="post" enctype="multipart/form-data">
#Html.AntiForgeryToken()
<div class="row">
<div class="large-6 columns">
<label>
Enter Name
#Html.EditorFor(model => model.username, new { htmlAttributes = new { #class = "form-control" } })
</label>
</div>
<div class="large-6 columns">
<label>
Enter Age
#Html.EditorFor(model => model.age, new { htmlAttributes = new { #class = "form-control" } })
</label>
</div>
<div class="large-6 columns">
<label>
Enter Email Address
#Html.TextBoxFor(model => model.email, new { #class = "large-12", placeholder = "xyz#gmail.com", type = "email" })
</label>
</div>
<div class="large-6 columns">
<label>
Enter Password
#Html.PasswordFor(model => model.password, new { })
</label>
</div>
</div>
<br />
<hr />
<button type="submit" class="button tiny right" style="margin-left:5px;color:white;">Submit</button>
Cancel }
<a class="close-reveal-modal" aria-label="Close">×</a>
</form>

FormExtensions (with Controller and ActionName)
#using (Html.BeginForm("Signup_User", "Home", FormMethod.Post))
{
}
FormExtensions (with Controller , ActionName and Area )
#using (Html.BeginForm("Signup_User", "Home", FormMethod.Post, new { area = "AreaName" }))
{
}

Try replacing
action="~/Home/Signup_User"
with
action="#Url.Action("Signup_User", "Home")"

You just need to add Controller name slash action name, no need to add ~
Refer following code for Solution 1:
<form action="/Home/Signup_User" method="post" enctype="multipart/form-data">
//Add rest of your code
</form>
Else, use MVC's built in HTML helper to render the form and put your rest of the code into same.
#using (Html.BeginForm("Signup_User", "Home", FormMethod.Post))
{
// Add your rest of code
}
Above code will generate empty tag.

It seems you are using relative path in action URL . that's why Home Added twice like this.
/Home/Home/Signup_User
Asp.net MVC come up with beautiful Form Extensions.Just you need to specify Controller Name, Action Method Name and Area name if any.
for e.g.
#using (Html.BeginForm("actionName", "controllerName", new {area = "AreaName"}))
In your case
ActionName :"Signup_User"
ControllerName:"Home"
Assuming, you don't have no area defined. replace your piece code with below snippet. it will resolve your issue.
CODE:
#using (Html.BeginForm("Signup_User", "Home"))
#Html.AntiForgeryToken()
<div class="row">
<div class="large-6 columns">
<label>
Enter Name
#Html.EditorFor(model => model.username, new { htmlAttributes = new { #class = "form-control" } })
</label>
</div>
<div class="large-6 columns">
<label>
Enter Age
#Html.EditorFor(model => model.age, new { htmlAttributes = new { #class = "form-control" } })
</label>
</div>
<div class="large-6 columns">
<label>
Enter Email Address
#Html.TextBoxFor(model => model.email, new { #class = "large-12", placeholder = "xyz#gmail.com", type = "email" })
</label>
</div>
<div class="large-6 columns">
<label>
Enter Password
#Html.PasswordFor(model => model.password, new { })
</label>
</div>
</div>
<br />
<hr />
<button type="submit" class="button tiny right" style="margin-left:5px;color:white;">Submit</button>
Cancel }
<a class="close-reveal-modal" aria-label="Close">×</a>
</form>

One reason this could occur is if you don't have a start page set under your web project's properties. So do this:
Right click on your mvc project
Choose "Properties"
Select the "Web" tab
Select "Specific Page"
Assuming you have a controller called HomeController and an action method called Index, enter "home/index" in to the text box corresponding to the "Specific Page" radio button.
Now, if you launch your web application, it will take you to the view rendered by the HomeController's Index action method.

Related

Get Input of second form in MVC page

I've built a page, where master and details(pictures, aso) are shown on one page. However, if the submitt button for the second form is clicked, the form is not submitted, if validations in the first form fail. If I correct the values, the HttpPostedFileBase uploadFile is null.
The page looks like this:
#model app1.Models.MasterModel
#{
ViewBag.Title = "Edit";
Layout = "~/Views/Shared/_Layout.cshtml";
}
#using (Html.BeginForm(new { #class = "form-inline col-lg-12" }))
{
#Html.AntiForgeryToken()
<div>
<h4>MasterModel</h4>
<hr />
#Html.ValidationSummary(true, "", new { #class = "text-danger" })
#Html.HiddenFor(model => model.Id)
<div class="row">
#*Master properties*#
<div class="col-md-4 col-lg-4">
<div class="form-horizontal">
<div class="form-group">
#Html.LabelFor(model => model.Title, htmlAttributes: new { #class = "control-label col-md-3" })
<div class="col-md-8">
#Html.EditorFor(model => model.Title, new { htmlAttributes = new { #class = "form-control" } })
#Html.ValidationMessageFor(model => model.Title, "", new { #class = "text-danger" })
</div>
</div>
#* aso... *#
</div>
</div>
}
#* Master Details *#
<div class="col-md-4 col-lg-4">
#using (Html.BeginForm("NewPic", "Master", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input name="uploadFile" type="file" />
<input type="submit" value="Upload File" /> <!-- First Button, does not work -->
<div class="container-fluid">
#foreach (app1.Models.PicModel b in Model.Pics)
{
var base64 = Convert.ToBase64String(b.DbPic);
var imgSrc = String.Format("data:image/gif;base64,{0}", base64);
<img src="#imgSrc" width="200" height="200" />
}
</div>
#Html.ActionLink("Upload", "NewPic", new { id = Model.Id }) <!-- Second Button, does not work either -->
<label class="control-label col-md-4 col-lg-4" for="Title">Picer</label>
}
</div>
</div>
<div>
<div class="form-group">
<div class="col-md-offset-2 col-md-12 col-lg-12">
<input type="submit" value="Save" class="btn btn-default" />
</div>
</div>
</div>
</div>
}
<div>
#Html.ActionLink("Back to List", "Index")
</div>
#section Scripts {
#Scripts.Render("~/bundles/jqueryval")
}
The controller looks like this:
public ActionResult NewPic(int id, HttpPostedFileBase uploadFile)
{
// uploadFile is null
}
You forgotten to put [HttpPost] before NewPic method. So NewPic method will be considered as [HttpGet] so it will not work.
[HttpPost]
public ActionResult NewPic(int id, HttpPostedFileBase uploadFile)
{
// uploadFile is null
}
And also give proper Id to both form as follow so it would be easy to work with this both while client side validation.
Form 1
#using (Html.BeginForm(new {id = "Form1", #class = "form-inline col-lg-12" }))
Form 2
#using (Html.BeginForm("NewPic", "Master", FormMethod.Post, new { id = "Form2", enctype = "multipart/form-data" }))
For more information visit here

How to make a link by helpers in ASP.NET MVC?

I'm new in ASP.NET MVC. I created a login form and created two text boxes, then I used requirements attributes for them that if the were empty or wrong make errors.
Also I created a button link by #Html.ActionLink("", "") helper, so when I click it, without checking the validation of text boxes goes to next page. Would you please help me how can I fix this problem?
view code
controller code
#using (Html.BeginForm("CheckLogin", "Login", FormMethod.Post))
{
#Html.ValidationSummary(true)
#Html.ValidationMessageFor(model => model.username, null, new { #class = "required", #style = "color : red" })
<div class="form-group has-feedback">
#Html.TextBoxFor(model => model.username, null, new { #class = "form-control", placeholder = "Enter User Name" })
<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
</div>
#Html.ValidationMessageFor(model => model.userpassword, null, new { #class = "required", #style = "color : red" })
<div class="form-group has-feedback">
#Html.PasswordFor(model=>model.userpassword, new { #class = "form-control", placeholder = "Enter Password" })
<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
</div>
<div class="row">
<div class="col-xs-4">
<button type="submit" class="btn btn-primary btn-block btn-flat">Sign In</button>
</div>
<!-- /.col -->
</div>
}
<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
i think you simply copy and paste it
i think you should use
#Html.ActionLink("linkname", "Action name", "controller name")
and link is created .
In case if you are using Asp.Net Core you can use built-in tag builders:
<a class="btn btn-primary" asp-controller="<Controller name>" asp-action="<action name>" asp-route-<parameterName>="<parameter value>">Click Me!</a>
btn btn-primary is a bookstrap class.
You need to create a form in order to get correct validation
#model yourmodel
#using (Html.BeginForm("..", "...", FormMethod.Post))
{
#Html.ValidationSummary(true)
...
// your fields here now like
#Html.EditorFor(m=>m.prop)
#Html.ValidationFor(m=>m.prop)
//your submit button here
<input type=submit>
}
and at the end of the page don't forget to include Jquery validation scripts

c# mvc retrieve data from a view

I want to retrieve data from a view, it should work like this:
User fill a form available on the webpage
User clicks SEARCH button
Some function(s) collect the data and display them in another view
I tried all the basic tutorials and tips on others stackoverflow question but it still doesn't work. I don't know what I'm doing wrong...
Here's my code from the view:
section id="roomSearch">
<div class="banner">
<div class="banner-info">
<div class="container">
<div class="details-1">
#using (Html.BeginForm("UploadRoomSearchData", "HomeController", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<div class="col-md-10 dropdown-buttons">
<div class="col-md-3 dropdown-button">
#Html.AntiForgeryToken()
<div class="input-group">
#Html.TextBoxFor(m => m.YourName, new { #class = "form-control has-dark-background", #placeholder = "Imię" })
#Html.ValidationMessageFor(m => m.YourName, "", new { #class = "text-danger" })
<!--<input class="form-control has-dark-background"
name="slider-name" id="slider-name" placeholder="Imię" type="text" required="">-->
</div>
</div>
<!---strat-date-piker---->
<link rel="stylesheet" href="~/Content/jquery-ui.css" />
<script src="~/Scripts/jquery-ui.js"></script>
<script>
$(function () {
$("#datepicker,#datepicker1").datepicker();
});
</script>
<!---/End-date-piker---->
<div class="col-md-3 dropdown-button">
<div class="book_date">
<form>
<input class="date" id="datepicker" type="text" value="Przyjazd" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Przyjazd';}">
<!-- #Html.TextBoxFor(m => m.CheckIn, new { #class = "date" })
#Html.ValidationMessageFor(m => m.CheckIn, "", new { #class = "datefield" })-->
</form>
</div>
</div>
<div class="col-md-3 dropdown-button">
<div class="book_date">
<form>
<input class="date1" id="datepicker1" type="text" value="Wyjazd" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Wyjazd';}">
<!--#Html.TextBoxFor(m => m.CheckOut, new { #class = "date1" })
#Html.ValidationMessageFor(m => m.CheckOut, "", new { #class = "datefield" })-->
</form>
</div>
</div>
<div class="col-md-3 dropdown-button">
<div class="section_1">
<select id="country" onchange="change_country(this.value)" class="frm-field required">
<option value="null">Dwuosobowy</option>
<option value="null">Jednoosobowy</option>
<option value="AX">Apartament</option>
<option value="AX">Gościnny</option>
</select>
</div>
</div>
<div class="clearfix"> </div>
</div>
<div class="col-md-2 submit_button">
<form >
<input type="submit" value="SZUKAJ">
<!-- <p> #Html.ActionLink("SZUKAJ", "Book1", "Home")</p>-->
</form>
</div>}
And here's my code in the controller. For now I try to retrieve only a name, to see if it's working.
[HttpPost]
public ActionResult UploadRoomSearchData(FormCollection form)
{
string name = Request["YourName"].ToString();
StringBuilder sbRoom = new StringBuilder();
sbRoom.Append("<b>Amount :</b> " + name + "<br/>");
//return RedirectToAction("Book1");
return Content(sbRoom.ToString());
}
I also tried something like this:
foreach(var v in form)
{
Write.Response("name:" + v);
}
I tried your code and it seems to work.
First I have the controller method to display the form
public ActionResult CreatePerson()
{
Person model = new Person();
return View(model);
}
Then the form:
#model RetrieveDataFromaView.Models.Person
#using (Html.BeginForm())
{
#Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>Person</h4>
<hr />
#Html.ValidationSummary(true, "", new { #class = "text-danger" })
<div class="form-group">
#Html.LabelFor(model => model.YourName, htmlAttributes: new { #class = "control-label col-md-2" })
<div class="col-md-10">
#Html.EditorFor(model => model.YourName, new { htmlAttributes = new { #class = "form-control" } })
#Html.ValidationMessageFor(model => model.YourName, "", new { #class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="submit" class="btn btn-default" />
</div>
</div>
</div>
}
Which does a post to the controller method
[HttpPost]
public ActionResult CreatePerson(FormCollection formCollection)
{
string name = Request["YourName"].ToString();
StringBuilder sbRoom = new StringBuilder();
sbRoom.Append("<b>Amount :</b> " + name + "<br/>");
return Content(sbRoom.ToString());
}
This returns a view with only the content of the StringBuilder.
Maybe you are looking for RedirectToAction?
Hello you have this line inside the form:
#Html.AntiForgeryToken()
You can remove it or add the corresponding attribute to use it:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult CreatePerson(FormCollection formCollection)
{
///Your code here
}
Basically this is a token generated for the server to avoid requests from forms not generated by the server.
You have many ways of retrieving data from a form Post in ASP.NET MVC.
Using a Model
Usually, forms are created by specifying a Model type in the Razor view. You can use that type to retrieve the data. ASP.NET MVC will parse the body and populate the object in parameter for you.
Ex:
Controller:
public class HomeController: Controller
{
[HttpGet]
public ActionResult Index()
{
return View(new Person());
}
[HttpPost]
public ActionResult Index(Person p)
{
//Just for the sake of this example.
return Json(p);
}
}
Razor view
#model WebApplication2.Models.Person
#{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<title>title</title>
</head>
<body>
<div>
#using (Html.BeginForm("Index", "Home", FormMethod.Post))
{
#Html.AntiForgeryToken()
<div>
#Html.LabelFor(m => m.FirstName): <br/>
#Html.TextBoxFor(m => m.FirstName)
</div>
<div>
#Html.LabelFor(m => m.LastName): <br/>
#Html.TextBoxFor(m => m.LastName)
</div>
<input type="submit" value="Submit" />
}
</div>
</body>
</html>
Using a FormsCollection
The FormsCollection object allows you to access the raw values of a form. It acts as a Dictionary for the Forms value. This is useful, especially when you have a dynamic model to parse, or if you just plain don't know about the Model type.
It's also pretty straightforward to use.
[HttpPost]
public ActionResult Index(FormCollection form)
{
var dict = form.AllKeys.ToDictionary(key => key, key => form[key]);
return Json(dict);
}
PS: I saw you are using Request[key]. It may just be me, but this call just looks like Dark magic, where you get data from who knows where (it uses the Query String, the cookies, the Request body, etc. It seems like it could be really problematic in some cases in the future. I much prefer knowing exactly where the data comes from. But that may just be me.
Conclusion
In conclusion, use the Model approach if you know exactly what should be in the Form. Use the FormCollection approach if you really need to. That's pretty much it.
Good luck.

Multiple submit buttons from multiple views ASP .NET MVC5

I´m working on ASP .NET MVC 5 application and now I´m implementing newsletter functionality. I have master (parent view) with all stuff and on this view there is also box with input field for email and submit button. After click on this button, controller method insert this e-mail to subscribers tab. I´ve got GET/POST method and PartialView for this Newsletter (all newsletter´s code is in separate area).
Everything works fine, there is only one problem. On master page I have another submit button (for submitting search string) so everytime after submitting search string, code also submit newsletter form.
Is there any solution to separate this two submit buttons and way to not refresh whole page after submit newsletter (PartialView) form?
Here is my Newsletter PartialView called _SignIn
#using (Html.BeginForm())
#Html.AntiForgeryToken()
<div class="form-horizontal">
#Html.ValidationSummary(true, "", new { #class = "text-danger" })
<div class="form-group">
#Html.LabelFor(model => model.email, htmlAttributes: new {#class = "control-label col-md-12", style="text-align: left; padding-left: 30px;"})
<div class="col-md-12" align="center">
#Html.EditorFor(model => model.email, new {htmlAttributes = new {#class = "form-control"}})
#Html.ValidationMessageFor(model => model.email, "", new {#class = "text-danger"})
</div>
</div>
<div class="form-group">
#Html.LabelFor(model => model.NewsletterType, htmlAttributes: new { #class = "control-label col-md-12", style = "text-align: left; padding-left: 30px;" })
<br />
<div class="col-md-12" align="center">
#Html.EnumDropDownListFor(model => model.NewsletterType, new { #class = "form-control" })
#Html.ValidationMessageFor(model => model.NewsletterType, "", new { #class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-4 col-md-10" style="padding-bottom: 10px;">
<input type="submit" value="Prihlásiť" class="btn btn-success" />
</div>
</div>
</div>
Thank you for any response!
You will only achieve this using ajax calls, with that, you do not need to refresh the whole page.
#Html.AntiForgeryToken()
<div class="form-horizontal">
#Html.ValidationSummary(true, "", new { #class = "text-danger" })
<div class="form-group">
#Html.LabelFor(model => model.email, htmlAttributes: new {#class = "control-label col-md-12", style="text-align: left; padding-left: 30px;"})
<div class="col-md-12" align="center">
#Html.EditorFor(model => model.email, new {htmlAttributes = new {#class = "form-control", id = "emailTxt"}})
#Html.ValidationMessageFor(model => model.email, "", new {#class = "text-danger"})
</div>
</div>
<div class="form-group">
#Html.LabelFor(model => model.NewsletterType, htmlAttributes: new { #class = "control-label col-md-12", style = "text-align: left; padding-left: 30px;" })
<br />
<div class="col-md-12" align="center">
#Html.EnumDropDownListFor(model => model.NewsletterType, new { #class = "form-control" })
#Html.ValidationMessageFor(model => model.NewsletterType, "", new { #class = "text-danger", id = "ddlType" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-4 col-md-10" style="padding-bottom: 10px;">
<button type="button" class="btn btn-success btn-newsletter"></button>
</div>
</div>
</div>
<script>
$(function(){
var model = {
email: $('.emailTxt').text();
NewsletterType: $('.ddlType :selected').text();
}
$(.btn-newsletter).click(function(){
$.ajax({
url: url,
type: 'POST',
data: model,
beforeSend: function(xhr){xhr.setRequestHeader('__RequestVerificationToken', $('body').find('input[name="__RequestVerificationToken"]'));},
statusCode: {
200: function (data) { success(data); },
500: function (erro) { error(erro); }
}
});
});
});
</script>
Add name attribute to your buttons, and use the value in your controller to distinguish which button was invoked.
<button type="submit" id="btnSave" name="Command" value="Save">Save</button>
<button type="submit" id="btnSubmit" name="Command" value="Submit">Submit</button>
public ActionResult YourAction(Model model, string Command)
{
if(Command == "Save") {}
}
Refer to Handling multiple submit buttons for more info.
To prevent the full postback (refresh) you could use AJAX
You have to have two separate forms to handle each submission or handle it through some form of Javascript. I'd suggest using 2 separate forms. Put the search string submission in the parent view since it should be on all the pages and close the form. Then you can render your partial view for the newsletter subscription with a form inside of it.
Basically:
Parent view
...
#using (Html.BeginForm())
{
#Html.AntiForgeryToken()
<div class="form-horizontal">
...
<!-- Search string input field and submit button -->
...
</div>
}
<div>
#Html.RenderPartial("_SignUp")
</div>
...
_SignUp Partial view
#using (Html.BeginForm())
{
#Html.AntiForgeryToken()
<div class="form-horizontal">
...
<!-- Subscriber email input and submit -->
...
</div>
}

ASP .NET MVC Form fields Validation (without model)

I am looking for a way to validate two fields on ASP View page. I am aware that usual way of validating form fields is to have some #model ViewModel object included on a page, where the properties of this model object would be annotated with proper annotations needed for validation. For example, annotations can be like this:
[Required(ErrorMessage = "Please add the message")]
[Display(Name = "Message")]
But, in my case, there is no model included on a page, and controller action that is being called from the form receives plane strings as method arguments.
This is form code:
#using (Html.BeginForm("InsertRssFeed", "Rss", FormMethod.Post, new { #id = "insertForm", #name = "insertForm" }))
{
<!-- inside this div goes entire form for adding rssFeed, or for editing it -->
...
<div class="form-group">
<label class="col-sm-2 control-label"> Name:</label>
<div class="col-sm-10">
<div class="controls">
#Html.Editor("Name", new { htmlAttributes = new { #class = "form-control", #id = "add_rssFeed_name" } })
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label"> URL:</label>
<div class="col-sm-10">
<div class="controls">
#Html.Editor("Url", new { htmlAttributes = new { #class = "form-control", #id = "add_rssFeed_Url" } })
</div>
</div>
</div>
</div>
</div>
<!-- ok and cancel buttons. they use two css classes. button-styleCancel is grey button and button-styleOK is normal orange button -->
<div class="modal-footer">
<button type="button" class="button-styleCancel" data-dismiss="modal">Close</button>
<button type="submit" class="button-styleOK" id="submitRssFeed">Save RSS Feed</button>
</div>
}
You can see that form is sending two text fields (Name and Url) to the RssController action method, that accepts these two string parameters:
[HttpPost]
public ActionResult InsertRssFeed(string Name, string Url)
{
if (!String.IsNullOrEmpty(Name.Trim()) & !String.IsNullOrEmpty(Url.Trim()))
{
var rssFeed = new RssFeed();
rssFeed.Name = Name;
rssFeed.Url = Url;
using (AuthenticationManager authenticationManager = new AuthenticationManager(User))
{
string userSid = authenticationManager.GetUserClaim(SystemClaims.ClaimTypes.PrimarySid);
string userUPN = authenticationManager.GetUserClaim(SystemClaims.ClaimTypes.Upn);
rssFeedService.CreateRssFeed(rssFeed);
}
}
return RedirectToAction("ReadAllRssFeeds", "Rss");
}
If the page would have model, validation would be done with #Html.ValidationSummary method, but as I said I am not using modelview object on a page.
Is there a way to achieve this kind of validation without using ModelView object, and how to do that? Thanks.
If you are looking for server side validation you can use something like below using
ModelState.AddModelError("", "Name and Url are required fields.");
but you need to add
#Html.ValidationSummary(false)
to your razor view inside the Html.BeginForm section, then code will looks like below.
[HttpPost]
public ActionResult InsertRssFeed(string Name, string Url)
{
if (String.IsNullOrEmpty(Name.Trim()) || String.IsNullOrEmpty(Url.Trim()))
{
ModelState.AddModelError("", "Name and URL are required fields.");
return View();
}
var rssFeed = new RssFeed();
rssFeed.Name = Name;
rssFeed.Url = Url;
using (AuthenticationManager authenticationManager = new AuthenticationManager(User))
{
string userSid = authenticationManager.GetUserClaim(SystemClaims.ClaimTypes.PrimarySid);
string userUPN = authenticationManager.GetUserClaim(SystemClaims.ClaimTypes.Upn);
rssFeedService.CreateRssFeed(rssFeed);
}
return RedirectToAction("ReadAllRssFeeds", "Rss");
}
If you are looking for only client side validation, then you have to use client side validation library like Jquery.
http://runnable.com/UZJ24Io3XEw2AABU/how-to-validate-forms-in-jquery-for-validation
Edited section for comment
your razor should be like this.
#using (Html.BeginForm("InsertRssFeed", "Rss", FormMethod.Post, new { #id = "insertForm", #name = "insertForm" }))
{
#Html.ValidationSummary(false)
<div class="form-group">
<label class="col-sm-2 control-label"> Name:</label>
<div class="col-sm-10">
<div class="controls">
#Html.Editor("Name", new { htmlAttributes = new { #class = "form-control", #id = "add_rssFeed_name" } })
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label"> URL:</label>
<div class="col-sm-10">
<div class="controls">
#Html.Editor("Url", new { htmlAttributes = new { #class = "form-control", #id = "add_rssFeed_Url" } })
</div>
</div>
</div>
</div>
</div>
<!-- ok and cancel buttons. they use two css classes. button-styleCancel is grey button and button-styleOK is normal orange button -->
<div class="modal-footer">
<button type="button" class="button-styleCancel" data-dismiss="modal">Close</button>
<button type="submit" class="button-styleOK" id="submitRssFeed">Save RSS Feed</button>
</div>
}
Hope this helps.

Categories

Resources