顯示具有 CreateUserWizard 標籤的文章。 顯示所有文章
顯示具有 CreateUserWizard 標籤的文章。 顯示所有文章

2014年7月13日 星期日

[RESOLVED] Can't set IsApproved to false


I am explicitly disable the user upon creation but the IsApproved property is set to TRUE and so the user is able to login. I want the user to be disabled after cregistering and they'll activate the account by licking on a linkin the email they'll get upon
registering. Any idea what is wrong?


        OnCreatedUser="RegisterUser_CreatedUser">







I resolved it. I had it as DisableCreateUser="True" instead of DisableCreatedUser="True"


[RESOLVED] Register users based on e-mail list


Hi all,


I am using CreateUserWizard to let users register on my web application. My requirement is to only let users register if the email they enter while registering exists in my database(i have a table with all the valid emails). I did a lot of research and came
across this similar requirment here http://stackoverflow.com/questions/9476820/asp-net-register-users-based-on-e-mail-whitelist. but how can I stop the
registration if the email doesn't exist in my database?Since am using the CreateUserWizard , do I have control over stopping the registration?


Please advise and thanks for the help.


[RESOLVED] CreateUserWizard custom error message


Hi All,


I am using CreateUserWizard to setup a registration page for users. I don't want the registration to happen for certain email addresses so am using the code below and it works fine. How can I give a custom error message to the user when they use an "invalid"
email? Thanks for the help.



protected void ValidateEmail_CreatingUser(object sender, LoginCancelEventArgs e)
{
if (RegisterUser.Email == "some-email@company.com")
{
e.Cancel = true;
}

}





Any ideas, please?



hi  sam1980, 


Acording to your description ,you want to create CreateUserWizard custom error message.


You  can  try   using  custom templates and use RegularExpressionValidator
control. for example ,html  source code as below :


         


           


               


                     


                       


                            ……


                            


                               


                                


                           

                          


                            


                               


                           


                       


                                                       E-mail:


                                   


                                   

                                        ErrorMessage="E-mail is required." ToolTip="E-mail is required." ValidationGroup="CreateUserWizard1">*                           


                                   *@\w+([-.]\w+)*\.\w+([-.]\w+)*"


                                 ControlToValidate="Email"   runat="server"        ErrorMessage="E-mail format is error">


                               


                                   


                               

                       


                    


               


               


                      ……


               


             


          


          Or trigger control event to judge.


[RESOLVED] Bind Country/State DDL


I have two Dropdownlists within a CreateuserWizard. One for Country and the other for State. I also have two sqldatasources. I am trying to load the state dropdownlist based on the selection of the the country dropdownlist. The state dropdownlist is not
populating.


 




                    OnCreatedUser="RegisterUser_CreatedUser" BackColor="#F7F6F3"
BorderColor="#E6E2D8" BorderStyle="Solid" BorderWidth="1px"
Font-Names="Verdana" Font-Size="0.8em">


Country:
ForeColor="Black" AutoPostBack="True" DataSourceID="SqlDataSource1"
DataTextField="CountryName" DataValueField="Country#"
onselectedindexchanged="ddlCountry_SelectedIndexChanged">

CssClass="failureNotification" ErrorMessage="Country is required." ToolTip="Country is required."
ValidationGroup="RegisterUserValidationGroup">*




State:
ForeColor="Black" DataSourceID="SqlDataSource2"
DataTextField="StateName" DataValueField="State#" AutoPostBack="True">

CssClass="failureNotification" ErrorMessage="State is required." ToolTip="State is required."
ValidationGroup="RegisterUserValidationGroup">*





ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM [Country]">



ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT State.State#, State.StateName FROM State INNER JOIN StateCountry ON State.State# = StateCountry.State# WHERE (StateCountry.Country# = @column1)">







