How to resolve "The view 'Index' or its master was not found " err

Aypn CNN 446 Reputation points
2021-09-30T03:54:11.607+00:00

Hi,

I'm a very beginner on MVC apps, I'm getting the following err., when I run the application, please check my codes (attached Link: https://drive.google.com/file/d/1UBl8MgH1eN2dupOCofXkN8SinADdwdvq/view?usp=sharing) check and correct me where I did wrong.

Path: http://localhost:27825/groups/Index

136496-image.png

SQL Table and SP Codes:

USE [UTIL2] -- Database  
GO  
  
  
SET ANSI_NULLS ON  
GO  
  
SET QUOTED_IDENTIFIER ON  
GO  
  
SET ANSI_PADDING ON  
GO  
  
CREATE TABLE [dbo].[Groups](  
	[RowId] [int] IDENTITY(1,1) NOT NULL,  
	[RegionName] [varchar](100) NULL,  
	[BranchName] [varchar](100) NULL,  
	[GroupId]	[INT] null,  
	[GroupName] [varchar](100) NOT NULL,  
 CONSTRAINT [PK_Groups] PRIMARY KEY CLUSTERED   
(  
	[RowId] ASC  
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]  
) ON [PRIMARY]  
  
GO  
  
SET ANSI_PADDING OFF  
GO  
  
-------- SP  
  
USE [UTIL2]   
GO  
  
SET ANSI_NULLS ON  
GO  
SET QUOTED_IDENTIFIER ON  
GO  
create procedure [dbo].[SP_GroupTxn] -- '1','Lotus','CPT','Sadras' select * from [dbo].[Groups]  
(    
   @GroupId nvarchar (50),    
   @GroupName nvarchar (50),    
   @RegionName nvarchar (100) ,   
   @BranchName nvarchar (100)    
)    
as    
begin    
   Insert into [Groups] values(@RegionName,@BranchName,@GroupId ,@GroupName)    
End  
  
   
Developer technologies | ASP.NET | Other
0 comments No comments
{count} votes

Accepted answer
  1. Aypn CNN 446 Reputation points
    2021-09-30T06:52:12.63+00:00

    Dear Friends,

    After my great research, I got the solution, details as follows,

    1. I renamed **Index.cshtml** from groups.cstml
    
    2. Changed **return View("Index");**  from return View();
    
    3. in Jquery I removed one } which is wrong, the final one script as follows ...
    
     <script src="~/Scripts/jquery-3.5.1.min.js"></script>
        <script type="text/javascript" src="http://ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js"></script>
        <script type="text/javascript">
            $("body").on("click", "#btnAdd", function () {
    
                var txtreg = $("#txtRegion");
                var txtbr = $("#txtBranch");
                var txtgrid = $("#txtGroupID");
                var txtgrname = $("#txtGroupName");
    
                $.ajax({
                    type: "POST",
                    url: "/Groups/InsertGroups",
                    data: '{RegionName: "' + txtreg.val() + '", BranchName: "' + txtbr.val() + '", GroupId: "' + txtgrid.val() + '", GroupName: "' + txtgrname.val()  + '" }',
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (r) {
                        txtRegion.val("");
                        txtBranch.val("");
                    }
                });
            });
        </script>
    

    Thanks for the support.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.