如何在单击gridview中的按钮时触发RowCommand

时间:2016-04-08 10:25:35

标签: c# asp.net

font

如果我点击删除按钮fabric.loadSVGFromURL(img.src, function(objects, options) { var tmpobj = fabric.util.groupSVGElements(objects, options); canvas.setDimensions({ width : tmpobj.width, height : tmpobj.height }); //canvas.clear(); canvas.forEachObject(function(obj) { //var obj = new fabric.Object({ padding: 0 }); var obj = objects[i]; if (obj.get('type') == 'text') { var text = new fabric.IText('Tap and Type', { fontFamily : obj.get('fontFamily'), left : obj.get('left'), top : obj.get('top'), text : obj.get('text'), oCoords : obj.get('oCoords'), fontSize : obj.get('fontSize'), height : obj.get('height'), width : obj.get('width'), fill : obj.get('fill') }); obj = text; } obj.padding = 0; obj.setCoords(); canvas.add(obj); canvas.renderAll(); }); }) ,则会触发事件。如何通过单击“删除”按钮触发<asp:TemplateField HeaderText="Modify"> <ItemTemplate> <asp:Button ID="btnDelete" runat="server" Text="Delete" CommandName="Delete" CommandArgument='<%# ((GridViewRow)Container).RowIndex %>' > </asp:Button> </ItemTemplate> </asp:TemplateField> 事件我需要做什么?

1 个答案:

答案 0 :(得分:2)

在您的代码中,在'GrdView_RowCommand'事件中检查CommandName,如下所示,

protected void GrdView_RowCommand(object sender, GridViewCommandEventArgs e)
     {
       if (e.CommandName == "Delete")
          {
               //do something
          }
    }

Refer Link1

Refer Link2