Hi!

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

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

Thanks in advance

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.

http://msdn.microsoft.com/en-us/library/ms178135.aspx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.