我对此很陌生,所以我不明白这里有什么问题。
我在 gridview 的列中创建了带有事件的按钮,以通过传递 gridview 行项参数重定向到另一个 Web 表单。我收到这个错误
Cannot perform '=' operation on System.Int32 and System.String.
protected void gvAccommodations_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Open")
{
int Id = Convert.ToInt32(e.CommandArgument);
Response.Redirect("~/Rooms.aspx?Id=" + Id);
}
}
<asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id">
</asp:BoundField>
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="btnOdaberi" runat="server" Text="Odaberi"
CommandName="Open" CommandArgument='<%# Bind("Id") %>'/>
</ItemTemplate>
</asp:TemplateField>