为什么buttonfield不起作用?

时间:2015-08-23 21:57:52

标签: c# asp.net .net gridview

我已将buttonfield放在gridview中。它命中了rowcommand事件并且到了块结束但是没有做它应该做的事情。它应该将文本分配给文本框并通过response.write显示消息但不是。在调试器中,它完美地将文本分配给文本框并转到消息,但在接口端没有任何内容。为什么?

# iso-8859-1 better known as latin-1 to convert your 'key' to unicode
keys = self.mot.strip().split(self.sep)
for key in map(lambda x: unicode(x, encoding="iso-8859-1"), keys):

事件:

<asp:GridView runat="server" ID="grdviewContractorTypes" OnRowCommand="grdviewContractorTypes_RowCommand" DataKeyNames="pk_ContractorTypes_ContractorTypeID" AutoGenerateColumns="false" CssClass="table table-condensed table-bordered table-striped table-responsive">
                                        <Columns>
                                            <asp:BoundField DataField="pk_ContractorTypes_ContractorTypeID" HeaderText="ID" />
                                            <asp:BoundField DataField="ContractorTypeName" HeaderText="Contractor Type" />
                                            <asp:ButtonField CommandName="edit" ImageUrl="~/assets/global/images/shopping/edit.png" ButtonType="Image" ControlStyle-Width="25px" ControlStyle-Height="25px" />


                                        </Columns>
                                    </asp:GridView>

它没有做任何事情,显然是在调试器中显示和分配。为什么?

1 个答案:

答案 0 :(得分:0)

尝试将OnRowEditing添加到网格中。

public class Player {

private GameView view;

private Bitmap bmp;
public int x, y;

public Player(GameView view) {
    this.view = view;

}

public void tick() {

//This is my error here//
    bmp = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);

}

public void onDraw(Canvas c) {
    c.drawBitmap(bmp, x, y, null);
}

}

代码背后:

<asp:GridView runat="server" ID="grdviewContractorTypes" OnRowEditing="grdviewContractorTypes_RowEditing" OnRowCommand="grdviewContractorTypes_RowCommand" DataKeyNames="pk_ContractorTypes_ContractorTypeID" AutoGenerateColumns="false" CssClass="table table-condensed table-bordered table-striped table-responsive">
            <Columns>
                <asp:BoundField DataField="pk_ContractorTypes_ContractorTypeID" HeaderText="ID" />
                <asp:BoundField DataField="ContractorTypeName" HeaderText="Contractor Type" />
                <asp:ButtonField CommandName="edit" ImageUrl="~/assets/global/images/shopping/edit.png" ButtonType="Image" ControlStyle-Width="25px" ControlStyle-Height="25px" />


            </Columns>
        </asp:GridView>