-1

I am developing a MVC application..I have a requirement where in I have 5 textboxes (user uses this to search) and a grid to display what user has searched for on the same web page..View is binded with model coming from database which has output of what user searched for..How do I pass data from view to controller (those 5 fields user could search for)..I am using Kendo grid to display the data.Thank you.

tereško
  • 58,060
  • 25
  • 98
  • 150
Naga
  • 88
  • 2
  • 4
  • 14
  • 2
    What have you tried? Have you googled your question? Theres a lot of information on this. You caoulg POST the data to your ocntroller when the users submits the info. – Celt Mar 30 '15 at 14:07
  • Yes, I am quite aware of those methods and used them too..my question is I have a model that I am using in the view and still want to pass parameters from view to controller without using viewmodel..whats the best approach in that case..like formcollection or anything else..which one is the most efficient.;. – Naga Mar 31 '15 at 16:18

1 Answers1

0

If the grid is ajax bound the Data method should be used to specify the name of the JavaScript function which will return the additional data.

Example: Send Additional Data In Ajax Bound Grid:

// -- removed for brevity
.DataSource(dataSource => dataSource.Ajax()
    .Read(read => read
        .Action("Read", "Home")
        .Data("additionalData")
    )
)

// -- removed for brevity
<script>
    function additionalData() {
        return {
            userID: 42,
            search: $("#search").val()
        };
    }
</script>
Murat Yıldız
  • 11,299
  • 6
  • 63
  • 63