0

I try to use the update panel with my datagridview on the rowcommand event to show a dialog box. when i remove the the update panel it works fine , but withit it does not work.

I tried it the following configuration with the update panel, but it does not work.

<asp:UpdatePanel ID="UpdatePaneldgv" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
 <Triggers >
 <asp:AsyncPostBackTrigger ControlID="dgvVehiclesType" EventName ="RowCommand" />
 </Triggers>
<ContentTemplate>                
<div class="tab-content">
 <div class="tab-pane fade in active">
 <asp:GridView ID="dgvVehiclesType" runat="server" GridLines="None" OnRowCommand="dgvVehiclesType_RowCommand" PageSize="10">
 <Columns>
 <asp:BoundField DataField="OptionID" HeaderText="# ID" ReadOnly="True"/>
 <asp:BoundField DataField="OptionName" HeaderText="Name" ReadOnly="True" />
 <asp:ButtonField ButtonType="Image" CommandName="cmdEdit" ImageUrl="~/img/view.png" />
 </Columns>
 </asp:GridView>
 </div>
 </div>
 </ContentTemplate>
 </asp:UpdatePanel>

Rowcommand back end event

 switch (e.CommandName)
        {
            case "cmdEdit":
                //  show form            
ClientScript.RegisterStartupScript(GetType(), "Show", "<script> $('#formModal').modal('toggle');</script>");
                break;
            default:
                break;
        }

any suggestion ?? or reference

Jmocke
  • 269
  • 1
  • 10
  • 20

1 Answers1

0

I do not see any <asp:Button /> in your GridView. The RowCommand method occurs when a button is clicked in a GridView control.

Furthermore, you don't have to use Triggers for that, you can delete these lines.

Could we see your RowCommand method in the code-behind ? It should look like that :

public void dgvVehiclesType_RowCommand (object sender, EventArgs e)
{
  //do something
}

Hope it helps.

dramixx
  • 284
  • 3
  • 15
  • i dont know if i am doing the wrong thing but with ` ` i have a button that i can clicked and it occurs at the rowcommand event. i also edited the code. – Jmocke Oct 28 '14 at 14:47
  • So you successed ? That's why you want isnt it ? – dramixx Oct 28 '14 at 16:02
  • You said "i have a button that i can clicked and it occurs at the rowcommand event" – dramixx Oct 28 '14 at 16:49