2014-10-31 79 views
0

我想弄清楚爲什麼我在下面的代碼中得到的服務器標籤不是很好形成的錯誤。 61號線。 任何解釋將不勝感激。服務器標籤格式不正確錯誤ASP.NET

 <td> 
         <asp:Label ID="lblPharmName" runat="server" Text='<%# Eval("p.Pharm_fname + ' ' + p.Pharm_lname") %>'> 
         </asp:Label>       
        </td> 

代碼的完整頁面如下:

 <%@ Page Language="VB" MasterPageFile="~/CIOSMasterNonAuth.master" AutoEventWireup="false" CodeFile="ViewOrders.aspx.vb" Inherits="ViewOrders" title="Untitled Page" %> 

    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> 

    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> 
    <%--<asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>--%> 
    <asp:Table runat="server" Font-Size="Small" HorizontalAlign="Center"> 
    <asp:TableRow> 
    <asp:TableCell HorizontalAlign="Right"> 
    <asp:Label runat="server">Order Status: </asp:Label> 
    </asp:TableCell> 
    <asp:TableCell HorizontalAlign="Left"> 
    <asp:DropDownList ID="OrderStatusDropDownList" runat="server" AutoPostBack="True"> 
     <asp:ListItem Text="Verified" Value="V" /> 
     <asp:ListItem Text="New" Value="N" /> 
     <asp:ListItem Text="Cancelled" Value="C" /> 
     </asp:DropDownList> 
     </asp:TableCell> 
     </asp:TableRow> 
    <asp:TableRow> 
    <asp:TableCell ColumnSpan="2"> 
     <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1"> 
     <HeaderTemplate> 
       <table border="1" visible="false"> 
        <tr> 
         <th> 
          Web Order ID 
         </th> 
         <th> 
          Web Entry Date 
         </th> 
         <th> 
          Protocol Number 
         </th> 
         <th> 
          Site Number 
         </th> 
         <th> 
          Pharmacist of Record 
         </th> 
        </tr> 
      </HeaderTemplate> 
      <ItemTemplate> 
       <tr> 
        <td> 
         <asp:LinkButton runat="server" ID="lnkOrderDetails" Text='<%# Eval("web_order_id") %>' OnClick="lnkOrderDetails_Click" /> 
        </td> 
        <td> 
         <asp:Label ID="lblWebEntryDate" runat="server" Text='<%# Eval("web_entry_date") %>'> 
         </asp:Label> 
        </td> 
         <td> 
         <asp:Label ID="lblProtocolNum" runat="server" Text='<%# Eval("protocol_num") %>'> 
         </asp:Label> 
        </td> 
        <td> 
         <asp:Label ID="lblSiteNum" runat="server" Text='<%# Eval("site_num") %>'> 
         </asp:Label> 
        </td> 
        <td> 
         <asp:Label ID="lblPharmName" runat="server" Text='<%# Eval("p.Pharm_fname + ' ' + p.Pharm_lname") %>'> 
         </asp:Label>       
        </td> 

       </tr> 
       </ItemTemplate> 
       <FooterTemplate> 
        </table> 
        </FooterTemplate> 
      </asp:Repeater> 
      </asp:TableCell> 
      </asp:TableRow> 
     </asp:Table> 

     <asp:Button runat="server" ID="btnShowModalPopup" style="display:none"/> 
      <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" 
      TargetControlID="btnShowModalPopup" 
      PopupControlID="divPopUp" 
       PopupDragHandleControlID="panelDragHandle"> 
    </cc1:ModalPopupExtender> 

     <div id="divPopUp" style="display:none; font-family:Georgia; font-size:small;"> 
                                 <asp:Panel runat="Server" ID="panelDragHandle" BackColor="#009999" BorderColor="ActiveBorder" BorderStyle="Ridge" ForeColor="White" Width="800px"> 
    <table width="100%"> 
    <tr> 
    <td> 
     Hold here to Drag this Box 
     </td> 
     <td align="right"> 
    <asp:Label runat="server" ID="lblText" Text="Web OrderID: " ForeColor="White"></asp:Label> 

    <asp:Label ID="lblWebOrderID" runat="server"></asp:Label> 
    </td> 
    </tr> 
    <tr> 
    <td colspan="2"> 
    <asp:GridView ID="GridView2" runat="server" BackColor="#FFFFCC" ForeColor="Black" AutoGenerateColumns="False" Width="100%" > 

    <Columns> 
    <asp:BoundField DataField="line_id" HeaderText="Line Item"/> 
    <asp:BoundField DataField="no_of_participants" HeaderText="Number of Participants" /> 
    <asp:BoundField DataField="amt_inventory" HeaderText="Current Inventory"/> 
    <asp:BoundField DataField="nsc_num" HeaderText="NSC number"/> 
    <asp:BoundField DataField="drug_name" HeaderText="Drug name"/> 
    <asp:BoundField DataField="dose_str" HeaderText="Dose Strength"/> 
    <asp:BoundField DataField="dose_unit" HeaderText="Dose Unit"/> 
    <asp:BoundField DataField="dose_form_comment" HeaderText="Dose Form"/> 
    <asp:BoundField DataField="dose_mult" HeaderText="Dose Mult" /> 
    <asp:BoundField DataField="amt_req" HeaderText="Amt Required"/> 
    </Columns> 
    </asp:GridView> 
    </td> 
    </tr> 
    <tr> 
    <td colspan="2" align="right">      
    <asp:Button ID="btnClose" runat="server" Text="Close" /> 
    </td> 
    </tr> 
    </table> 
    </asp:Panel> 
    <br /> 

