Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81728

where condition not a field .net

$
0
0

I am filtering a second datatable based off a selected row of the first database. However, if there is nothing selected on the first datatable, I would like the second datatable to show all records. Is this possible? Currently, if unselected I am settting it to -1.

            ajax: {
                url: '/api/Contacts',
                type: 'post',
                data: function (d) {
                    var selected = applicationtable.row({ selected: true });
                    if (selected.any()) {
                        d['Contacts.ApplicationID'] = selected.data().ApplicationID;
                    } else {
                        d['Contacts.ApplicationID'] = -1;
                    }
                }
            },

it doesn't like the orWhere because it is expecting a fieldname

                                .Where(q =>
                                {
                                    q.Where(r =>
                                    {
                                        r.Where("Contacts.ApplicationID", request.Form["Contacts.ApplicationID"]);
                                        r.OrWhere(request.Form["Contacts.ApplicationID"],"-1");
                                    });
                                })

Viewing all articles
Browse latest Browse all 81728

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>