Is it possible to select a grid row and get it top run some code to open another grid using parameters from the selected row ? Using VB.Net.
Is there an example
Regards,
John
Hi John Fleet,
Before proceeding this we need some more additional details about your requirement. Share us the following details.
Note:- We have already discussed about how tot select the rows at server end in our Syncfusion knowledge Base. You can convert this code into vb to select the rows.
https://www.syncfusion.com/kb/8276/how-to-get-selected-rows-data-in-code-behind
Based on the requested information we will provide you solution as early as possible.
Regards,
Farveen sulthana T
Hi Farveen, thank you for your reply.
In answer to your questions:
Do you want to select the rows and render Grid at server end itself or Client end?
I would like both options if possible please.
Screenshot/Video demonstrating your requirement.
enclosed!
Share us the purpose/detail explanation of your requirement.
To show another grid with details of a row selected on the first grid.
Do you want to select rows dynamically using button click or by clicking the row?
Click grid row.
Many thanks for our help
Rgds, John
Hi John,
Thanks for the update.
We have achieved your requirement by collecting the selected records from the "getSelectedRecords" method of grid in the client end "RowSelected" event of grid. Then we have assigned that value to the hidden element and accessed that value at server end using "OnServerRowSelected" server end event. In server end the selected values are stored in global variable through Server “RowSelected” event of Grid and set the second grid data source using this value .
Please refer to the below code snippet,
|
<asp:HiddenField ID="SelectRecords" ClientIDMode="Static" runat="server" /> >
//first grid <ej:Grid ID="DeficienciesGrid" runat="server" ClientIDMode="AutoID" OnServerRowSelected="FlatGrid_ServerRowSelected" > <ClientSideEvents RowSelected="rowSelect" /> .... </ej:Grid>
//secondgrid <ej:Grid ID="Grid1" runat="server" ClientIDMode="AutoID" ... </ej:Grid>
<script type="text/javascript"> function rowSelect(args) {
var record = this.getSelectedRecords(); //collecting the selected records $("#SelectRecords").val(JSON.stringify(record));
}
</script> </div> </div>
[Server End] Public Class _Default Inherits System.Web.UI.Page
Dim Shared selectedData 'global variable declaration
Protected Sub FlatGrid_ServerRowSelected(ByVal sender As Object, ByVal e As GridEventArgs) Dim ser As JavaScriptSerializer = New JavaScriptSerializer() Dim sel As List(Of OrderDetails) = ser.Deserialize(Of List(Of OrderDetails))(Me.SelectRecords.Value) selectedData = sel //here set the selected data into the second grid Grid1.DataSource = selectedData
End Sub End Class
|
Please refer to the below sample:
https://www.syncfusion.com/downloads/support/directtrac/general/ze/Rowselected2051271392
Please refer to the below API documentation:
https://help.syncfusion.com/api/js/ejgrid#methods:getselectedrecords
https://help.syncfusion.com/api/js/ejgrid#events:rowselected
Please refer to the below help documentation:
Kindly get back to us for further assistance.
Regards,
Pon selva