caoimhincryan
asked on
Set user as active or inactive
Do you know is it possible to set a user as active or inactive from an aspx page?
Try get something similar like in the asp.net configuration page under security?
Try get something similar like in the asp.net configuration page under security?
Forgot to add:
By doing this, the user will not be able to login to the system until you set the property to true again.
We use this all the time to verify someone's email address.
We send an email with a link on clicking which, we set the IsApproved property to true.
By doing this, the user will not be able to login to the system until you set the property to true again.
We use this all the time to verify someone's email address.
We send an email with a link on clicking which, we set the IsApproved property to true.
ASKER
Sorry, I should have explained...
I want to be able to come in and look at all my users on a page and then decide to set a user as inactive or active?
I want to be able to come in and look at all my users on a page and then decide to set a user as inactive or active?
Ok. :)
What you need to do is this:
Drag and drop a grid onto the page - lets call it grid1.
Then do this in your Page_Load (see code below)
---
This will give you a quick and dirty way to see all members.
You can then go ahead and edit the grid and add the Select buttons and write code behind to select certain users and change their properties, etc.
Let me know if this helps and whether you need help with something more specific.
What you need to do is this:
Drag and drop a grid onto the page - lets call it grid1.
Then do this in your Page_Load (see code below)
---
This will give you a quick and dirty way to see all members.
You can then go ahead and edit the grid and add the Select buttons and write code behind to select certain users and change their properties, etc.
Let me know if this helps and whether you need help with something more specific.
grid1.DataSource = Membership.GetAllUsers();
grid1.DataBind();
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I cant seem to drop a button into the template field.
Error 18 Element 'Button' is not a known element. This can occur if there is a compilation error in the Web site.
Error 18 Element 'Button' is not a known element. This can occur if there is a compilation error in the Web site.
<asp:TemplateField>
<asp:Button runat="server" Text="Button" />
</asp:TemplateField>
Thats strange. Can you tell me which version of ASP.Net are you using?
I was assuming you are using .Net 2 or Visual Studio 2005.
Incase you are, your grid should look something like this: (See code below)
(You might have missed the ID attribute)
I was assuming you are using .Net 2 or Visual Studio 2005.
Incase you are, your grid should look something like this: (See code below)
(You might have missed the ID attribute)
<asp:GridView ID="grdUsers" runat="server">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID="Button4" runat="server" CommandArgument='<%# Eval("ProviderUserKey") %>' OnCommand="Button4_Command" Text="Toggle Account" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
All we do is make the user's account inactive by setting his IsApproved property to false.
Again, in the wzdRegister_CreatedUser event, you do the following:
Open in new window