locked
how to use if else in eval using Repeater RRS feed

  • Question

  • Hi,

    i am using Repeater Control . I want to apply if else condition with "and && " Operator

    currently i am doing like this

     <% if(string.IsNullOrEmpty(Convert.ToString(Eval("ProgramName"))) &&
                                                          (!string.IsNullOrEmpty(Convert.ToString(Eval("ProjectNameEnglish")))))
                                                        { Eval("ProjectNameEnglish"); }
                                                        else
                                                        { DateTime.Now.ToString(); }

                                                    %>

    Its giving me error..


    Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.

    How to solve this .Kindly Help me out

    Thanks

    Monday, August 28, 2017 12:05 PM

All replies

  • Hi,

    As Repeating control is more related to .NET Framework, I would suggest you can create a new thread in .NET forum, you will get more detailed information from there and more experts there will help you:

    https://forums.asp.net/

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Tuesday, August 29, 2017 7:50 AM