在Gridview的第一列中,我尝试放置一个图像按钮,该按钮执行自己的例程并打开另一个webform。我知道这应该通过点击事件来安排,所以我搜索了一些解决方案的例子。
我在书里找到了这个:
当在GridView.RowCommand控件中单击按钮时,会发生GridView事件。
下一段代码生成一个错误:
<asp:GridView ID="Grid" runat="server"
rowSelection="single"
AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" CellPadding="4" DataKeyNames="OID"
DataSourceID="SqlDataSource1"
ForeColor ="#333333" BorderColor="#CC9966" rderStyle="None"
BorderWidth="1px">
<AlternatingRowStyle BackColor="White"/>
<Columns>
<asp:ButtonField
commandname="Select"
ButtonType="Image"
ImageUrl ="~/Props/Pen.png"
onrowcommand="Pen_Click()"
/>错误:
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Type 'System.Web.UI.WebControls.ButtonField' does not have a public property named 'onrowcommand'.许多帝王,都来自泰国
发布于 2018-06-24 23:11:18
onrowcommand属于GridView itselt,而不是按钮。
<asp:gridview id="ContactsGridView"
onrowcommand="ContactsGridView_RowCommand"
runat="server">https://stackoverflow.com/questions/51006868
复制相似问题