Groups | Blog | Home
all groups > asp.net webcontrols > january 2006 >

asp.net webcontrols : Web User Control



Frank
1/31/2006 12:58:35 PM
Hi,
I have two user controls. They are small. One is for login in and the
other one is for a new user. I was thinking to have both, and in the client
side, switch them (if both are load it), yet I want them in the same
position. How can I achieve that? and if is not possible on client side, at
least on server side
Thanks
Francisco
Frank
1/31/2006 1:22:29 PM
I found a way of doing it using
((MSAWeb.WUCNewUser)(this.Page.FindControl("WUCNewUser1"))).Visible = false;

Now, I wonder how can I do it at the client side. At the same time, I was
thinking that there may be a way to load it instead of using the visible
properties. That way, I don't overload the user controls. If I cna do to this
at the server level, it could be quite useful.
Thanks


[quoted text, click to view]
Phillip Williams
1/31/2006 2:49:32 PM
You could have also referenced the control directly if you had declared it
this way:
public class MyPage: System.Web.UI.Page
{
protected MSAWeb.WUCNewUser WUCNewUser1 ;
//..rest of the page code
private void Page_Load(object sender, System.EventArgs e)
{
WUCNewUser1.Visible = false;
}
}

You can load your control server-side using the LoadControl method
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuitemplatecontrolclassloadcontroltopic.asp

To manipulate an object using client-side JavaScript you need to identify
one more piece of information; the clientID(s) of the HTML object(s) rendered
by your control, which, though possible, is not a preferred approach
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuicontrolclassclientidtopic.asp
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com


[quoted text, click to view]
AddThis Social Bookmark Button