Click here to Skip to main content
15,886,199 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: Best practice connecting to database Pin
Gerry Schmitz9-Aug-17 7:31
mveGerry Schmitz9-Aug-17 7:31 
GeneralRe: Best practice connecting to database Pin
Eddy Vluggen9-Aug-17 8:25
professionalEddy Vluggen9-Aug-17 8:25 
QuestionHow to get each items "valuemember" value of checkedlistbox using for loop and show it in messagebox in winform Pin
bhagyashri from kolhapur19-Jul-17 2:33
bhagyashri from kolhapur19-Jul-17 2:33 
AnswerRe: How to get each items "valuemember" value of checkedlistbox using for loop and show it in messagebox in winform Pin
Richard MacCutchan19-Jul-17 4:56
mveRichard MacCutchan19-Jul-17 4:56 
QuestionOne Wier library for VB.NET Pin
Member 1218072911-Jul-17 23:47
Member 1218072911-Jul-17 23:47 
AnswerRe: One Wier library for VB.NET Pin
Afzaal Ahmad Zeeshan12-Jul-17 0:30
professionalAfzaal Ahmad Zeeshan12-Jul-17 0:30 
GeneralRe: One Wier library for VB.NET Pin
Member 1218072920-Jul-17 6:01
Member 1218072920-Jul-17 6:01 
QuestionMVC: ValidationSummary("); dosn't work with Partial Viwe Pin
Azza ALbelushi5-Jul-17 23:55
Azza ALbelushi5-Jul-17 23:55 
Hi All, Hope you all Fine
I Create a controller (Account ), with 3 Action Result(Main Login Page,Login,register)as the bellow code:
public class AccountController : Controller
   {
       // GET: Account

       public ActionResult MainLoginPage()
       {
           return View();
       }

       public ActionResult Login()
       {
           return View();

       }

       [HttpPost]
       public ActionResult Login(UserInfo user)
       {

           if (Membership.ValidateUser(user.UserName, user.Password))
           {
               FormsAuthentication.SetAuthCookie(user.UserName, false);
               return RedirectToAction("HomePage", "Home");
           }
           else
           {
               ModelState.AddModelError("", "Login details are wrong.");

           }
           return View(user);
           //return PartialView("~/Views/Account/_Login.cshtml");

       }

       public ActionResult Register()
       {
           return View();
       }

       [HttpPost]
       public ActionResult Register(UserInfo user)
       {
           if (ModelState.IsValid)
           {
               Membership.CreateUser(user.UserName, user.Password, user.Email);

               return RedirectToAction("HomePage", "Home");

           }
           else
           {
               ModelState.AddModelError("", "already registered.");

           }
           return View();

       }

I create one main View(MainLoginPage)which contain two Partial Views(_login,_Register) as follow:.
@{
    ViewBag.Title = "MainLoginPage";
}

@section PageHeader
{
    <link href="~/Content/Css/Login.css" rel="stylesheet" />
    <link href="~/Content/Css/animation.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
    <script src="~/Scripts/jquery.validate.min.js"></script>
    <script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>

}

<pre>
<div class="wrapper">

    <div id="login" class="animate form">

        @{

            Html.RenderPartial("_Login"); }

    </div>

    <div id="register" class="animate form">
        @{ Html.RenderPartial("_Register"); }
    </div>

</div>





_Login
@model myWebsite.Models.UserInfo

@using (Html.BeginForm("Login", "Account", FormMethod.Post))
            {

<pre>
@Html.AntiForgeryToken() @*The anti-forgery token can be used to help protect
    your application against cross - site request forgery.*@

@Html.ValidationSummary(true, "Login Failed, check details");

<label data-icon="u"> </label>
@Html.TextBoxFor(user => Model.UserName, new { placeholder = "username" })
@Html.ValidationMessageFor(user => Model.UserName)

<label data-icon="p"> </label>
@Html.PasswordFor(user => Model.Password, new { placeholder = "password" })
@Html.ValidationMessageFor(user => Model.Password@*,"*"*@)






_Register
code similar to Login

When login with valid user it work probably but My problem is when in enter invalid login details it showing the following Error:
Server Error in '/' Application.

The view 'Login' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Account/Login.aspx
~/Views/Account/Login.ascx
~/Views/Shared/Login.aspx
~/Views/Shared/Login.ascx
~/Views/Account/Login.cshtml
~/Views/Account/Login.vbhtml
~/Views/Shared/Login.cshtml
~/Views/Shared/Login.vbhtml 

It seem that searching for the view login while login is Partial(_Login)

Could You please advice me

Note:
Quote:
It work probably when I work on it as normal view not as partial view


modified 6-Jul-17 7:27am.

AnswerRe: MVC: ValidationSummary("); dosn't work with Partial Viwe Pin
Richard Deeming6-Jul-17 1:22
mveRichard Deeming6-Jul-17 1:22 
GeneralRe: MVC: ValidationSummary("); dosn't work with Partial Viwe Pin
Azza ALbelushi6-Jul-17 2:49
Azza ALbelushi6-Jul-17 2:49 
GeneralRe: MVC: ValidationSummary("); dosn't work with Partial Viwe Pin
Richard Deeming6-Jul-17 2:52
mveRichard Deeming6-Jul-17 2:52 
GeneralRe: MVC: ValidationSummary("); dosn't work with Partial Viwe Pin
Azza ALbelushi6-Jul-17 8:00
Azza ALbelushi6-Jul-17 8:00 
GeneralRe: MVC: ValidationSummary("); dosn't work with Partial Viwe Pin
Richard Deeming6-Jul-17 9:07
mveRichard Deeming6-Jul-17 9:07 
GeneralRe: MVC: ValidationSummary("); dosn't work with Partial Viwe Pin
Azza ALbelushi6-Jul-17 19:07
Azza ALbelushi6-Jul-17 19:07 
GeneralRe: MVC: ValidationSummary("); dosn't work with Partial Viwe Pin
Richard Deeming7-Jul-17 0:29
mveRichard Deeming7-Jul-17 0:29 
GeneralRe: MVC: ValidationSummary("); dosn't work with Partial Viwe Pin
Azza ALbelushi10-Jul-17 20:05
Azza ALbelushi10-Jul-17 20:05 
GeneralRe: MVC: ValidationSummary("); dosn't work with Partial Viwe Pin
Richard Deeming11-Jul-17 1:29
mveRichard Deeming11-Jul-17 1:29 
GeneralRe: MVC: ValidationSummary("); dosn't work with Partial Viwe Pin
Dave Kreskowiak11-Jul-17 3:33
mveDave Kreskowiak11-Jul-17 3:33 
QuestionPrinting things in MVC Pin
kijie4-Jul-17 5:33
kijie4-Jul-17 5:33 
AnswerRe: Printing things in MVC Pin
Gerry Schmitz4-Jul-17 6:03
mveGerry Schmitz4-Jul-17 6:03 
QuestionConsole Application is raising following Error Pin
indian14329-Jun-17 7:54
indian14329-Jun-17 7:54 
AnswerRe: Console Application is raising following Error Pin
jschell2-Jul-17 7:18
jschell2-Jul-17 7:18 
QuestionTelerik radscheduler day view problem Pin
Member 1326557818-Jun-17 1:50
Member 1326557818-Jun-17 1:50 
AnswerRe: Telerik radscheduler day view problem Pin
Eddy Vluggen18-Jun-17 2:37
professionalEddy Vluggen18-Jun-17 2:37 
GeneralRe: Telerik radscheduler day view problem Pin
Member 1326557818-Jun-17 2:51
Member 1326557818-Jun-17 2:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.