Last post Oct 26, 2018 02:53 AM by Fei Han - MSFT
Oct 25, 2018 03:19 AM|nac1234|LINK
<asp:Label ID="Label1" runat="server" Text="Label" CssClass="lblTextTitle">Company Name：</asp:Label><asp:TextBox ID="CpName" runat="server" Columns="45" Text="<%#dtDefault.Columns.IndexOf("CpName") %>" ></asp:TextBox>
In the above aspx code, the compile error like "The server tag is not correct" comes up when specifying by column name as following to get datarow object,
But if specifying by index as following, it successfully gets the datarow object.
My question is, is there any regulation that it can in aspx file comparing to axpx.vb file?
Thanks in advance.
Oct 25, 2018 12:16 PM|nac1234|LINK
I have been given the solution in an other site, it was all about the dboule quotation.it's been successfully done changing to first double quotation to single as Text='<%#dtDefault.rows(0)("CompName") %>'
Oct 26, 2018 02:53 AM|Fei Han - MSFT|LINK
Welcome to to ASP.NET forums.
changing to first double quotation to single as Text='<%#dtDefault.rows(0)("CompName") %>'
Glad to hear that you solve the problem by yourself, and thanks for sharing the solution to help other community members solve similar problems.
Besides, if we use Data-binding expressions create bindings between any property on an ASP.NET page, we need use the Page.DataBind or the Control.DataBind
method to bind the data to the data sources.