User-136719742 posted
To answer my own question. I found a solution
On the gridview control I changed to the following:
<asp:GridView
ID="ListAllUsers"
DataSourceID="UserData"
DataKeyNames="UserName"
AutoGenerateColumns="False"
AllowSorting="True"
AllowPaging="True"
BorderWidth="0px" runat="server"
BorderStyle="None"
Width="90%"
CellPadding="2"
PageSize="25">
<Columns>
<asp:BoundField
DataField="UserName"
HeaderText="User Name"
/>
<asp:BoundField
DataField="Email"
HeaderText="E-Mail Address"
/>
<asp:TemplateField
ShowHeader="False">
<ItemTemplate>
<asp:LinkButton
ID="LinkButton1"
runat="server" CausesValidation="false"
CommandName="Delete"
OnClientClick="return confirm('Are you sure you want to delete this user?')"
Text="Delete"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<RowStyle
HorizontalAlign="Left"
CssClass="row1" />
<HeaderStyle
CssClass="grid-header"
HorizontalAlign="Left"
/>
</asp:GridView>
You must also add to the UserDate objectdatasource a DeleteMethod. I chose to put DeleteUser in the DeleteMethod property field. You must
then just add a sub in the user_list.aspx.vb with this same name. These are the subs on my .vb page.
Protected
Sub Page_Load(ByVal sender
As Object,
ByVal e As EventArgs) Handles
Me.Load
End
Sub
Protected
Sub Button_Click(ByVal sender
As Object, ByVal args
As EventArgs) Handles CreateUser.Click
Response.Redirect("User_Create.aspx")
End
Sub
Private
Sub DeleteUser(ByVal UserName
As String)
End
Sub
This setup will give you a confirmation box to delete the user. I cannot tell you exactly why this works at this time, but I will solve the problem.