4
Answers

WebGrid in MVC

Photo of Jaima Joseph

Jaima Joseph

11y
1.3k
1
My task is to fetch all the quotations from a table and show it in webgrid.In the view a column is added with the database records,whis is a radiobutton.If I click on a radiobutton,I want to send that webgrid row's data to another table ie,approved table.I am doubtful,whether I should use a second view and controller for the save operation?It is an MVC 5 application and I am using Entity Framework. Any help will be appreciated.

Answers (4)

0
Photo of Anubhav Chaudhary
NA 42.5k 11.3m 11y
Hey Jaima,

You doesn't need to Add a new Controller for this but you can Add a new View. This new View can be called from the already existing Controller class. You will need to create an Action Result and it's name should be similar to the new View Name i.e. for e.g. if ActionResult Hello() is declared then the NewView should be of Name "Hello". You can open this new View either by returning it from the Checkbox result or you can call this new ActionResult in the Return of Checkbox, calling this new ActionResult will execute the Hello and after it's complete processing return the data in the Result of this Hello.

This data can be shown in the new table as you have shown the previous data in WebGrid

Thanks 
Accepted
0
Photo of Jaima Joseph
NA 89 69.6k 11y
Hi Anubhav, Thanks...Thanks a lot...my problem is almost solved.In case of difficulty I'l post the query...Thank you.
0
Photo of Anubhav Chaudhary
NA 42.5k 11.3m 11y
Hey Jaima,

I think you should follow my this Article, in this Article I had used a partial View and in that partial view value from particular Row is fetched(Look at the final Result of Article).

http://www.c-sharpcorner.com/UploadFile/cd7c2e/partial-view-in-Asp-Net-mvc/

Now the question is How to Call Action Result, for that you should follow this link:-

http://stackoverflow.com/questions/16440365/how-to-trigger-button-click-in-mvc-4

I hope now your problem would get solved otherwise message me one more time
0
Photo of Jaima Joseph
NA 89 69.6k 11y
Thank you Anubhav..Thankss a lot.... Can you tell me one thing clearly,how to get the rows column values with out using a getSelectlink().Actually it is not clear for me what you have written here regarding the checkbox result?how to call the actionresult in the return of Checkbox(or radiobutton)..that part is not clear...