Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Load User Control on link click

Reply
Thread Tools

Load User Control on link click

 
 
Kiki
Guest
Posts: n/a
 
      07-06-2004
Hello,
i'm a newbie on .NET so not even sure what i can and cannot do.
Here's the deal.
I have 2 user controls on a page: one is the left side menu and in the
middle there are some linkable images. What i'd like to do is, instead
of redirecting to a page when a link (from the menu or the image) is
clicked, so load a control on the right of the page that will display
some info, thus allowing the user to have a quick look to decide
whether or not he/she wants to view the page.. Initially, this 3rd
control will be something general and then, after the user selects an
item it will load the appropriate control.
Is this possible?
in short...

<table>
<tr>
<td align="left" width="20%">
<asplaceholder id="ph1" runat="server" />
</td>
<td align="center" width="40%">
<asplaceholder id="ph2" runat="server" />
</td>
<td align="right" width="20%">
<asplaceholder id="ph3" runat="server" />
</td>
</tr>
</table>

private void Page_Load(object sender, System.EventArgs e)
{
LeftMenu leftMenuControl = (LeftMenu) LoadControl
("UserControls/LeftMenu.ascx");
this.ph1.Controls.Add(leftMenuControl);
Control secondControl= (Control )
LoadControl("UserControls/SecondControl.ascx");
this.ph2.Controls.Add(secondControl);
}

i hope this is clear and thank you for your help.

K
 
Reply With Quote
 
 
 
 
Bobby Ryzhy
Guest
Posts: n/a
 
      07-06-2004
You will have to use <div> tags and javascript to make them visible
and not.

example:
<script language="javascript">
<!--
function ShowDiv(divToShow)
{
var objs = document.all;

for (var i=0; i<objs.length; i++)
{
if (objs[i].id.indexOf('linkDiv') == -1)
{
if (objs[i].style.visibility == 'visible')
{
objs[i].style.visibility = 'hidden'
objs[i].style.display = 'none'
}
}
}

var obj = document.getElementById(divToShow);

if (typeof(obj) != "undefined")
{
obj.style.visibility = 'visible';
obj.style.display = 'block';
}
}
-->
</script>

<div id="Div1" style="DISPLAY: none; VISIBILITY: hidden"
runat="server">
CONTENT
</div>


Bobby Ryzhy
bobby@ name of domain below
http://www.weekendtech.net



On 6 Jul 2004 07:36:27 -0700, http://www.velocityreviews.com/forums/(E-Mail Removed) (Kiki) wrote:

>Hello,
>i'm a newbie on .NET so not even sure what i can and cannot do.
>Here's the deal.
>I have 2 user controls on a page: one is the left side menu and in the
>middle there are some linkable images. What i'd like to do is, instead
>of redirecting to a page when a link (from the menu or the image) is
>clicked, so load a control on the right of the page that will display
>some info, thus allowing the user to have a quick look to decide
>whether or not he/she wants to view the page.. Initially, this 3rd
>control will be something general and then, after the user selects an
>item it will load the appropriate control.
>Is this possible?
>in short...
>
><table>
> <tr>
> <td align="left" width="20%">
> <asplaceholder id="ph1" runat="server" />
> </td>
> <td align="center" width="40%">
> <asplaceholder id="ph2" runat="server" />
> </td>
> <td align="right" width="20%">
> <asplaceholder id="ph3" runat="server" />
> </td>
> </tr>
></table>
>
>private void Page_Load(object sender, System.EventArgs e)
>{
> LeftMenu leftMenuControl = (LeftMenu) LoadControl
>("UserControls/LeftMenu.ascx");
> this.ph1.Controls.Add(leftMenuControl);
> Control secondControl= (Control )
>LoadControl("UserControls/SecondControl.ascx");
> this.ph2.Controls.Add(secondControl);
>}
>
>i hope this is clear and thank you for your help.
>
>K


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
click click click Andy Morrison Computer Support 7 12-20-2007 06:50 AM
Synthetic click on link doesn't follow link Peter Michaux Javascript 2 06-05-2007 02:43 AM
persisting changes to a control outside a user control from the user control? Mad Scientist Jr ASP .Net 0 03-22-2006 08:02 AM
Page load of the parent page called twice when a modal dialog is opened from a button click of the user control on the parent page Samy ASP .Net 2 08-15-2005 03:30 PM
Click link in popup window and insert link text in a field of mother window BlueŽ Javascript 4 09-27-2003 05:18 PM



Advertisments