Login- demo

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a login control which I want to have loaded my demo user name and the
demo password. Naturally the demo password doesnt have to show as text
literal but best I can tell I cant set the password programmically. I could
hide the password however I would still need to "login" this demo user with a
password so either I need to find away to set the password in the textbox or
login the demo user programmically.

Thanks!
 
Hi Dean,

For a demo password you can use a little client-side JavaScript to pre-fill
the fields.

Here's a little example below. Note however that the client-side ID of the
controls will change depending on whether the login is in a master page
and/or user control.

Let us know if this helps?

Ken
Microsoft MVP [ASP.NET]

<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Page_Load _
(ByVal sender As Object, _
ByVal e As System.EventArgs)
If Not IsPostBack Then
Dim sb As New StringBuilder
sb.Append("var uname=document.getElementById")
sb.Append("('Login1_UserName');")
sb.Append("uname.value='usernameID';")
sb.Append("var pwd=document.getElementById")
sb.Append("('Login1_Password');")
sb.Append("pwd.value='thepassword';")
ClientScript.RegisterStartupScript _
(Me.GetType, "lgin", sb.ToString, True)
End If
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Script login</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:login id="Login1" runat="server">
</asp:login>
</div>
</form>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top