2016-11-08 53 views
0

內部網格視圖圖像按鈕不是使用ASP.NET Web表單觸發的。如果我將使用ASP Button,然後工作Button並輕鬆添加。內部網格視圖圖像按鈕不是使用ASP.NET Web表單觸發

下面是我設計的網格視圖代碼Button。

<FooterTemplate> 
<asp:ImageButton ID="imgbtnAdd" runat="server" CommandName="AddNew" ImageUrl="~/Imgs/grid_add.png" ToolTip="click here to add" CausesValidation="true" ValidationGroup="Team_involved_directly" /> 
<%-- <asp:Button ID="Button1" runat="server" Text="Add" CommandName="AddNew" CausesValidation="true" ValidationGroup="Team_involved_directly" ToolTip="click here to add" />--%> 
</FooterTemplate> 

如果我將使用上面的註釋按鈕,然後工作正常,但圖像按鈕只給問題。我還在頁面加載中使用了!Page.IsPostBack

+0

你添加到gridview事件「OnRowCommand」?添加了像是OnRowCommand =「Gridview1_RowCommand」的 –

+0

。 @mww – MMK

+0

其他命令觸發這個事件只是這個按鈕不是? –

回答

-1

您是否試過按鈕標籤的'OnClick'方法?

+1

爲什麼我應該使用OnClick,而我正在使用CommandName =「AddNew」na。 @Keshav_Nandhan – MMK

+0

對不起,我錯了,所以你使用像event.commandname ==「」? –

+0

我也會試試@MMK –