Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Login- demo

1 view
Skip to first unread message

Sean

unread,
Jul 30, 2006, 10:39:01 PM7/30/06
to
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!

Ken Cox [Microsoft MVP]

unread,
Jul 31, 2006, 10:32:28 AM7/31/06
to
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>


"Sean" <Se...@discussions.microsoft.com> wrote in message
news:E5B47437-A359-4B51...@microsoft.com...

0 new messages