</div> 

<% 
    Response.AddHeader("Refresh", "60") 
%> 
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CIOSConnectionString3 %>" 


     SelectCommand="SELECT w.web_order_id, w.web_entry_date, w.site_num, w.protocol_num, w.inv_num, w.pharm_num, w.status, w.Comments, w.UserName, w.porStatus, p.Pharm_fname + ' ' + p.Pharm_lname AS 'PharmName' FROM Web_Shipping AS w INNER JOIN Pharmacist_of_record AS p ON p.pharm_num = w.pharm_num WHERE (w.status = @status) ORDER BY w.web_order_id DESC" > 
     <SelectParameters> 
      <asp:ControlParameter ControlID="OrderStatusDropDownList" Name="Status" 
       PropertyName="Text" Type="Char" /> 
       </SelectParameters> 
     </asp:SqlDataSource> 

                            <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:CIOSConnectionString3 %>" 

     SelectCommand="SELECT Web_Ship_detail.line_id, Web_Ship_detail.no_of_participants, Web_Ship_detail.Amt_inventory, Web_Ship_detail.NSC_num, Web_Ship_detail.Dose_str, Web_Ship_detail.Dose_unit, Web_Ship_detail.Dose_mult, Web_Ship_detail.amt_req, Drug.Drug_name, Dosage_Form.dose_form_comment FROM Web_Ship_detail INNER JOIN Drug ON Web_Ship_detail.NSC_num = Drug.NSC_Num INNER JOIN Dosage_Form ON Web_Ship_detail.Dose_form = Dosage_Form.dose_form WHERE (Web_Ship_detail.web_order_id = @web_order_id) ORDER BY Web_Ship_detail.line_id"> 
     <SelectParameters> 
      <asp:ControlParameter ControlID="lblWebOrderID" Name="web_order_id" 
       PropertyName="Text" Type="Decimal" /> 
     </SelectParameters> 

    </asp:SqlDataSource> 



    enter code here 
    </asp:Content> 

回答

1

可以用雙取代你的單引號爲單引號是開始,像作爲字符串 的結尾:

<asp:Label ID="lblPharmName" runat="server" Text='<%# Eval("p.Pharm_fname " + "p.Pharm_lname") %>'> 
        </asp:Label>  
+0

我得到了同樣的錯誤,這對我來說是訣竅。我仍然想知道爲什麼標準的雙引號無法正確匹配和解析,但這確實解決了錯誤。我懷疑這只是框架中的一些弱解析/匹配邏輯。 – JMD 2015-05-27 17:08:52