SiteLogin

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
5/9/2011 8:20:07 AM
Gravatar
Total Posts 46

SiteLogin

Hi,

i need to change the way the following code works to display correctly in my template.

<portal:SiteLogin ID="LoginCtrl" runat="server" CssClass="login" />

trying to search for the code that displays it in mojoPortal i cant seem to find it. any pointers?

or is there a better way for me to create my own login form and post it?

5/9/2011 10:10:15 AM
Gravatar
Total Posts 2239

Re: SiteLogin

Hi,

Your question is a little vague. What about the SiteLogin control do you want to change?

You could wrap the control in a div with a specific class so that you can control the style for this instance only.

<div id="myspeciallogin"><portal:SiteLogin ID="LoginCtrl" runat="server" /></div>

#myspeciallogin .logincontrol{...}

HTH,
Joe D.
 

5/9/2011 10:18:04 AM
Gravatar
Total Posts 46

Re: SiteLogin

i need to move it out of its table design, so i can style the labels better. atm it shows label with the text box under it as it used 2 td's and i need the labels to be left of the text boxes. hense needing to change the layout of the module.

 

5/9/2011 12:46:56 PM
Gravatar
Total Posts 18439

Re: SiteLogin

If you are using .NET 4 you can eliminate the outer table by adding this in the theme.skin file:

<portal:SiteLogin runat="server" RenderOuterTable="false" CssClass="" />

Note that you must set the CssClass to empty string or it throws an error.

It also would throw an error if you add this to theme.skin under .NET 3.5

Hope that helps,

Joe

5/9/2011 2:58:09 PM
Gravatar
Total Posts 46

Re: SiteLogin

hi joe,

thanks for the reply, but this still outputs a table based login as below.

<table cellpadding="0">

<tbody><tr>
  <td align="center" colspan="2">Log In</td>
</tr><tr>
  <td align="right"><label for="ctl01_LoginView1_ctl01_UserName">User Name:</label></td><td><input name="ctl01$LoginView1$ctl01$UserName" type="text" id="ctl01_LoginView1_ctl01_UserName"><span id="ctl01_LoginView1_ctl01_UserNameRequired" title="User Name is required." style="visibility: hidden; ">*</span></td>
</tr><tr>
  <td align="right"><label for="ctl01_LoginView1_ctl01_Password">Password:</label></td><td><input name="ctl01$LoginView1$ctl01$Password" type="password" id="ctl01_LoginView1_ctl01_Password"><span id="ctl01_LoginView1_ctl01_PasswordRequired" title="Password is required." style="visibility: hidden; ">*</span></td>
</tr><tr>
  <td colspan="2"><input id="ctl01_LoginView1_ctl01_RememberMe" type="checkbox" name="ctl01$LoginView1$ctl01$RememberMe"><label for="ctl01_LoginView1_ctl01_RememberMe">Remember Me On This Computer</label></td>
</tr><tr>
  <td align="right" colspan="2"><input type="submit" name="ctl01$LoginView1$ctl01$LoginButton" value="Sign In" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl01$LoginView1$ctl01$LoginButton&quot;, &quot;&quot;, true, &quot;ctl01$LoginView1$ctl01&quot;, &quot;&quot;, false, false))" id="ctl01_LoginView1_ctl01_LoginButton"></td>
</tr><tr>
  <td colspan="2"><a id="ctl01_LoginView1_ctl01_CreateUserLink" href="http://sbid-dev.co.uk/Secure/Register.aspx">register</a><br><a id="ctl01_LoginView1_ctl01_PasswordRecoveryLink" href="/Secure/RecoverPassword.aspx">Recover Password</a></td>
</tr>
</tbody></table>

 

the problem is that i want to do it more like this:

 

<div id="login">

<label for="Password">Password:</label><input id="Password" name="Password" type="password"><span id="PasswordRequired" title="Password is required." style="visibility: hidden; ">*</span>

</div>

 

so i can style it so the label sits to the left of the input box

5/10/2011 7:34:36 AM
Gravatar
Total Posts 18439

Re: SiteLogin

The markup you posted does not come from <portal:SiteLogin, it looks like rendering from some custom code you have using <asp:LoginView

Even when I view the source of your site on the login page it does not look like what you posted.

I don't know of any way to make the <asp:LoginVew control not render as a table. <portal:SiteLogin inherits from <asp:Login not from <asp:LoginView. We are not using <asp:LoginView anywhere in mojoPortal code.

