Hi,
I have created a master table for the coloums classID and ClassName,i want a mvc form with entityframework to display or to make use
of that data in the other application.
Thanks & Regards
Rizwan
Know the answer? Post it. Somebody with the same question will find it here.
Suraj SahooRank #382 · 6.6K reputationPosted Feb 24, 2015, 10:38 PM EST
Now since you have your database and tables ready, you can follow Entity Framework DB-First approach.
http://www.entityframeworktutorial.net/database-first-with-entity-framework.aspx
Then you need to establish an Ado.Net Entity Model connection to the MVC project, which you will find in the Add New Item template in the DATA section.
Then after the connection is established, you need to use the context to be able to access the data records in the table, more information you will get from the link.
Accept if helps anyway.
Thanks
Ravi PatelRank #439 · 5.7K reputationPosted Feb 24, 2015, 11:23 PM EST
check this link
http://www.c-sharpcorner.com/UploadFile/1492b1/connecting-the-mvc-application-with-the-help-of-entityframew/
Mohammed Rizwanullah55 reputationPosted Mar 2, 2015, 12:06 AM EST
Sir i have gone through your link, the data is listing in index view,but unable to create, update,edit or delete.
Ravi PatelRank #439 · 5.7K reputationPosted Mar 2, 2015, 3:10 AM EST
if you are using strongly view
dbContext.User.Add(users); // here User is your Model class name
Mohammed Rizwanullah55 reputationPosted Mar 2, 2015, 7:20 PM EST
Ravi PatelRank #439 · 5.7K reputationPosted Mar 2, 2015, 7:43 PM EST
attach your database back up file here
Mohammed Rizwanullah55 reputationPosted Mar 2, 2015, 7:55 PM EST
Mohammed Rizwanullah55 reputationPosted Mar 2, 2015, 8:39 PM EST
Ravi PatelRank #439 · 5.7K reputationPosted Mar 2, 2015, 9:24 PM EST
where you uploaded i did not get any database backup file
take the database backup and compress that database backup in zip or rar formate then upload
Mohammed Rizwanullah55 reputationPosted Mar 2, 2015, 10:02 PM EST
Ravi PatelRank #439 · 5.7K reputationPosted Mar 3, 2015, 12:38 AM EST
I checked your source code you are not using Entity Framework Database first approach
Please go to msdn https://www.asp.net/mvc/overview/getting-started/database-first-development/setting-up-database
and download visual studio 2013 http://www.visualstudio.com/
Mohammed Rizwanullah55 reputationPosted Mar 3, 2015, 9:40 PM EST
am creating a mvc app to perform CRUD, but to perform Create, it stores only one time
the ID field does not increament,
help me out with this.
Thanks
Rizwan
Mohammed Rizwanullah55 reputationPosted Mar 4, 2015, 9:49 PM EST
This is Rizwan,i already sent the Database of MVCDB, there are two tables, i want to create a third with StudentName in dropdown,when we select student name,student class should be displayed, could you plz help me out in mvc 3 with EF.
Thanks
Rizwan
Mohammed Rizwanullah55 reputationPosted Mar 6, 2015, 9:54 PM EST
I have two columns in the database, firstname,lastname, i want to concat two names and want to produce as Fullname in dropdownlist.is there any help?
Thanks
Rizwan
Suraj SahooRank #382 · 6.6K reputationPosted Mar 8, 2015, 10:56 PM EDT
You can try and use a Partial class that will extend the main class which has FirstName and LastName as properties.
Then in the Partial class have a property called FullName and since it extends the main class, whenever it is called you can have a property fullName in access too which you can use to set the dropdown.
http://www.codeproject.com/Articles/709273/Partial-Classes-in-Csharp-With-Real-Example
I hope you understand
Accept if helps you.
Thanks
Mohammed Rizwanullah55 reputationPosted Mar 9, 2015, 9:08 PM EDT
I have two tables,student and class, i have taken the values of student name in the dropdown list , now when i select the name in the dropdownlist i want to dispaly the respective classname from the table,.could you plz help me with the query and where to write it in mvc.
Thanks
Rizwan
Suraj SahooRank #382 · 6.6K reputationPosted Mar 9, 2015, 10:06 PM EDT
Based on your latest query, you need to do this in the javascript file using jquery. Based on the dropdown value change, take the dropdown selected value and make an ajax call to get the other value to be updated from the table.
Please check the below fiddle for some information.
http://jsfiddle.net/taditdash/9Kfnt/
I hope this idea surely helps you. You just need to add the ajax call into the Onchange function of the dropdown. Retrieve the value from table in ajax and inside the ajax sucess function add the value wherever you want.
Accept If helps you.
Thanks
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts