.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to set focus to UserName textbox in Login Control ?

Posted By:      Posted Date: October 20, 2010    Points: 0   Category :ASP.Net


can you please tell how to focus cursor to UserName TextBox in Login control when page is loaded for the first time in browser ? 

View Complete Post

More Related Resource Links

How to get username in Login control LoggedIn event?

  I want to keep a log of when people log into the database.  In the LoggedIn event of the Login control, User.Identity.Name is null.  How can I get the username that just logged in?  And how can I track when someone logs out using the login control?  Thanks!

getting more data for a username from the login control

i have went with the standard membership method for validating and logging users into the application.  i have added a column to the adpnet_Users table called customer_number.once the user is logged in, i want to get the customer number for that user.  what is the best / easiest / industry standard method of accomplishing this?

retrieve username from login control to pass it on as a parameter for poplulation of dropdown box.


Hi guys,

Would appreciate some help with this.

after a successful login I'd like to retrieve the users' name via C# and pass the name on as a parameter to populate a dropdown box or a grid view on the redirected page.

To authenticate a user I use the asp.net login control and I saw that I have access to several properties and methods but can't see text or value to just get the name back and pass it on for further processing.

Am I thinking wrong here?

Any hint on how to accomplish this is much appreciated.



how to make login control allow users to login by either username or email address


how to make login control allow users to login by either username or email address 

LogIn control: How can i set password from cookie to login contro's password textbox



My problem is in login control, password text box is not taking any changes. I cannot put value for password textbox in login control. My purpose is, in my login control if some one checked in "Remember me next time" then next time the user id and password will be autometically set from cookie. So user just need to click on LogIn button. My code is like bellow...

HttpCookie cookie = Request.Cookies["SiteSettings"];

Login1.UserName = cookie["Username"];

Login1.Password = cookie["Password"];


Can anyone help me please.


watermark textbox using Ajax control

This is pretty simple compared to jquery. Since we need refer a dll only. we dont want any script for this. we just include that reference into our website.

how to get an array of all the asp.net textbox control inside create user wizard control?



How can I get all the textboxes inside a create user wizard control using getElementsByTagName().

Below is my JQuery code:

