Iam new with this, and trying to explore and understand the ASP.NET C#.
I got a little bit problem regarding control statement specifically using the if statement. What I really wanted is to have two options in navigating windows page. For example, if the other column name "Remarks" is not null, I want the user to view this page name "<%# ("Detail1.aspx?sid=" + Eval("SysID")) %>'" else
<%# ("Detail2.aspx?sid=" + Eval("SysID")) %>'.
How can I apply the if condition within the code as shown below.

            <asp:TemplateField HeaderText="Mode">
                    <asp:HyperLink ID="lnkTrainings" runat="server" 
                        NavigateUrl='<%# ("Detail1.aspx?sid=" + Eval("SysID")) %>'
                        Target="_blank" Text="View"></asp:HyperLink>
                <ItemStyle HorizontalAlign="Center" Width="50px" />
                <HeaderStyle HorizontalAlign="Center" />

Do I really need to apply the condition in asp.net or in C#.?

Thanks in advance

Edited by mherz

3 Years
Discussion Span
Last Post by JorgeM

Do I really need to apply the condition in asp.net or in C#

So to clarify, asp.net is a framework. C# is one of the many languages that target the .NET Framework.

Ok, so if you want to use a code nugget, or Embedded Code Block within your aspx page, you can do so easily. I'd recommend you take a look at this MSDN article as their are good examples there. You can have the conditional statement within the code block, or you can call a function from the code block.


This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.