DataGrid上的“插入”按钮有什么意义 [英] What is the point of the Insert button on a DataGrid
本文介绍了DataGrid上的“插入”按钮有什么意义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果在创建DataGrid时,设置
< asp:commandfield showinsertbutton = true / >
您获得了一个插入内容每条记录旁边的按钮。这是如何运作的?单击它时,会调用后面的代码,但新记录的值只是单击按钮的行中的值,因此我看不出如何创建这样的新记录。 />
我必须在这里找不到简单的东西。
非常感谢解释(可能会阻止我疯了)。
亲切的愿望~Patrick
解决方案
参见来自给定链接的InsertCommand
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.commandfield.showinsertbutton(v = vs.110).aspx [ ^ ]
insertcommand = 插入[客户]([客户名称],[公司名称],[城市],[邮政编码],[国家])值(@CustomerID,@ CompanyName,@ City,@ PostCode,@ Country]
connectionstring = <%
ConnectionStrings:NorthWindConnectionString%>
runat = 服务器跨度>>
Hi,
If when creating a DataGrid, you set the
<asp:commandfield showinsertbutton="true" />
you get an insert button next to each record. How does this work? When you click it, the code behind is called, but the values for the new record are simply the ones from the row in which the button was clicked, so I don't see how you can create a new record like this.
I must be missing something simple here.
An explanation would be very much appreciated (and may stop me going insane).
Kind wishes ~ Patrick
解决方案
See InsertCommand from the given link
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.commandfield.showinsertbutton(v=vs.110).aspx[^]
insertcommand="Insert Into [Customers]([CustomerID], [CompanyName], [City], [PostalCode], [Country]) Values (@CustomerID, @CompanyName, @City, @PostalCode, @Country)" connectionstring="<%
ConnectionStrings:NorthWindConnectionString%>" runat="server">
这篇关于DataGrid上的“插入”按钮有什么意义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文