your welcome Mike ;)
[quoted text, click to view] "Mike" <nospam@hotmail.com> wrote in message =
news:Ofm5$hH$DHA.688@tk2msftngp13.phx.gbl...
Alessandro,
Removing all register directives I had and then dragging and dropping =
the control over the WebForm fixed the problem.
Thanks a lot.
Mike
=20
"Alessandro Zifiglio" <alessandrozifiglio@NO-SPAM-hotmail.com> wrote =
in message news:ngm%b.11900$HO2.858@news.edisontel.com...
Mike,=20
if you simply dragged the userControl from solution explorer in =
vs.net and dropped it on the page vs.net will automatically put the @ =
directive and reference your control on the page for you. In addition it =
will add the control with its corresponding tags like below :=20
in webform1.aspx
<%@ Register TagPrefix=3D"uc1" TagName=3D"WebUserControl1" =
Src=3D"WebUserControl1.ascx" %>
<uc1:WebUserControl1 id=3D"WebUserControl11" =
runat=3D"server"></uc1:WebUserControl1>
now in your code behind class for webform1 webform1.vb or =
webform1.cs if you code in c#
If you wanted to then reference this control in your code behind you =
need to declare it like any webcontrol.=20
Protected WithEvents WebUserControl11 As WebUserControl1
make sure that the id you provide when declaring it in your code =
behind class is the same as the control ID provided in our example above =
it is : webUserControl11
now you can easily access any of of its properties and members same =
way you would with any webControl using the controlName and period like:
webusercontrol11.Visible =3D False=20
I dont know if this is what you are after, otherwise you might need =
to provide me some sample code and go into details as to what you want =
to achieve. I'm having difficulty following the part where you mentioned =
"I added the properties to the template page, in which I have my 3 =
controls. But then the Main page does not inherit from this =
template.ascx."
[quoted text, click to view] "Mike" <nospam@hotmail.com> wrote in message =
news:O53vUPG$DHA.1700@TK2MSFTNGP12.phx.gbl...
HI Alessandro,
The problem is that I don't see the user control in my WebForm. I =
added the properties to the template page, in which I have my 3 =
controls. But then the Main page does not inherit from this =
template.ascx. This is the first time I am doing this, and I think =
something is wrong with the inheritance or register directive. But =
cannot find the problem.
Mike
"Alessandro Zifiglio" <alessandrozifiglio@NO-SPAM-hotmail.com> =
[quoted text, click to view] wrote in message news:EMk%b.11864$HO2.11304@news.edisontel.com...
hi Mike,
have your UserControl expose a text property. Your going to have =
to use get/set accessors here. And then programmatically reference this =
text property on your webform that way if you were on webform1 you would =
go :
webusercontrol1.text =3D "Text specific to webform1"
and if you were on webform2 :
webusercontrol1.text =3D "Text specific to webform2"
[quoted text, click to view] "Mike" <nospam@hotmail.com> wrote in message =
news:%23SPuaL5%23DHA.916@TK2MSFTNGP10.phx.gbl...
In a test project, I have created two WebForms and one =
WebUserControl that contains a textbox and a button. I would like to =
display a string in the textbox when the WebForm1 is used, but another =
string when WebForm2 is used. How can I do this? Do I have to create 2 =
different classes and then reference them in the "@ Register" directive, =
like this?
In WebForm1:
<%@ Register TagPrefix=3D"uc1" TagName=3D"WebUserControl1" =
Src=3D"WebCtrlForForm1.ascx" %>=20
In WebForm2:
<%@ Register TagPrefix=3D"uc1" TagName=3D"WebUserControl1" =
Src=3D"WebCtrlForForm2.ascx" %>=20
But what about the default class that is created when I create =
the WebUserControl? Is it safe to delete it? Sorry for so many question, =
but WebControls are a subject that I cannot really understand.
Any help is appreciated...
Thank you very much.