Use of Eval()

3 posts, 0 answers
  1. Andy Green
    Andy Green avatar
    342 posts
    Member since:
    Aug 2008

    Posted 22 Jul 2013 Link to this post

    Hi

    In all your example you use the Eval or Bind. I have just seen this article on why not to use Eval().

    http://www.codeproject.com/Articles/623516/The-evil-of-Eval-in-ASP-NET

    How would you bind data without using Eval or Bind.

    Andy
  2. Andrey
    Admin
    Andrey avatar
    836 posts

    Posted 25 Jul 2013 Link to this post

    Hello,

    In most of the articles of that subject is explained how you could replace the call to the DataBinder.Eval and Eval calls. The common scenario is to use the Container.DataItem property and cast it to the specific for your case type. For example:

    <telerik:GridTemplateColumn FilterControlAltText="Filter EditCommandColumn column" UniqueName="EditCommandColumn" HeaderStyle-Width="100px" ItemStyle-Width="100px" AllowFiltering="False" Groupable="False" DataField="City">
        <ItemTemplate>
            <%# ((System.Data.DataRowView)Container.DataItem)["City"] %>           
        </ItemTemplate>
    </telerik:GridTemplateColumn>

    Regards,
    Andrey
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Andy Green
    Andy Green avatar
    342 posts
    Member since:
    Aug 2008

    Posted 25 Jul 2013 Link to this post

    Excellent Thank you

    Andy
Back to Top