question

AypnCNN-4494 avatar image
0 Votes"
AypnCNN-4494 asked AypnCNN-4494 answered

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

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
dotnet-aspnet-mvc
image.png (46.5 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AypnCNN-4494 avatar image
0 Votes"
AypnCNN-4494 answered

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.



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.