Details Template displays the result of a paramterised server query

Is it possible to use the details template mechanism to trigger a server side action with an apprpriate parameter - that can display a single object formulated for that specific parameter.



5 Replies 1 reply marked as answer

TS Thiyagu Subramani Syncfusion Team July 24, 2020 01:26 PM UTC

Hi Barry, 

Thanks for contacting Syncfusion forum. 

Based on your reported information we suspect that you need to handle detail template actions in server side. But we unclear about your exact requirement so before proceed this please share the below details. 

1.  Explain your exact requirement briefly. 

2. Are you want trigger server side method when clicking expand icon. 

3. While expanding what kind of parameters need to sent client to server side. 

4. If possible share image representation and code snippets 

Please get back to us, if you need any further assistance. 

Regards, 
Thiyagu S  



BH Barry Hebbron July 24, 2020 05:01 PM UTC

1.    My requirements is to display in a grid only 4 columns of data.

(They happen to be SKU, plant name, form type and location – they are all strings – the row object does have an id but would be hidden from the user)  When the user clicks to the expand item, the requirements is to send a single argument to a web service ( form type : string ) the service does a calculation using this argument and returns back a single object with pricing details that has 4 properties. The prototype can be seen at http://pannebakkerupload.azurewebsites.net/readBatch click select for the detail.



TS Thiyagu Subramani Syncfusion Team July 27, 2020 01:54 PM UTC

Hi Barry, 
Thanks for your update. 
Based on your reported information we suspect that you want to render 4 columns and hided column(id field) in grid . So, when we click the expand icon we need to send that id to the corresponding web service link to server side and based on that id we need to show some details to server to client side. 
So, please confirm whether the above requirement that you are expecting at your end.   
Regards, 
Thiyagu S 


Marked as answer

BH Barry Hebbron July 27, 2020 01:59 PM UTC

Yes - your last statement is correct.




TS Thiyagu Subramani Syncfusion Team July 30, 2020 01:40 PM UTC

Hi Barry, 

Thanks for your update. 

Based on your reported information we have prepared sample as per your requirement like when clicking expand icon we send OrderID value to service link and based on that OrderID we have fetched details from server side and showed another view page. When clicking expand button detailDataBound event is triggered in client side and changed URL using by passing its required parameter value (args.data.OrderID) to that link like below code. 

function detailDataBound(args) { 
        args.cancel = true// prevented default actions 
        var OrderID = args.data.OrderID;   
        var url = "/GridEdit/Edit?OrderID=" + OrderID;  // Passed required value to link 
       location.assign(url); 
    } 


[EditController.cs] 
 
public ActionResult Edit(int OrderID) 
        { 
             // customize your code here.. 
            if (OrderID != 0) 
            { 
                BindDataSource(); 
                IEnumerable DataSource = order; 
                Dictionary<string, string> dictionary = new Dictionary<string, string>(); 
                var data = order.Where(or => or.OrderID ==  OrderID).FirstOrDefault(); 
                return View(data); 
            } 
            else if (OrderID == 0) 
                return View(); 
            return View(); 
        } 

Click the expand icon: 

 

 



Please get back to us, if you need any further assistance. 

Regards, 
Thiyagu S. 


Loader.
Up arrow icon