Best,

Joe

5/10/2011 10:08:13 AM
Gravatar
Total Posts 46

Re: SiteLogin

joe, taking out the login view and literally just using the below outputs this:

 <portal:SiteLogin ID="SiteLogin1" runat="server" CssClass="login" />

<table cellpadding="0">
<tbody><tr>
  <td align="center" colspan="2">Log In</td>
</tr><tr>
  <td align="right"><label for="ctl01_SiteLogin1_UserName">User Name:</label></td><td><input name="ctl01$SiteLogin1$UserName" type="text" id="ctl01_SiteLogin1_UserName"><span id="ctl01_SiteLogin1_UserNameRequired" title="User Name is required." style="visibility: hidden; ">*</span></td>
</tr><tr>
  <td align="right"><label for="ctl01_SiteLogin1_Password">Password:</label></td><td><input name="ctl01$SiteLogin1$Password" type="password" id="ctl01_SiteLogin1_Password"><span id="ctl01_SiteLogin1_PasswordRequired" title="Password is required." style="visibility: hidden; ">*</span></td>
</tr><tr>
  <td colspan="2"><input id="ctl01_SiteLogin1_RememberMe" type="checkbox" name="ctl01$SiteLogin1$RememberMe"><label for="ctl01_SiteLogin1_RememberMe">Remember Me On This Computer</label></td>
</tr><tr>
  <td align="right" colspan="2"><input type="submit" name="ctl01$SiteLogin1$LoginButton" value="Sign In" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl01$SiteLogin1$LoginButton&quot;, &quot;&quot;, true, &quot;ctl01$SiteLogin1&quot;, &quot;&quot;, false, false))" id="ctl01_SiteLogin1_LoginButton"></td>
</tr><tr>
  <td colspan="2"><a id="ctl01_SiteLogin1_CreateUserLink" href="http://localhost:51105/Secure/Register.aspx">register</a><br><a id="ctl01_SiteLogin1_PasswordRecoveryLink" href="http://localhost:51105/Secure/RecoverPassword.aspx">Recover Password</a></td>
</tr>
</tbody></table>

 

im curious as to where this template sits so i can modify it?

5/10/2011 11:36:59 AM
Gravatar
Total Posts 18439

Re: SiteLogin

There is no template that you can modify, the rendering is controlled by the underlying <asp:Login control that <portal:SiteLogin inherits from.

On my machine it renders like this:

<div id="ctl00_mainContent_pnlStandardLogin" class="floatpanel">
    <table id="ctl00_mainContent_login1_LoginCtrl" class="logincontrol" cellspacing="0" cellpadding="0" border="0" style="border-collapse:collapse;">

    <tr>

     <td>

        <div id="ctl00_mainContent_login1_LoginCtrl_pnlLContainer" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'ctl00_mainContent_login1_LoginCtrl_Login')">

     

            <div class="settingrow idrow">

                <strong>

                    <label for="ctl00_mainContent_login1_LoginCtrl_UserName">Email</label>

                </strong>

                <br />

                <input name="ctl00$mainContent$login1$LoginCtrl$UserName" type="text" maxlength="100" id="ctl00_mainContent_login1_LoginCtrl_UserName" class="normaltextbox signinbox" />

            </div>

            <div class="settingrow passwordrow">

                <strong>

                    <label for="ctl00_mainContent_login1_LoginCtrl_Password">Password</label>

                </strong>

                <br />

                <input name="ctl00$mainContent$login1$LoginCtrl$Password" type="password" id="ctl00_mainContent_login1_LoginCtrl_Password" class="normaltextbox passwordbox" />

            </div>

            <div class="settingrow rememberrow">

                <input id="ctl00_mainContent_login1_LoginCtrl_RememberMe" type="checkbox" name="ctl00$mainContent$login1$LoginCtrl$RememberMe" /><label for="ctl00_mainContent_login1_LoginCtrl_RememberMe">Remember Me On This Computer</label>

            </div>
            <div class="settingrow buttonrow">

                <span class="art-button-wrapper"><span class="l"> </span>
