ASP.NET:如何使该表可编辑?
我一直在关注本教程: http://w3schools.com/aspnet/showasp.asp? filename=demo_repeater3
我已经能够完成本教程,但我想通过使该网格可编辑来将其提升到一个新的水平,但我不知道如何做到这一点。
有没有办法让网格可编辑?
<%@ Import Namespace="System.Data" %>
<script runat="server">
sub Page_Load
if Not Page.IsPostBack then
dim mycdcatalog=New DataSet
mycdcatalog.ReadXml(MapPath("cdcatalog.xml"))
cdcatalog.DataSource=mycdcatalog
cdcatalog.DataBind()
end if
end sub
</script>
<html>
<body>
<form runat="server">
<asp:Repeater id="cdcatalog" runat="server">
<HeaderTemplate>
<table border="0" width="100%">
<tr>
<th align="left">Title</th>
<th align="left">Artist</th>
<th align="left">Company</th>
<th align="left">Price</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%#Container.DataItem("title")%> </td>
<td><%#Container.DataItem("artist")%> </td>
<td><%#Container.DataItem("company")%> </td>
<td><%#Container.DataItem("price")%> </td>
</tr>
</ItemTemplate>
<SeparatorTemplate>
<tr>
<td colspan="6"><hr /></td>
</tr>
</SeparatorTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</form>
</html>
</body>
I have been following this tutorial: http://w3schools.com/aspnet/showasp.asp?filename=demo_repeater3
I have been able to complete this tutorial, but I wanted to take it to the next level by making this grid editable and I am not sure how to do this.
Is there a way to make the grid editable?
<%@ Import Namespace="System.Data" %>
<script runat="server">
sub Page_Load
if Not Page.IsPostBack then
dim mycdcatalog=New DataSet
mycdcatalog.ReadXml(MapPath("cdcatalog.xml"))
cdcatalog.DataSource=mycdcatalog
cdcatalog.DataBind()
end if
end sub
</script>
<html>
<body>
<form runat="server">
<asp:Repeater id="cdcatalog" runat="server">
<HeaderTemplate>
<table border="0" width="100%">
<tr>
<th align="left">Title</th>
<th align="left">Artist</th>
<th align="left">Company</th>
<th align="left">Price</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%#Container.DataItem("title")%> </td>
<td><%#Container.DataItem("artist")%> </td>
<td><%#Container.DataItem("company")%> </td>
<td><%#Container.DataItem("price")%> </td>
</tr>
</ItemTemplate>
<SeparatorTemplate>
<tr>
<td colspan="6"><hr /></td>
</tr>
</SeparatorTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</form>
</html>
</body>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
jQuery 怎么样?这里有一个很棒的插件:jQuery Grid。当您到达那里时,您想要寻找“编辑行”。
如果这不是您想要的,您应该考虑使用 GridView。
如果仍然不是您想要的,也许您应该使用到目前为止在教程中学到的内容手动尝试。
How about jQuery? There's a great plugin right here: jQuery Grid. When you get there, you want to look for Editing Rows.
If that is not what you're looking for, you should consider using GridView.
If still, that's not what you're looking for, maybe you should just try it manually with what you have learned so far in the tutorials.
或者,如果您不害怕尝试第三方 AJAX 网格,请考虑使用 Telerik one,它提供了大量的数据编辑功能等等。
Or if you are not afraid to experiment with third-party AJAX grids, consider using the Telerik one which offers a plethora of data editing capabilities and more.