Subject: cannot view the design of the .aspx page
Posted By: sansircar Post Date: 10/24/2006 1:27:59 PM
I have a datagrid column which goes as -

<asp:TemplateColumn HeaderText="New Inquiry Type">
    <ItemTemplate>
        <asp:Hyperlink ID="hplnkInquiryType" Runat="Server" text=<%#DataBinder.Eval(Container.DataItem,"investor name").ToString()%>>
        </asp:Hyperlink>
    </ItemTemplate>
</asp:TemplateColumn>

when i try to view the page in the design mode i get this error --

Could not open in Design View . Place quotes around a '<% %>' block used as an attribute value or within a <SELECT> element.

it works when i wrap the text attribute within 2 single quotes -
<asp:TemplateColumn HeaderText="New Inquiry Type">
    <ItemTemplate>
        <asp:Hyperlink ID="hplnkInquiryType" Runat="Server" text='<%#DataBinder.Eval(Container.DataItem,"investor name").ToString()%>>'
        </asp:Hyperlink>
    </ItemTemplate>
</asp:TemplateColumn>

but then the Hyperlink on the datagrid throws an error when clicked as - <some investor name> undefined
i.e. coz it needs the investor_name to be wrapped around single quotes.
thus the hyperlink works with the following code but no design view --
<asp:TemplateColumn HeaderText="New Inquiry Type">
    <ItemTemplate>
        <asp:Hyperlink ID="hplnkInquiryType" Runat="Server" text="'" + <%#DataBinder.Eval(Container.DataItem,"investor name").ToString() + "'" %>>
        </asp:Hyperlink>
    </ItemTemplate>
</asp:TemplateColumn>

Reply By: dparsons Reply Date: 10/24/2006 1:31:35 PM
Try this:

<asp:Hyperlink ID="hplnkInquiryType" Runat="Server" text='<%# Container.DataItem("Investor Name")%>' />

-------------------------
I will only tell you how to do it, not do it for you.  
Unless, of course, you want to hire me to do work for you.

^^Thats my signature

Go to topic 51379

Return to index page 140
Return to index page 139
Return to index page 138
Return to index page 137
Return to index page 136
Return to index page 135
Return to index page 134
Return to index page 133
Return to index page 132
Return to index page 131