BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
Hi Robson
We have analyzed the reported query.
Since we don’t have inbuilt support for performing server
side event for custom command, we have logged a feature request. This feature “Need server side event for custom command”
will be implemented in any of our feature release.
Thus we suggest you to use the following workaround and also
to use columnTemplate feature
in order to bind a button to the grid rows.
Based on your requirement to get the details of the selected
record in the button click event, we have created a simple sample and the same
can be downloaded from the following location.
Sample Link: http://www.syncfusion.com/downloads/support/directtrac/general/Sample-380243146.zip
In the above sample, we have explicitly triggered the recordClick
event and have passed the arguments for the event in the click event of
the button. Please refer the below code snippet.
<ej:Grid ID="OrdersGrid" runat="server" AllowPaging="True" RecordClick="RecordClick"
OnServerRecordClick="onClick"> <Columns>
. . .
<ej:Column HeaderText="Details" Template="true" TemplateID="#buttonTemplate" TextAlign="Center" Width="75"/>
Columns> ej:Grid> <script type="text/x-jsrender" id="buttonTemplate">
<button class="Details" name="Details">Detailsbutton> script> <script type="text/javascript">
$(function () {
$(".Details").ejButton();
$(".Details").click(function (e) {
triggerEvent(e);
});
});
function triggerEvent(e) {
var obj =
$("#OrdersGrid").data("ejGrid");
var args = { currentTarget: e.currentTarget.name,
selectedRecord: obj.getSelectedRecords(), selectedIndex: obj.model.selectedRowIndex
};
obj._trigger("recordClick", args);
}
script> [In Code Behind] protected void onClick(object Sender, GridEventArgs e)
{
var
currentTarget = e.Arguments["currentTarget"];
var
selectedRecord = e.Arguments["selectedRecord"];
var
selectedIndex = e.Arguments["selectedIndex"];
} |
Query: “I also wanted to let you know that I have
extensively searched for something like this in all your online documentation,
but didn't find anything for asp.net, there is indeed something for windows
form but not for asp.net”
We have created a KB document for the above mentioned
requirement and it will be published online tentatively by October 1,2014.
Please get back to us if you need any further assistance.
Regards
Ragavee U S