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
close icon

Grid Row as a link

Good day!Can I bind go to some generated Url (for example: @Action.Url("GetFileInfo", "Files", {{:FileID}})) when user clicks on Grid row

3 Replies

PK Prasanna Kumar Viswanathan Syncfusion Team July 7, 2017 03:26 PM UTC

Hi John, 

Thanks for contacting Syncfusion support. 

Before we proceed with your query, we need some clarifications. 

1. Do you need to bind Generated URL for particular column or row?. If you need to place the hyperlink in grid cells, use the below KnowledgeBase documentation.  


2. According to your query when you click on the row you need to move to the generated URL with value of any of the column. 

3. Share the screenshot of your requirement.   

Regards, 
Prasanna Kumar N.S.V 



JO John July 8, 2017 06:33 AM UTC

Hi, Prasanna Kumar N.S.V !

I need to bind generated url to row in Grid, every row have a unique url, but url generating pattern is the same @Action.Url("GetFileInfo", "Files", {{:FileID}}) and only FileID property changes in every row url.

You're right, I you need to move to the generated URL with value of any of the column when I click on the row



PK Prasanna Kumar Viswanathan Syncfusion Team July 10, 2017 06:44 PM UTC

Hi John, 

Thanks for the update. 

To achieve your requirement, use rowTemplate feature of ejGrid. Row template enables you to set the customized look and behavior to grid all rows. Using rowTemplate feature we bind the generated url row to Grid. When we click on the row it will move to the generated URL with the value of an column. 
 
Find the code example and sample:  
 

@(Html.EJ().Grid<object>("HierarchyGrid") 
     .Datasource((IEnumerable<object>)ViewBag.datasource) 
     
     .AllowPaging() 
     .RowTemplate("#templateData") 
     .Columns(col => 
      { 
          col.HeaderText("Photo").Width(10).Add(); 
               
      }) 
) 
 
 
<script id="templateData" type="text/x-jsrender"> 
    <tr> 
         
        <td class="details"> 
            <table class="CardTable" cellpadding="3" cellspacing="2"> 
                <colgroup> 
                    <col width="10"> 
                   
                </colgroup> 
                <tbody>                 
                    <tr> 
                        <td> 
                            <a rel='nofollow' href="/Grid/RowTemplate?OrderID={{:EmployeeID}}">EmployeeID</a> 
                        </td> 
                    </tr> 
                </tbody> 
            </table> 
        </td> 
    </tr> 
</script> 


Refer to the Help document for the rowTemplate. 


If we misunderstood your query, please get back to us. 

Regards, 
Prasanna Kumar N.S.V 


Loader.
Live Chat Icon For mobile
Up arrow icon