ASP.NET的GridView服务器标签不规范 [英] ASP.NET Gridview the server tag is not well formed

查看:264
本文介绍了ASP.NET的GridView服务器标签不规范的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是试图让我的GridView的编辑,这将填充数据库中的数据。
当我的程序启动时,它会连接到数据库并用数据填充GridView控件。
现在,我想它来编辑数据。
但是,当我开始我PROGRAMM,我得到的错误服务器标记的格式不正确。
当然,我在寻找一些解决方案和最常见的错误是,认为来代替'',但我已经在使用''。

i'm just trying to make my gridview editable, which will be filled with data from the database. When my program starts, it will connect to the database and fill the gridview with data. Now i want to edit the data in it. But when i start my programm, i get the error "the server tag is not well formed." Of course i'm looking for some solutions and the most common mistake was, that "" was used instead of '', but i'm already using ''.

下面是我的code:

<asp:GridView ID="griddb" runat="server" AutoGenerateEditButton="True" 
CellPadding="4" EnableModelValidation="True" ForeColor="#333333" 
GridLines="None">
<AlternatingRowStyle BackColor="White" />
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
<Columns>

<asp:TemplateField HeaderText="Name" ><ItemTemplate>
<%#Eval("lastname")%></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="textbox1"runat="server"Text='<%#Eval("lastname")%>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>

</Columns>
</asp:GridView>

下面的代码片段被标记为错误:

following snippet is marked as the error:

<asp:TextBox ID="textbox1"runat="server"Text='<%#Eval("lastname")%>'>

在此先感谢

推荐答案

这句话服务器和文本必须在标签它们之间的空间。实际上,大多数标记的需要在元件之间加入间隔。因此,尝试这个标签来代替,请注意我已经添加了标签内的元素之间的一些空间。

The words Server and Text need a space between them in the tag. Actually, most of the tag needs spacing added between the elements. So try this tag instead, note I've added some spaces between elements within the tag.

<asp:TextBox ID="textbox1" runat="server" Text='<%#Eval("lastname")%>'>

这篇关于ASP.NET的GridView服务器标签不规范的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