Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • ss 16 posts 36 karma points
    Feb 19, 2010 @ 14:29
    ss
    0

    Create New member

    I am creating a new member in umbraco through .net coding .. But i cant pass the textbox value to the member fields, However a member gets created when i give the username,email as a string values.. How to solve this.. Any help..

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Feb 19, 2010 @ 14:40
    Dirk De Grave
    0

    Hi ss,

    Assigning custom member properties should use the syntax:

    member.getProperty("propertyAlias").Value = value;

    General properties such as username and email can be accessed as properties on the member object.

     

    Hope this helps.

    Regards,

    /Dirk

  • ss 16 posts 36 karma points
    Feb 19, 2010 @ 14:57
    ss
    0

     

     

     

     

     

     

    MemberType

     

     

    mt = MemberType.GetByAlias("Administrator");

     

     

    Member m = Member.MakeNew(txtFullName.Text, mt, new umbraco.BusinessLogic.User

    (0));

    m.Email = txtEmail.Text;

     

    string

    pass = des3.Encrypt(txtPassword.Text);

    m.Password = pass.ToString();

    m.LoginName = txtFullName.Text;

    m.getProperty(

     

    "IsMainAdministrator"

    ).Value = cmbAdmin.SelectedItem.Value;

    I am using the above code.. Only the password field gets populated with this value.. The LoginName and Email are null.. If i give the username and email as "somename","someemail" instead of textbox values then it gets stored in the member table....

  • Nik Wahlberg 639 posts 1237 karma points MVP
    Feb 19, 2010 @ 15:08
    Nik Wahlberg
    0

    This may be an obvious question, but have you checked to make sure you have the correct fieldnames (if you're doing this outside of VS)? 

    Alternatively, please post your aspx and full cs so we can review. 

    Thanks,
    Nik

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Feb 19, 2010 @ 15:29
    Dirk De Grave
    0

    Also, you should be using the .net membership functions to create the user... See this reference on the wiki

     

    Cheers,

    /Dirk

  • ss 16 posts 36 karma points
    Feb 20, 2010 @ 06:32
    ss
    0

     

     

     

    .aspx page

     

    ==========

     <TABLE width="100%" align=left border=0><TBODY><TR>

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    <TD class="tdHeader" vAlign=middle align=left colSpan=4><asp:Label id="lbltemDetails" runat="server" Text="Add Administrator:" Font-Bold="True"></asp:Label> </TD></TR><TR><TD vAlign=middle align

    =left>

     

    <asp:Label ID="lblFullName" runat="server"

     

     

    Font-Size="Small" Text="Full Name" Width="130px"></asp:Label></TD

    >

     

    <TD vAlign=middle align=left><asp:TextBox id="txtFullName" tabIndex=1 runat="server" ValidationGroup="Item"></asp:TextBox> </TD

    >

     

    <TD vAlign=middle align=left colSpan

    =2>

     

    <asp:Label ID="lblerror" runat="server" BackColor="Silver" Font-Size="Small" ForeColor="DarkGreen"></asp:Label></TD></TR

    >

     

    <tr

    >

     

    <td align="left" valign

    ="middle">

     

    <asp:Label ID="lblEmail" runat="server"

     

     

    Font-Size="Small" ForeColor="Transparent" Text="Email" Width="130px"></asp:Label></td

    >

     

    <td align="left" valign

    ="middle">

     

    <asp:TextBox ID="txtEmail" runat="server" TabIndex="1" ValidationGroup="Item"></asp:TextBox

    >

     

    </td

    >

     

    <td align="left" colspan="2" valign

    ="middle">

     

    <asp:Button id="btnAdd" tabIndex=4 onclick="btnAdd_Click" runat="server" Width="60px" Text="Add" ValidationGroup

    ="Item">

     

    </asp:Button></td

    >

     

    </tr

    >

     

    <tr

    >

     

    <td align="left" valign

    ="middle">

     

    <asp:Label id="lblUserPwd" runat="server" Font-Size="Small" Text="Password" Width="130px"></asp:Label></td

    >

     

    <td align="left" valign

    ="middle">

     

    <asp:TextBox ID="txtPassword" runat="server" TabIndex="1" ValidationGroup="Item" TextMode="Password"></asp:TextBox

    >

     

    </td

    >

     

    <td align="left" colspan="2" valign

    ="middle">

     

    <asp:Button id="btnCancel" tabIndex=6 onclick="btnCancel_Click" runat="server" Width="60px" Text="Cancel" CausesValidation

    ="False">

     

    </asp:Button></td

    >

     

    </tr

    >

     

    <tr

    >

     

    <td align="left" valign

    ="middle">

     

    <asp:Label ID="Label1" runat="server" Font-Size="Small" Text="Main Administrator" Width="130px"></asp:Label></td

    >

     

    <td align="left" valign

    ="middle">

     

    <asp:DropDownList ID="cmbAdmin" runat

    ="server">

     

    <asp:ListItem Selected="True" Value="0">No</asp:ListItem

    >

     

    <asp:ListItem Value="1">Yes</asp:ListItem

    >

     

    </asp:DropDownList></td

    >

     

    <td align="left" colspan="2" valign

    ="middle">

     

    <asp:Button id="btnDelete" tabIndex=5 onclick="btnDelete_Click" runat="server" Width="60px" Text="Delete" CausesValidation

    ="False">

     

    </asp:Button></td

    >

     

    </tr

    >

     

    </TBODY></TABLE

    >

     

    cTripleDES

     

     

    des3 = new cTripleDES

    (key, iv);

     

    if (btnAdd.Text == "Add"

    )

    {

     

    if (Member.GetMemberFromEmail(txtEmail.Text) == null

    )

    {

     

    MemberType mt = MemberType.GetByAlias("Administrator"

    );

     

    Member m = Member.MakeNew(txtFullName.Text, mt, new umbraco.BusinessLogic.User

    (0));

    m.Email = txtEmail.Text;

     

    string

    pass = des3.Encrypt(txtPassword.Text);

    m.Password = pass.ToString();

    m.LoginName = txtFullName.Text;

     

    m.getProperty(

     

    "IsMainAdministrator"

    ).Value = cmbAdmin.SelectedItem.Value;

     

    m.Save();

    lblerror.Visible =

     

    true

    ;

    lblerror.Text =

     

    "Admin Created!"

    ;

    BindGrid();

    ClearItems();

    }

     

    else

     

     

    {

    lblerror.Visible =

     

    true

     

    ;

    lblerror.Text =

     

    "Record May Be Already Exists!"

    ;

     

     

  • vijay 129 posts 152 karma points
    Mar 10, 2010 @ 11:10
    vijay
    0

    Hi SS,

    Where r u from.

Please Sign in or register to post replies

Write your reply to:

Draft