protected void Page_Load(object sender, EventArgs e)
{
RegisterUser.ContinueDestinationPageUrl = Request.QueryString["ReturnUrl"];


if (!Page.IsPostBack)
{
DropDownList stateList = (DropDownList)RegisterUserWizardStep.ContentTemplateContainer.FindControl("ddlState");
DropDownList countryList = (DropDownList)RegisterUserWizardStep.ContentTemplateContainer.FindControl("ddlCountry");
Session["countryID"] = countryList.SelectedValue.ToString();
stateList.DataBind();
}


}



 


 




Use control parameter instead. You don't need to write some code behind to populate ddlState items. Don't join the table, simply set criteria.

Error :


Could not find control 'ddlCountry' in ControlParameter 'column1'.


I also tried countryList.



Maybe you can place Country/State DDL, SqlDataSource in same template



hello


try somthing like this


Session["countryID"] = countryList.SelectedValue.ToString();
// first clear statelist then assign value
stateList.ClearSelection();
stateList.DataBind();

hope this works for you 


thanks


manish








try the following code ,



hopfully it will help.





Hi Code_warrior...,


As oned_gk suggested, using ControlParameter would be better here. Also, for the following error you encountered:


"Could not find control 'ddlCountry' in ControlParameter 'column1'."


it is due to the SqlDataSource control cannot locate the dropdownlist control (ddlCountry) inside the CreateUserWizard control (they are not in the same container). As oned_gk suggested, you can try putting the SqlDataSource control into the CreateUserWizard
(make them in the same container) to see if it works.


[RESOLVED] In createuserwizard,can i add more fields other than default entries


hi


i want to add one more field name "Interests " in createuserwizard tool as my requirement is to store user interests and then migrate to the interested pages whenever he logins...can anybody help me how to accomplish it


if we can store custom entities in CreateUserWizard then where can we find such entires in database table....i mean in which data table we can find user interest entry...


thanks



Hi it_ejaz,


From my understanding, you would like to custom the createuserwizard control.


If so, I suggest you to using ContentTemplate to implement.


Now, please try to refer to the following code:


In the aspx file:


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="CreateUserWizardFullApplication.WebForm1" %>
















































Sign Up for Your New Account


User Name:


ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="CreateUserWizard1">*


Password:


ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="CreateUserWizard1">*


Confirm Password:


ErrorMessage="Confirm Password is required." ToolTip="Confirm Password is required."
ValidationGroup="CreateUserWizard1">*



E-mail:


ErrorMessage="E-mail is required." ToolTip="E-mail is required." ValidationGroup="CreateUserWizard1">*


Security Question:


ErrorMessage="Security question is required." ToolTip="Security question is required."
ValidationGroup="CreateUserWizard1">*



Security Answer:


ErrorMessage="Security answer is required." ToolTip="Security answer is required."
ValidationGroup="CreateUserWizard1">*


ControlToValidate="ConfirmPassword" Display="Dynamic" ErrorMessage="The Password and Confirmation Password must match."
ValidationGroup="CreateUserWizard1">





















In the aspx.cs file:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CreateUserWizardFullApplication
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
{
// Determine the checkbox values.
CheckBox subscribeCheckBox =
(CheckBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("SubscribeCheckBox");
CheckBox shareInfoCheckBox =
(CheckBox)CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ShareInfoCheckBox");
TextBox userNameTextBox =
(TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("UserName");



// Show or hide the labels based on the checkbox values.
Label subscribeLabel =
(Label)CreateUserWizard1.CompleteStep.ContentTemplateContainer.FindControl("SubscribeLabel");
Label shareInfoLabel =
(Label)CreateUserWizard1.CompleteStep.ContentTemplateContainer.FindControl("ShareInfoLabel");

subscribeLabel.Visible = subscribeCheckBox.Checked;
shareInfoLabel.Visible = shareInfoCheckBox.Checked;
//Now you can store thest data to database...
}

}
}

Hope it can help you.


If there is anything unclear, please let me know.


Best Regards,

Terry Guo