<script type="text/javascript">
        function addLoadEvent(func) {
            var oldonload = window.onload;
            if (typeof window.onload != 'function') {
                window.onload = func;
            } else {
                window.onload = function() {

        function prepareInputsForHints() {
            var inputs = document.getElementsByTagName("asp:TextBox");
            for (var i = 0; i < inputs.length; i++) {
                inputs[i].onfocus = function() {
                    this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
                inputs[i].onblur = function() {
                    this.parentNode.getElementsByTagName("span")[0].style.display = "none";



<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

How to modify the login control



I'd like to record more information than the default control allows as well as perform actions with the input when the form is submitted but I'm having trouble figuring out how.

So firstly, if I want to record the middlename for example, how would I do that, and by default, where would it go if anywhere?
When the form is submitted, I'd like to take specific input, such as just the middlename for example, and write some linq to sql code to specify when and how it's stored.
In what event would I put this code?


Composite control: How to bubble a textbox's TextChanged event?


I've created a composite control that contains several controls, including a textbox. I'm trying to expose the TextChanged event of the textbox as an event on the composite control. I understand that events can be bubbled up the control hierarchy and handled at a higher level, which I've attempted to do, but I can't get the bubbled event to fire. When I drop the control on an aspx I can see the TextChanged event, I can subscribe to the event, but nothing ever happens. Any suggestions? Here is what I think is the relevant code:

// My event
private static readonly object EventTextChanged = new object();

//Handle the bubbled event
EventHandler textChangedHandler = (EventHandler)Events[EventTextChanged];

protected override bool OnBubbleEvent(object source, EventArgs e) 
    bool handled = false;

Web Q&A: Scripting Interoperability, Login Control on a Web Farm, Custom Refreshes, App Servers, and


Customize failure text for login control


Hi all,

I would like to show the failure text in a client-side alert box for login control in c#. Please help me if there is an easy way to convert it from vb.net to c#.net. Thanks a lot!

Protected Sub Login1_LoginError(ByVal sender As Object, ByVal e As System.EventArgs) Handles Login1.LoginError
'Display the failure message in a client-side alert box
ClientScript.RegisterStartupScript(Me.GetType(), "LoginError", _
String.Format("alert('{0}');", Login1.FailureText.Replace("'", "\'")), True)

 End Sub

 Converted, but it doesn't work.

protected void Login1_LoginError(object sender, System.EventArgs e)
    //Display the failure message in a client-side alert box
    ClientScript.RegisterStartupScript(this.GetType(), "LoginError", string.Format("alert('{0}');", Login1.FailureText.Replace("'", "\\'")), true);

Login control is suddenly broken in IE7 but works perfectly on Firefox (It works on both browsers lo


Hey Guys,

 I'm new around and I thought this is probably the best place to help me solve my dilemma, I am developing a website for almost a year now and the login control was implemented a logn time ago, however all of a sudden it will not authenticate on Internet Explorer 7 when the application is published, it doesn't even provide a message that authentication was unseccssful or throws any error, it just refreshes the same page. however this problem doesn't occure when I try the same website on FireFox 2.0...Also when I run the page locally on Cassini it work great on both browsers...This is one of the weirdest errors I have ever faced. what could have gone wrong on the server side to cause this? knowing nothing changed on the server-side...I'll provide a snapshot of the login control below

<asp:Login ID="LoginControl" runat="server" BackColor="Trans

Login control not working in IE7


I spent the last few weeks getting a client site up and running, but all the while I was doing all my testing with Firefox.

I tried seeing what it would look like in IE7, and everything is great.  Except that I cannot login with it.

 I do not know for the life of me why.

Any ideas?

 I am using VWD 2008 and i have a 3.5 web.


modify login control



is it posible to change the way to log in a wss3 site.

i created a wss 3 site collection. to enter the site a login control pop up then you need to log in using windows authentication before ypu can see the site.

now i want to change this pop up thing in to a nice page. so the user can see a welcome page and there he can fill in his username and password to log in.

i want to keep using windows authentication not FBA.

is this possible?


Issue with Remember Me on User Login control


Hi everyone,

     I hope you can help me, I tried Google, but none of the solutions worked. Using VB.net and Membership, I have a login control in my master page with a remember me check box. When I check this box and login, some pages indicate that I am not logged in. If I go to another page, it will then indicate that I am still logged in. I have isolated one page that always indicates I am not logged in the first time I visit it, but if log in a second time and then go to it, it will finally recognize me as a user that is properly logged in. 

Some pages that this occurs on is in the top level, some pages are in a sub folder.

My MasterPage has the following Form Code:

<body bgcolor="#E0ECF9" topmargin="0" leftmargin="0">

    <form id="form1" runat="server">

My Aspx file has a troubleshooting label, several Gridviews and several DetailViews:

    <asp:Label ID="lblErRep" runat="server" Text=""></asp:Label>

My aspx.vb file has 1 line of code (Protec

System.Data.SqlClient.SqlException: Login failed for user . Reason: The account is disable


Hi All,

Thank you for advance.

I created a widows service for mail schedule with c#.net and sql server 2005 and it is working fine for past one year.

now sometimes i am getting the "System.Data.SqlClient.SqlException: Login failed for user '<UserName>'. Reason: The account is disabled." error.

then i restarted the windows service manually and working.

what is the problem in my sql server connection and how to fix that issue?

Creating an integer only textbox control

Hi all I was wondering on how to create an integer only textbox control. Im close I just cant figure out why its not working. public partial class IntegerTextBox : TextBox { public IntegerTextBox() { } private void OnTextChanged(KeyPressEventArgs e) { if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar)) e.Handled = true; } }
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend