locked
Delete user accounts RRS feed

  • Question

  • User-136719742 posted
    Does anyone know how to delete user accounts from the list users page on the admin tab?
    Wednesday, February 1, 2006 10:43 PM

All replies

  • User-779945100 posted
    Yes having the same problem please help.
    Thursday, February 2, 2006 1:44 AM
  • 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.

     

     

    Friday, February 3, 2006 10:30 AM
  • User2067580637 posted

    This is what I get when trying that

    The DELETE statement conflicted with the REFERENCE constraint "FK_IssueTracker_ProjectMembers_aspnet_Users [...]"

    Need to get this to work though. Any ideas?

    Tuesday, March 21, 2006 8:56 AM