Click here to Skip to main content
15,886,857 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
This is in .cshtml

C#
@foreach (var certi in repo.SearchBoardCertificationRepo())
                    {
                        <tr>
                            <td>@certi.examdate</td>
                            <td>@certi.regopendate</td>
                            <td>@certi.regclosedate</td>
                            <td>@certi.maxseats</td>
                            <td>@certi.current_seat</td>
                            <td>@certi.max_ecs</td>
                            <td>@certi.ecs_seats</td>
                            <td>@certi.ecs_cases</td>
                            <td>@certi.ice_fee</td>
                            <td>@certi.ice_Main</td>
                            <td>@certi.ice_in</td>                           
                        </tr>
                    }


and my controller method is

C#
public IList<BoardCertificate> SearchBoardCertificationRepo(BoardCertificate board_certification)
      {
          return _database.Fetch<BoardCertificate>("select * from BoardCertificates where lastname ='" + board_certification.lastname + "'  ");
      }



and my error on above at @foreac, The error is "no overload for method takes 0 arguments".
Actually i want simply display data on page which from getting in controller.

Thanks.
Posted

You need to pass an object of type BoardCertificate to your SearchBoardCertificationRepo method

@foreach (var certi in repo.SearchBoardCertificationRepo(cert))


where "cert" is something of type BoardCertificate. We don't have your code or know what you have available or what your methods do so it is impossible to give any more specific advice.

It looks like your method just searches on surname so if you know what the surname is to search on, this should work

@foreach (var certi in repo.SearchBoardCertificationRepo(new BoardCertificate{lastname="Smith"} ))


As a side note, your code might be open to SQL injection attacks.
 
Share this answer
 
v2
Comments
Pratham4950 20-Mar-15 6:45am    
Thax, for reply..
Look at your second code block: The Method SearchBoardCertificationRepo takes one argument: BoardCertificate board_certification

Look at the top code block: You're calling SearchBoardCertificationRepo with zero arguments. You need to specify some BoardCertificate as argument. I can't tell you which one or where it should come from - that's something you should know or would have to figure out.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900