Hi Jeff,
Welcome to the MSDN newsgroup.
From your description, I understand you have an ASP.NET 2.0 page which uses
the "LoginControl" and you're wondering how to get the reference to the
login button on the "LoginControl" so as to do some
customization(registering some client scripts), correct?
Based on my research, the "LoginControl" doesn't provide buildin property
for accessing the inner login button control. However, since the login
button is created as one child control in the "LoginControl"'s composite
control hierarchy, we can consider using the "Control.FindControl" to get
the reference of the login button. Form the client-side html source of a
test page containing login control, I find that the login button's id is
always assigned with "LoginButton" and login button's direct parent
NamingContainer is just the "LoginControl". Therefore, we can use the
"LoginButton" as the control id to call the "FindControl" method. For
example:
===============================
protected void Page_Load(object sender, EventArgs e)
{
Control ctrl = Login1.FindControl("LoginButton");
if (ctrl != null)
{
Button btn = (Button)ctrl;
btn.Attributes.Add("onmouseout", "alert(this.name);");
}
else
{
Response.Write("<br/>Null");
}
}
===============================
BTW, for such question on how to get a nested child control's reference in
a certain composite control, the ASP.NET web page's output trace is a good
helper. We can turn on the page's trace in the @Page directive so that the
runtime will printout the page's control hierarchy at the bottom of the
page's html content. e.g:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="login.aspx.cs"
Inherits="login" Trace="true" %>
This can greatly ease our work on inspecting the page's control structure.
Hope this helps.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)