We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Adding a button in dynamic templated column (depending on each row)

Hi,

  I want to customize add button in grid for each row.

3 Replies

SA Saravanan Arunachalam Syncfusion Team October 20, 2015 06:17 AM UTC

Hi Iswariya,

We analyzed your reported query and we suggest you to use Custom Command Column of Grid to customize the button in each row of Grid. Please refer to the following online sample link:

http://mvc.syncfusion.com/demos/web/grid/customcommand

We can also achieved your requirement using Template column property of Grid. Please refer to the following code example

@(Html.EJ().Grid<EmployeeView>("ColumnTemplate")

       

         . . .

        .ClientSideEvents(eve => {eve.TemplateRefresh("RefreshTemplate");})

        .Columns(col =>

        {

            . . .

            col.HeaderText("Details").Template("<input type = 'button' value ='Details'></input>").TextAlign(TextAlign.Center).Width(110).Add();           

        })

        )

<script type="text/javascript">

            function RefreshTemplate(args) {

                $(args.cell).find("input").ejButton({

                    click: function (e) {

                        alert("Details of the Row")

                    }

                })

            }

</script>

 

And also please refer to the following online documents.  

Online documents for Custom Command:

http://help.syncfusion.com/js/api/ejgrid#members:columns-commands

http://www.syncfusion.com/kb/aspnetmvc/grid?sortId=0&tags=commandbutton

http://www.syncfusion.com/kb/aspnet/grid?sortId=0&tags=commandbutton

http://www.syncfusion.com/kb/javascript/ejgrid?sortId=0&tags=command-column

Online documents for Template Column:

http://help.syncfusion.com/js/api/ejgrid#members:columns-template

http://help.syncfusion.com/js/api/ejgrid#members:columns-templateid

http://www.syncfusion.com/kb/aspnetmvc/grid?sortId=0&tags=templatecolumn

http://www.syncfusion.com/kb/aspnet/grid?sortId=0&tags=templatecolumn

Regards,

Saravanan A.



IS iswariya October 21, 2015 05:59 AM UTC

Thank you...





SA Saravanan Arunachalam Syncfusion Team October 22, 2015 10:17 AM UTC

Hi Iswariya,

Thanks for your update.          

We are happy that the provided information helped you.

Regards,

Saravanan A.


Loader.
Live Chat Icon For mobile
Up arrow icon