Ticket T296121
Visible to All Users

GridView for MVC- How to get row values on the client side without callbacks

created 10 years ago

Hi,

I have an MVCxGridView.

I need to get specific cell data from the grid using ASPxClientGridView. I add the MVCxGridView to the page using the following;

JavaScript
settings.CustomJSProperties = (s, e) => {     MVCxGridView g = s as MVCxGridView;     Dictionary<int, object> dict = new Dictionary<int, object>();     int startIndex = g.PageIndex * g.SettingsPager.PageSize;     int endIndex = startIndex + g.SettingsPager.PageSize;     for (int i = startIndex; i < endIndex; i++)     {         dict[i] = g.GetRowValues(i, "shippingnumber");     }     e.Properties.Add("shipmentData" + ViewBag.Count, dict); };

Now I have a seperate button which calls a client side event and does some ajax work. I want to get hold of these shipments numbers.

Can someone please tell me how to do this? So far I have;

C#
var shipmentGridView = ASPxClientGridView.Cast('@shipmentGridViewId');

however I cant see from the documentation hot to then access the vars other than using a callback which I would rather aovid please.

Answers approved by DevExpress Support

created 10 years ago (modified 7 years ago)

Hello Matthew,

The property name passed via CustomJSProperties must begin with the "cp" prefix for correct operation: CustomJSPropertiesEventArgs.Properties. I've attached a sample project illustrating how to pass values from server to the client side and how to get a reference to the passed object. Should you have further questions, feel free to ask.

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.