Conditional logic in ItemTemplate

I'm sure this is way easier than I'm making it out to be, but I'm stuck...  I'm using a grid control by Obout - it's very similar to the asp.net grid.  In the Item template (called GridTemplate in this control), I want to truncate a time value.  In the database the time is stored as 01:01.123.  I simply want to display 01:01

I use the Substring function to do this, but it will bomb if there is no time value.  So how do I check that within a GridTemplate?  It doesn't recognize the Container object when I use it in my If statement.  Please advise.  

The code below obviously did work -

Thanks -

Justin
<cc1:GridTemplate runat="server" ID="tmpDuration">
                    <Template>
                        <% if ( Container.Value.Length > 4){ %>
                            <%# Container.Value.Substring(0, 5)%> 
                        <%}%>
                    </Template>
                </cc1:GridTemplate>

Open in new window

JT_SIROAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
lazyberezovskyConnect With a Mentor Commented:
You can use ?: operator
 <Template>
 <%# ( Container.Value.Length > 4) ?  Container.Value.Substring(0, 5) : Container.Value %>                      
</Template>
0
All Courses

From novice to tech pro — start learning today.