i am calling store procedure from MVC, which returns single record only.

SP contains:

PROCEDURE [dbo].[GetMonthlyReport] @emplID INT = NULL,
    @month VARCHAR(50) = NULL
AS
BEGIN


IF (@emplID IS NOT NULL AND @month IS NOT NULL) --If Block begins
BEGIN
    SELECT *
    FROM MonthlyRecord
    WHERE Month = @month AND EmplID = @emplID
END --If block ends
ELSE --Else block begins
BEGIN
    RETURN 0
END --Else block ends

END
now it is selecting, empID, Overtime, Month, TotalDuration from MonthlyRecord View,

What i want to do is to put these fields in custom template e.g. HTML TABLE or List, like :

<table style="width:300px">
<tr>
<td>Employee ID</td>
<td>Month</td> 
</tr>
<tr>
<td>@empID</td>
<td>@Month</td> 
</tr>
</table>

something dynamic.

MVC Code:

Controller:

public ActionResult Generated_PaySlip(int? emplID, String month) 
{
IEnumerable<GetMonthlyReportResult> PaySlip = DataContext.GetMonthlyReport(emplID, month).ToList();
return View(PaySlip);
}

View:

@using EmployeeAttendance_app.Models

<h2>Employee Pay Slip</h2>



<table style="width:300px">
<tr>
<td>Employee ID</td>
<td>Month</td> 
</tr>
<tr>
<td>@empID</td>
<td>@Month</td> 
</tr>
</table>

You may need to be patient on this one. I would love to assist, but I have no working experience with MVC, only web forms. Hopefully, another member at the asp.net mvc guru level can help you with this one...

commented: +1 for at least such a hopeful comment +2

first tell me what you want and what you supplying to view
if you get multiple rows from table and as you suplied it to view that is collection of something so to view it you first make aclass that represent that data of the row as you getting row collection you have to create IEnumerable of that class and than call foreach loop in view thus you can show you data

ii may be wrong because i also a new in .net field only 6 month exp that also not working experience and very bad in english sorry but just tried to say what i feel

@model GetMonthlyReportResult
@using EmployeeAttendance_app.Models

<h2>Employee Pay Slip</h2>

<table style="width:300px">
<tr>
<td>Employee ID</td>
<td>Month</td>
</tr>
<tr>
<td>@Model.empID</td>
<td>@Model.Month</td>
</tr>
</table>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.