<span class="r"> </span>
<input type="submit" name="ctl00$mainContent$login1$LoginCtrl$Login" value="Sign In" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$mainContent$login1$LoginCtrl$Login&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" id="ctl00_mainContent_login1_LoginCtrl_Login" class="art-button" />
</span>

                <br />
            </div>

            <div class="settingrow registerrow">

                <a id="ctl00_mainContent_login1_LoginCtrl_lnkPasswordRecovery" class="lnkpasswordrecovery" href="http://test/m2365msnet35/Secure/RecoverPassword.aspx">Recover Password</a>&nbsp;&nbsp;

                <a id="ctl00_mainContent_login1_LoginCtrl_lnkRegisterExtraLink" class="lnkregister" href="http://test/m2365msnet35/Secure/Register.aspx">Register</a>

            </div>
     </div>

    </td>

    </tr>

   </table><span id="ctl00_mainContent_login1_LoginCtrl_ctl02" class="txterror" style="visibility:hidden;">Sign In Failed. You did not provide a valid email address.</span>

  </div>
 

and the outer table can be eliminated under .NET 4 using the technique I mentioned.

I have no explanation how it can render differently for you on your local machine.

and when I visit your site that you initially posted http://sbid-dev.co.uk/Secure/Login.aspx

and I view the source I see the same thing I posted not what you posted.

5/10/2011 4:56:25 PM
Gravatar
Total Posts 18439

Re: SiteLogin

Ok, it came to me later thinking about this. You are getting the default rendering of the <asp:Login control because you are not declaring the template. You should have searched for <portal:SiteLogin and then you could have copied the way we use it. It does have some template support. You can see how we use it in /Controls/LoginControl.ascx

This is a UserControl we encapsulated it into so that we don't have duplicate code in /Secure/Login.aspx and in the /Modules/SignInModule.ascx

There you will see how we declared it with the layoutTemplate like this:

<portal:SiteLogin ID="LoginCtrl" runat="server" CssClass="logincontrol">
    <LayoutTemplate>
        <asp:Panel id="pnlLContainer" runat="server" defaultbutton="Login">
            <div class="settingrow idrow">
                <strong>
                    <mp:SiteLabel ID="lblEmail" runat="server" ForControl="UserName" ConfigKey="SignInEmailLabel">
                    </mp:SiteLabel>
                    <mp:SiteLabel ID="lblUserID" runat="server" ForControl="UserName" ConfigKey="ManageUsersLoginNameLabel">
                    </mp:SiteLabel>
                </strong>
                <br />
                <asp:TextBox id="UserName" runat="server" CssClass="normaltextbox signinbox" maxlength="100" />
            </div>
            <div class="settingrow passwordrow">
                <strong>
                    <mp:SiteLabel ID="lblPassword" runat="server" ForControl="Password" ConfigKey="SignInPasswordLabel">
                    </mp:SiteLabel>
                </strong>
                <br />
                <asp:TextBox id="Password" runat="server" CssClass="normaltextbox passwordbox" textmode="password" />
            </div>
            <div class="settingrow rememberrow">
                <asp:CheckBox id="RememberMe" runat="server" />
            </div>
            <asp:Panel class="settingrow" id="divCaptcha" runat="server">
                <mp:CaptchaControl ID="captcha" runat="server" />
            </asp:Panel>
            <div class="settingrow buttonrow">
                <portal:mojoButton ID="Login" CommandName="Login" runat="server" Text="Login" />
                <br />
                <portal:mojoLabel ID="FailureText" runat="server" CssClass="txterror" EnableViewState="false" />
            </div>
            <div class="settingrow registerrow">
                <asp:Hyperlink id="lnkPasswordRecovery" runat="server" CssClass="lnkpasswordrecovery"/>&nbsp;&nbsp;
                <asp:Hyperlink id="lnkRegisterExtraLink" runat="server" CssClass="lnkregister" />
            </div>
        </asp:Panel>
    </LayoutTemplate>
</portal:SiteLogin>

By doing it this way it only has the outer table and that can be removed as I indicated before, and in fact in the latest source code I've coded it to remove that if it is compiled for .NET 4. so in the next release it won't require the trick using the theme.skin.

Because you have not declared the layoutTemplate in your markup in your custom version it just uses the default rendering of <asp:Login control which is with table rows like you posted.

Hope that helps,

Joe

 

5/12/2011 8:17:29 AM
Gravatar
Total Posts 46

Re: SiteLogin

cheers joe, adding a layout template has fixed the issue :)

You must sign in to post in the forums. This thread is closed to new posts.