Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
2.67/5 (2 votes)
Dear Sir/Madam,
I am very new in the MVC coding. i have a below problem.please help me.Thanks in advance.

I have Three text box in asp.net MVC form. Author Id,Author Name and Author address.
I have two button(Previous and Next).when I click on the next button it will show one by one Author records from Sql server database.i used entity framework in MVC 4.

Design view in mvc

HTML
<fieldset>
    <legend>Author</legend>

     <div class="display-label">
         @Html.DisplayNameFor(model => model.AuthorId)
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.AuthorId)
    </div>

    <div class="display-label">
         @Html.DisplayNameFor(model => model.Name)
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Name)
    </div>

    <div class="display-label">
         @Html.DisplayNameFor(model => model.Location)
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Location)
    </div>

      <p>
            <input type="submit" value="Previous" />
            <input type="submit" value="Next" />
        </p>
</fieldset>


Database Details:

SQL
CREATE TABLE Author1
(
	AuthorId INT PRIMARY KEY IDENTITY(1,1) NOT NULL,
	Name VARCHAR(100) NULL,
	Location VARCHAR(50) NULL,
)

INSERT INTO Author1 VALUES('bubai','Kulti')
INSERT INTO Author1 VALUES('Ajay','Malad')
INSERT INTO Author1 VALUES('Rajesh','Kharghar')
INSERT INTO Author1 VALUES('Smita','Thane')
INSERT INTO Author1 VALUES('Amit','Burdwan')
INSERT INTO Author1 VALUES('Sumit','Golf Green')


select * from Author1


Please send me complete and simple code as i am very new in mvc coding.

Thanks for kind help.
Bubai Banerjee
Posted
v3
Comments
What is the problem in the current code?
bubai banerjee 6-Jan-14 1:14am    
Dear Sir,
I am not able to display one by one record in the textboxes from database when click on next button.
Thanks
Bubai Banerjee
Sunasara Imdadhusen 6-Jan-14 1:19am    
Have you written code to get record for next?
bubai banerjee 6-Jan-14 1:32am    
yes.. but it is not working.This is realy very urgent.please help if you have simple code.Thanks in advance
Sunasara Imdadhusen 6-Jan-14 1:54am    
What does it mean "Very Urgent". i am giving u a hint and then you have to correct the code accordingly. one more thing we are doing a volunteer job over here not doing your home work at all.
have u implemented my code?
What is your error using my code?

1 solution

lol. i love it. it is really urgent that his homework be done. haha.

Dear lazy sir, please read up on ADO.NET, or Entity Framework to find out how to access your database.
 
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