reloading a user control from within another user contorl

T

TB

Hi All:

A very simple question, which I hope has a simple answer:

On page.aspx I have two user controls: part1.ascx and part2.ascx

How can I trigger the reloading of part2.ascx from within part1.ascx?

In other words I would like part1.ascx to contain something like:

if whatever then
reload part2.ascx
End if

Any suggestions will be highly appreciated.

Thanks

TB
 
P

Progman

use the loadcontrol method

i could never get the child control script to work.
it's like if it was not considered.
 
T

TB

Hi, thanks for replying, but do you mind cutting in out in cardboard
letters for this newbie. Perhaps I should also explain myself a little
better.

Page.aspx looks like this (simplified here)

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="page.aspx.vb" Inherits="test.home" %>
<%@ Register TagPrefix="test" Tagname="part1" Src="part1.ascx"%>
<%@ Register TagPrefix="test" Tagname="part2" Src="part2.ascx"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
<LINK href="styles.css" type="text/css" rel="stylesheet">
</HEAD>
<body>
<div id="wrapper">
<form id="Form1" method="post" runat="server">
<div id="top"><test:part1 id="part1"
runat="server"></test:part1></div>
<div id="bottom"><test:part2 id="part2"
runat="server"></test:part2></div>
</form>
</div>
</body>
</HTML>

Now, inside part1.ascx, I am paging through records in a table (lets
call it table1) of a database, displaying a lot of fields. However
there is another table in part2.ascx which shows related records from
another table (table2) in a datagrid. So what I want is that each time
a new record is displayed in part1.ascx, part2.ascx is reloaded
displaying the related records from table2 in the datagrid. My idea is
therefore to store as a session variable the current record number (the
primary key) of table1, and then add the necessary code to the click
events of the "next" and "previous" buttons of part1.ascx which would
update the session variable and then cause the part2.ascx to reload.
The session variable mentioned before would act as the variable element
in the sql statement firing the dataadapter behind the datagrid in
part2.ascx. Following your advice, I have tried to simply add:

loadcontrol("part2.ascx)"

to the click event codes (after updated the session variable) but
nothing happens.

Thanks in advance,

TB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top