[ batika @ 31.01.2009. 18:33 ] @
Treba da ispravim kod. Posto nikad nisam koristio asp.net ne znam kako da odradim... Treba da napravim da se Location 2 Address Street ne prikazuje ukoliko u bazi ne postoji vrednost za ovu kolonu. Vidim da <%# EVAL("Location2") %> daje vrednost iz baze, ali kad to stavim u if dobijam raznorazne greske. Dakle ukoliko u koloni Location2 nema nista ne treba da se pokazuje taj deo tabele. <%@ Page Language="VB" MasterPageFile="MasterPage.master" Title="Summer Camp Fair Calendar" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <div align="right"> <a href="http://gotsummercamp.blogspot.com" target="_blank">Blog</a> <a href="http://www.whatsupforkids.com/" target="_blank">What's Up For Kids</a> </div> <h4 class="marginFifteen"> Summer Camp Fair Calendar</h4> <p> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CampFairOnlineConnectionString %>" ProviderName="<%$ ConnectionStrings:CampFairOnlineConnectionString.ProviderName %>" SelectCommand="SELECT * FROM [Camps] WHERE (([CampEvent] = ?) AND ([ID] <> ?) AND ([WebsiteStatus] = ?) AND ([Active] = ?)) ORDER BY [CampDate], [CampTitle]"> <SelectParameters> <asp:Parameter DefaultValue="Fair" Name="CampEvent" Type="String" /> <asp:Parameter DefaultValue="13" Name="ID" Type="Int32" /> <asp:Parameter DefaultValue="Posted" Name="WebsiteStatus" Type="String" /> <asp:Parameter DefaultValue="Yes" Name="Active" Type="String" /> </SelectParameters> </asp:SqlDataSource> <asp:DataList ID="DataList1" runat="server" CellPadding="4" DataKeyField="ID" DataSourceID="SqlDataSource1" ForeColor="#333333" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" GridLines="Both" RepeatColumns="1" Width="600px"> <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <SelectedItemStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" /> <ItemTemplate> <table cellpadding="6" cellspacing="6" width="100%"> <tr> <td width="100"> </td> <td bgcolor="#003399"> <font color="white"><strong> <asp:Label ID="CampTitleLabel" runat="server" Text='<%# Eval("CampTitle") %>'></asp:Label></strong></font> </td> </tr> <tr> <td rowspan="24" align="left" valign="top" class="smalltext"> <img src="/uploaded/<%#Eval("ImageURL")%>" width="100" height="100" /><br /><br /> <img src="/uploaded/<%#Eval("ImageURL2")%>" width="100" height="100" /> </td> <td class="smalltext"> <strong>Camp Fair Date: </strong> <asp:Label ID="CampDateTimeLabel" runat="server" Text='<%# Eval("CampDate", "{0:M/dd/yyyy}") %>'> </asp:Label> </td> </tr> <tr> <td class="smalltext"> <strong>Camp Fair Time: </strong> <asp:Label ID="Label2" runat="server" Text='<%# Eval("CampTime") %>'> </asp:Label> </td> </tr> <tr> <td class="smalltext"> <strong> Location Street Address:</strong> <asp:Label ID="LocationLabel" runat="server" Text='<%# Eval("Location") %>'></asp:Label> </td> </tr> <tr> <td class="smalltext"> <strong> Location City:</strong> <asp:Label ID="LocationCityLabel" runat="server" Text='<%# Eval("LocationCity") %>'></asp:Label> </td> </tr> <tr> <td class="smalltext"> <strong> Location State:</strong> <asp:Label ID="StateLabel" runat="server" Text='<%# Eval("State") %>'></asp:Label> </td> </tr> <tr> <td class="smalltext"> <strong> Location Zip Code:</strong> <asp:Label ID="LocationZipCodeLabel" runat="server" Text='<%# Eval("LocationZipCode") %>'></asp:Label> </td> </tr> <tr> <td class="smalltext"> <strong> Location Map:</strong> <asp:Label ID="Label1" runat="server"></asp:Label> <asp:HyperLink Runat =server NavigateUrl ='<%# DataBinder.Eval(Container.DataItem, "LocationMap").ToString()%>' ID="Hyperlink2" Text="Click Here" Target="_blank"></asp:HyperLink> </td> </tr> <tr> <td class="smalltext"> <strong> Location Phone:</strong> <asp:Label ID="PhoneLabel" runat="server" Text='<%# Eval("Phone") %>'></asp:Label> </td> </tr> DAKLE OVDE BI TREBAO STAVITI IF ... <tr> <td class="smalltext"> <strong> Location 2 Street Address:</strong> <asp:Label ID="Location2Label" runat="server" Text='<%# Eval("Location2") %>'></asp:Label> </td> </tr> A OVDE ZAVRSITI <tr> <td class="smalltext"> <strong> Location 2 City:</strong> <asp:Label ID="Location2CityLabel" runat="server" Text='<%# Eval("Location2City") %>'></asp:Label> </td> </tr> <tr> <td class="smalltext"> <strong> Location 2 State:</strong> <asp:Label ID="Location2StateLabel" runat="server" Text='<%# Eval("Location2State") %>'></asp:Label> </td> </tr> <tr> <td class="smalltext"> <strong> Location 2 Zip Code:</strong> <asp:Label ID="Location2ZipCodeLabel" runat="server" Text='<%# Eval("Location2ZipCode") %>'></asp:Label> </td> </tr> <tr> <td class="smalltext"> <strong> Location 2 Map:</strong> <asp:Label ID="LabelMap2" runat="server"></asp:Label> <asp:HyperLink Runat =server NavigateUrl ='<%# DataBinder.Eval(Container.DataItem, "Location2Map").ToString()%>' ID="Hyperlink3" Text="Click Here" Target="_blank"></asp:HyperLink> </td> </tr> <tr> <td class="smalltext"> <strong> Location 2 Phone:</strong> <asp:Label ID="Location2PhoneLabel" runat="server" Text='<%# Eval("Location2Phone") %>'></asp:Label> </td> </tr> <tr> <td class="smalltext"> <strong> Location 3 Street Address:</strong> <asp:Label ID="Location3Label" runat="server" Text='<%# Eval("Location3") %>'></asp:Label> </td> </tr> <tr> <td class="smalltext"> <strong> Location 3 City:</strong> <asp:Label ID="Location3CityLabel" runat="server" Text='<%# Eval("Location3City") %>'></asp:Label> </td> </tr> <tr> <td class="smalltext"> <strong> Location 3 State:</strong> <asp:Label ID="Location3StateLabel" runat="server" Text='<%# Eval("Location3State") %>'></asp:Label> </td> </tr> <tr> <td class="smalltext"> <strong> Location 3 Zip Code:</strong> <asp:Label ID="Location3ZipCodeLabel" runat="server" Text='<%# Eval("Location3ZipCode") %>'></asp:Label> </td> </tr> <tr> <td class="smalltext"> <strong> Location 3 Map:</strong> <asp:Label ID="LabelMap3" runat="server"></asp:Label> <asp:HyperLink Runat =server NavigateUrl ='<%# DataBinder.Eval(Container.DataItem, "Location3Map").ToString()%>' ID="Hyperlink4" Text="Click Here" Target="_blank"></asp:HyperLink> </td> </tr> <tr> <td class="smalltext"> <strong> Location 3 Phone:</strong> <asp:Label ID="Location3PhoneLabel" runat="server" Text='<%# Eval("Location3Phone") %>'></asp:Label> </td> </tr> <tr> <td class="smalltext"> <strong> Contact:</strong> <asp:Label ID="ContactLabel" runat="server" Text='<%# Eval("Contact") %>'></asp:Label> </td> </tr> <tr> <td class="smalltext"> <strong>Website:</strong> <asp:Label ID="WebSiteLabel" runat="server"></asp:Label> <strong> <asp:HyperLink Runat =server NavigateUrl ='<%#"http://" + DataBinder.Eval(Container.DataItem, "WebSite").ToString()%>' ID="Hyperlink1" Text='<%#DataBinder.Eval(Container.DataItem, "WebSite").ToString()%>' Target="_blank"> <%#DataBinder.Eval(Container.DataItem, "WebSite")%> </asp:HyperLink> </strong> </td> </tr> <tr> <td class="smalltext"> <strong>Email: </strong> <asp:Label ID="EmailLabel" runat="server"></asp:Label> <strong> <asp:HyperLink Runat =server NavigateUrl ='<%#"mailto:" + DataBinder.Eval(Container.DataItem, "Email").ToString() + "?subject=information request"%>' ID="Hyperlink5"> <%#DataBinder.Eval(Container.DataItem, "Email")%> </asp:HyperLink> </strong> </td> </tr> <tr> <td class="smalltext"> <strong> Description: </strong> <asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("Description") %>'> </asp:Label> </td> </tr> </table> </ItemTemplate> <AlternatingItemStyle BackColor="White" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" /> <ItemStyle BackColor="#EFF3FB" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" /> <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <SeparatorStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" ForeColor="Black" /> <SeparatorTemplate> ------------------------------------------------------------------------------------------------------- </SeparatorTemplate> </asp:DataList> </p> </asp:Content> Hvala na pomoci. |