I have a grid view.
<asp:GridView AutoGenerateDeleteButton="false" AutoPostBack="true" OnRowCommand="gwDeleteNAV_RowCommand" OnRowCreated="gwDeleteNAV_OnRowDataBound" OnRowDeleting="DeleteButtonClick" ID="gwDeleteNAV" runat="server" AllowSorting="true" AutoGenerateColumns="False" Width="557px" OnRowDataBound="gwDeleteNAV_OnRowDataBound">
<AlternatingRowStyle BackColor="White" Font-Names="Verdana" Font-Size="Medium" HorizontalAlign="Left" />
<EmptyDataRowStyle BackColor="#EFF3FB" Font-Names="Verdana" Font-Size="Small" HorizontalAlign="Left" />
<rowstyle Height="30px" />
<alternatingrowstyle Height="30px"/>
<HeaderStyle Height="30px" BackColor="#999999" Font-Bold="True" Font-Names="Verdana" Font-Size="10pt"
ForeColor="White" />
<Columns>
<asp:BoundField DataField="Tranid" HeaderText="Id"></asp:BoundField>
<asp:BoundField DataField="FundName" HeaderText="Fund Name"></asp:BoundField>
<asp:BoundField DataField="value" HeaderText="Price"></asp:BoundField>
<asp:BoundField DataField="date" HeaderText="Date"></asp:BoundField><asp:TemplateField HeaderText="">
<ItemTemplate>
<asp:LinkButton ID="lnkDelete" Text="Delete" AutoPostBack="true" OnCommand="lnkDelete_Command" runat="server" OnClientClick="return DeleteConfirmation();"
CommandArgument='<%#Eval("TranId")%>' ></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField></Columns>
<SelectedRowStyle BackColor="#507CD1" />
<PagerStyle BackColor="#999999" />
</asp:GridView>
on server side I am handling link button event as follows:
protected void lnkDelete_Command(object sender, CommandEventArgs e)
{
string transactionid = e.CommandArgument.ToString();
DeleteNAVData(transactionid);
}
Page_Load Event:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
FillDropDown();
}
}
Issue I am facing here is, when I click Delete link from UI, It doesn't fire lnkDelete_Command but shows the javascript alert. When I click second time again, It fires the lnkDelete_command Event. any Idea why my code is not calling event at first go.
Regards,