hello all,
I have a datagrid which is displayed in my module.It has both edit and delete columns.I need to know how can i get a pop up and fire the event parallely.i Am attaching the code
<asp:datagrid id=lstCompetencies AutoGenerateColumns="false" width="100%" DataKeyField="CompetencyId"CellPadding="4" GridLines="Both" cssclass="DataGrid_Container" Runat="server" BackColor="white">
<columns>
<dnn:textcolumn datafield="CompetencyName" headertext="Competency" />
<dnn:textcolumn datafield="CatogeryName" headertext="Catogery"/>
<dnn:textcolumn datafield="StatusName" headertext="Status"/>
<asp:TemplateColumn HeaderText="Edit">
<itemtemplate>
<asp:HyperLink id="EditCompetency" ImageUrl="~/images/edit.gif" NavigateUrl='<%# EditURL("CompetencyId",DataBinder.Eval(Container.DataItem,"CompetencyId"),"EditCompetency") %>' Visible="<%# IsEditable %>" runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Delete">
<itemtemplate>
<asp:ImageButton ID="btnDelete" CommandName="Delete" ImageUrl="~/images/delete.gif" runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
</Columns></asp:datagrid>
the back end code is like
Protected Sub Delete_Competency(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
Dim CompetencyId As
Integer
CompetencyId = lstCompetencies.DataKeys.Item(e.Item.ItemIndex)
If Not Null.IsNull(CompetencyId)
Then
Dim objCompetencies As New
CompetencyInfo
objCompetencies.CompetencyId = CompetencyId
objCompetencies.ModuleId = ModuleId
CompetencyController.Competency_Delete(objCompetencies)
End
If
when the delete button is clciked the event fires but no pop up is being displayed
so i wrote another piece of code
myDeleteButton = e.Item.FindControl(
myDeleteButton.Attributes.Add(
Protected Sub lstCompetencies_ItemCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles lstCompetencies.ItemCreatedSelect Case e.Item.ItemTypeCase ListItemType.Item, ListItemType.AlternatingItem, ListItemType.EditItemDim myDeleteButton As ImageButton"btnDelete")"onclick", "return confirm('Are you sure you want to delete this Item?');")End Select
End Sub
which displays pop up.from this how can i call the above delete method when ok is clicked on the confirmation box.please help me in this regard.its urgent or please provide the code to do it in a correct way
thanks in advance
Sandeep.M