Grid Column data Bind

2 posts, 0 answers
  1. Mostafa
    Mostafa avatar
    4 posts
    Member since:
    Oct 2015

    Posted 21 Mar 2016 Link to this post

    i have a grid and in that Grid i have a column name 'Result' which Show data like 6-5,10-11 etc
    i have two way to make that 
    1. select Set1 ,Set2   from table1

    and then in grid 
     <telerik:GridTemplateColumn >
     <%# Eval("Set1")+" -"+Eval("Set2") +","+'<sup>'+Eval("Set1")+'</sup>'+" -"+Eval("Set2") %>
    </telerik:GridTemplateColumn >

    2. i can return a field named 'result' from my data query store procedure like '(select ISNULL(CAST( Set1 as nvarchar(5)),'') +''+ ISNULL('-'+CAST(Set2 as nvarchar(5))+''+ISNULL('<sup>'+CAST(Set3 as nvarchar(5))+'</sup>','')'')  as result  from table1' which give me 6-5,10-11

    and in grid 
    <telerik:GridBoundColumn UniqueName="Result" DataField="result" > </telerik:GridBoundColumn>

    my Question is which one is better if the total number of set is 15.and number of row in result set more then 100

  2. Konstantin Dikov
    Konstantin Dikov avatar
    2466 posts

    Posted 24 Mar 2016 Link to this post

    Hi Mostafa,

    Adding the data directly to the DataSource of the grid would be faster, because no calculations will be performed while the ItemTemplate is being created. However, at the end it is up to the developer to choose the approach that best fits the requirement.

    On a side note, you could take a look at the GridCalculatedColumn, which could be used for displaying calculated data:
    Hope this helps.

    Konstantin Dikov
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top