Ask a Question related to ASP.NET General, Design and Development.
-
Lokhan Wong #1
Referencing a panel on a webform from an usercontrol
My question is whether it's possible to change the
properties of a panel, that resides on the webform
containing the usercontrol, in the usercontrol itself.
Like this:
<form>
<asp:panel visibility=false .... </asp panel>
<user:control> //a function here turns the visibilty to
true </user:control>
</form>
Greetz,
Lokhan Wong
[email]Lokhan_wong@hotmail.com[/email]
//cogito ergo sum
Lokhan Wong Guest
-
referencing and anchor from within a usercontrol (ascx)
Hi, I am trying to reference an anchor in a user control with a url. This worked in 1.1 but no longer works in 2.0. The ascx control is... -
Event not firing in usercontrol inside usercontrol
I'm stumped on this problem. I've created a user control that dynamically creates 5 linkbuttons in the CreateChildControls method. Each of these... -
Including WebForm Image Control in a Webform Table Control
What is the code for including an image control in a Table control of a WebForm ???? regards -
Referencing subcontrols within UserControl
Does anyone know how to reference a subcontrol of a UserControl within client-side script. For example, if I have a TextBox as one of the elements... -
Use LoadControl to load a usercontrol but the webcontrol in the usercontrol can not AutoPostBack
a uscontrol test.ascx have a dropdownlist web control the dropdownlist's AutoPostBack property is set "true" but when i use... -
Kevin Kenny #2
Re: Referencing a panel on a webform from an usercontrol
Lokhan Wong wrote:
This is possible:>My question is whether it's possible to change the
>properties of a panel, that resides on the webform
>containing the usercontrol, in the usercontrol itself.
>
>Like this:
>
><form>
><asp:panel visibility=false .... </asp panel>
><user:control> //a function here turns the visibilty to
>true </user:control>
></form>
>
>Greetz,
>
>Lokhan Wong
>Lokhan_wong@hotmail.com
>
>//cogito ergo sum
>
>
In the usercontrol code behind I have:
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if(Page.IsPostBack)
{
// Find the control
System.Web.UI.WebControls.Panel ctrl =
(System.Web.UI.WebControls.Panel) Page.FindControl("MyPanel");
// Make it visible
ctrl.Visible = true;
// Abd Add some text
Label lbl = new Label();
lbl.Text = " Now you see me!";
ctrl.Controls.Add(lbl);
}
}
On the aspx page containing the usercontrol:
<form id="Form1" method="post" runat="server">
<asp:panel id="MyPanel" visible="False" runat="server">Hello</asp:panel>
<kk:MyControl id="MyControl" runat="server" />
</form>
From a design perspective I'd be wary of doing this because you are
creating a dependancy in the containing page and introducing some tight
coupling that will affect the user control's re-use in other pages..
HTH
Kev
Kevin Kenny Guest
-
Lokhan Wong #3
Re: Referencing a panel on a webform from an usercontrol
It worked. Thanks for the info.
The reason why I used it this way is because I wanted to
make a registering page made of several steps. Putting
every step in a seperate page would be unwise. Also
putting every step in a seperate panel on the page would
make the page unmanageable. So by putting every step in
its own usercontrol I can manage the code more easily.
("MyPanel");>-----Original Message-----
>Lokhan Wong wrote:
>>This is possible:>>My question is whether it's possible to change the
>>properties of a panel, that resides on the webform
>>containing the usercontrol, in the usercontrol itself.
>>
>>Like this:
>>
>><form>
>><asp:panel visibility=false .... </asp panel>
>><user:control> //a function here turns the visibilty to
>>true </user:control>
>></form>
>>
>>Greetz,
>>
>>Lokhan Wong
>>Lokhan_wong@hotmail.com
>>
>>//cogito ergo sum
>>
>>
>
>In the usercontrol code behind I have:
>
>private void Page_Load(object sender, System.EventArgs e)
>{
> // Put user code to initialize the page here
> if(Page.IsPostBack)
> {
> // Find the control
> System.Web.UI.WebControls.Panel ctrl =
>(System.Web.UI.WebControls.Panel) Page.FindControlrunat="server">Hello</asp:panel>>
> // Make it visible
> ctrl.Visible = true;
>
> // Abd Add some text
> Label lbl = new Label();
> lbl.Text = " Now you see me!";
> ctrl.Controls.Add(lbl);
> }
>}
>
>On the aspx page containing the usercontrol:
>
><form id="Form1" method="post" runat="server">
> <asp:panel id="MyPanel" visible="False"because you are> <kk:MyControl id="MyControl" runat="server" />
></form>
>
> From a design perspective I'd be wary of doing thisintroducing some tight>creating a dependancy in the containing page andother pages..>coupling that will affect the user control's re-use in>
>HTH
>Kev
>
>
>.
>Lokhan Wong Guest



Reply With Quote

