command button codebehind

Hi,
I have a need to display a set of records in a grid and by clicking on a button return the record to code behind and use it for something.
I have tried all the examples I have been able to find  and cannot get it to work. currently I can get the button click event  but no record data ...
Any help would be greatly apreciated !!

3 Replies

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team December 4, 2017 01:06 PM UTC

Hi Duncan,  
 
Thanks for contacting Syncfusion Support.  
 
We can achieve your requirement using the Command button and its respective server event. Refer to the following Help Pages and showcase demo on the command column.  
 
 
Refer to the following code example and its output. 
 
    <ej:Grid ID="EmployeesGrid" runat="server" AllowPaging="True" OnServerCommandButtonClick="OrdersGrid_ServerCommandButtonClick"> 
        <PageSettings PageSize="4"></PageSettings> 
        <Columns> 
                   . . . 
                         . . . 
              <ej:Column HeaderText="Employee Details" TextAlign="Center" Width="150">                     
                    <Command> 
                        <ej:Commands Type="detail"> 
                            <ButtonOptions Text="Details" Width="100"></ButtonOptions> 
                        </ej:Commands> 
                    </Command> 
                </ej:Column>   
        </Columns> 
    </ej:Grid> 
 
 
        protected void OrdersGrid_ServerCommandButtonClick(object sender, GridEventArgs e) 
        { 
 
            //code corresponding to any custom operation 
 
        } 
 
 
 
Regards,  
Seeni Sakthi Kumar S. 



TL Tom Lee replied to Seeni Sakthi Kumar Seeni Raj December 31, 2020 05:11 AM UTC

Hi Duncan,  
 
Thanks for contacting Syncfusion Support.  
 
We can achieve your requirement using the Command button and its respective server event. Refer to the following Help Pages and showcase demo on the command column.  
 
 
Refer to the following code example and its output. 
 
    <ej:Grid ID="EmployeesGrid" runat="server" AllowPaging="True" OnServerCommandButtonClick="OrdersGrid_ServerCommandButtonClick"> 
        <PageSettings PageSize="4"></PageSettings> 
        <Columns> 
                   . . . 
                         . . . 
              <ej:Column HeaderText="Employee Details" TextAlign="Center" Width="150">                     
                    <Command> 
                        <ej:Commands Type="detail"> 
                            <ButtonOptions Text="Details" Width="100"></ButtonOptions> 
                        </ej:Commands> 
                    </Command> 
                </ej:Column>   
        </Columns> 
    </ej:Grid> 
 
 
        protected void OrdersGrid_ServerCommandButtonClick(object sender, GridEventArgs e) 
        { 
 
            //code corresponding to any custom operation 
 
        } 
 
 
 
Regards,  
Seeni Sakthi Kumar S. 


Hi
I'm tried the post way,but is not work out,When I click button is not jump to break point 
My syncfusion Version is 18.4.0.30 
below is my code 



The video is debug video 

Attachment: Video_2020_12_31_13_05_14_578_1669bff.7z


PS Pon Selva Jeganathan Syncfusion Team January 4, 2021 12:18 PM UTC

Hi Tom Lee 
  
We have checked your reported problem by preparing sample but we are unable to reproduce the issue at our end.  
  

Refer to the sample Link:- 

https://www.syncfusion.com/downloads/support/forum/134867/ze/webform499718939 

 

Refer to the video demo: 

https://www.syncfusion.com/downloads/support/forum/134867/ze/command_click1670284543 

 

After following the above reference, still faced issue please share us the following details.  
  
1.       Complete  grid code example.  
2.       If possible, reproduce the reported issue in the shared sample Or share the issue reproducible sample.  
3.       Kindly share us issue replicating steps  
4.       Share the screenshot or video demonstrating the issue.  
The provided information will be helpful to provide you response as early as possible.  
  
Regards,  
Pon selva  



Loader.
Up arrow icon