我想添加立即付款按钮,如 asp.net 中的有界 Gridview 所示。我用过如下
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="challanstatus"
Width="646px">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False"
ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="RegisNo" HeaderText="RegisNo"
SortExpression="RegisNo" />
<asp:BoundField DataField="Reason" HeaderText="Reason"
SortExpression="Reason" />
<asp:BoundField DataField="Code" HeaderText="Code" SortExpression="Code" />
<asp:BoundField DataField="DateofChallan" HeaderText="DateofChallan"
SortExpression="DateofChallan" />
<asp:BoundField DataField="Status" HeaderText="Status"
SortExpression="Status" />
<asp:BoundField DataField="Amount" HeaderText="Amount"
SortExpression="Amount" />
<asp:ButtonField ButtonType="Button" CommandName="Edit" Text="Edit" Visible="True" CommandArgument='<%# Container.DataItemIndex %>' />
</Columns>
</asp:GridView>
<asp:AccessDataSource ID="challanstatus" runat="server"
DataFile="~/App_Data/Database.mdb"
SelectCommand="SELECT * FROM [tblchallan] WHERE (([RegisNo] = ?) AND ([RegisNo] = ?))">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="RegisNo"
PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="DropDownList1" Name="RegisNo2"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:AccessDataSource>
我在哪里使用
<asp:ButtonField ButtonType="Button" CommandName="Edit" Text="Edit" Visible="True" CommandArgument='<%# Container.DataItemIndex %>' />
插入按钮,但它给出以下错误:
说明:解析服务此请求所需的资源时出错。请查看以下特定的解析错误详细信息并适当地修改您的源文件。
解析器错误消息:只有具有 DataBinding 事件的对象才支持数据绑定表达式。System.Web.UI.WebControls.ButtonField 没有 DataBinding 事件。