Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Best option for persisting pageview contents?

Reply
Thread Tools

Best option for persisting pageview contents?

 
 
mawi
Guest
Posts: n/a
 
      07-08-2004
Hello again,

I posted this question without code, here is the code.

Again, the problem is: Viewstate of a pageviews child
controls is not saved as it would be if the control were
child of the page.

Any clues as to how to resolve this in the best way are
greatly appreciated. If one could make a control child of
multiple parents I could use Denis Bauers placeholder, but
afaik that is not possible.

Notice that this will probably not run using vanilla ie
webcontrols code, due to the bug I've posted about recently.

/mawi

Code (save as aspx file in a webroot, put
"Microsoft.Web.UI.WebControls.dll" - preferably bugfixed -
in "bin" directory of that root):

<%@ Page language="c#" AutoEventWireup="true" %>
<%@ Register TagPrefix="iewc"
Namespace="Microsoft.Web.UI.WebControls"
Assembly="Microsoft.Web.UI.WebControls" %>
<script runat="server">
void Page_Load()
{
for ( int i = 1; i <= TabStrip1.Items.Count; i++ )
NewPV( i.ToString() );
}
private void addTab(object sender, System.EventArgs e)
{
String count = (TabStrip1.Items.Count + 1).ToString();
Tab t = new Tab();
t.Text = t.ID = "Tab_" + count;
PageView pv = NewPV( count );
t.TargetID = pv.ID;
pv.Controls.Add( new Label() );
( pv.Controls[ 1 ] as Label ).Text = "Persist this!!";
TabStrip1.Items.Add( t );
}
private PageView NewPV( String count )
{
PageView pv = new PageView();
pv.Controls.Add( new Literal() );
( pv.Controls[ 0 ] as Literal ).Text = "<H1>Page for tab
" + count + "</H1>";
MultiPage1.Controls.Add( pv );
pv.ID = "page_" + count;
return pv;
}
</script>
<html>
<body>
<form runat="server">
<asp:button id="addBtn" runat="server" Text="+Tab"
OnClick="addTab" />
<iewc:tabstrip id="TabStrip1" runat="server"
targetid="MultiPage1" />
<iewc:multipage id="MultiPage1" runat="server" />
</form>
</body>
</html>

 
Reply With Quote
 
 
 
 
mawi
Guest
Posts: n/a
 
      07-09-2004
Hi,

actually my code was in error on this. Viewstate if child
controls of pageviews is persisted. Corrected code follows
(note that it requires the bugfix I posted recently to work).


<%@ Page language="c#" AutoEventWireup="true" %>
<%@ Register TagPrefix="iewc"
Namespace="Microsoft.Web.UI.WebControls"
Assembly="Microsoft.Web.UI.WebControls" %>
<script runat="server">
void Page_Load()
{
for ( int i = 1; i <= TabStrip1.Items.Count; i++ )
NewPV( i.ToString() );
}
private PageView NewPV( String count )
{
PageView pv = new PageView();
pv.Controls.Add( new Literal() );
pv.Controls.Add( new Label() );
MultiPage1.Controls.Add( pv );
pv.ID = "page_" + count;
return pv;
}
private void addTab(object sender, System.EventArgs e)
{
String count = (TabStrip1.Items.Count + 1).ToString();
Tab t = new Tab();
t.Text = t.ID = "Tab_" + count;
PageView pv = NewPV( count );
t.TargetID = pv.ID;
( pv.Controls[ 1 ] as Label ).Text = "Persist this!!";
( pv.Controls[ 0 ] as Literal ).Text = "<H1>Page for tab
" + count + "</H1>";
TabStrip1.Items.Add( t );
}
</script>
<html>
<body>
<form runat="server">
<asp:button id="addBtn" runat="server" Text="Add Tab"
OnClick="addTab" />
<iewc:tabstrip id="TabStrip1" runat="server"
targetid="MultiPage1" />
<iewc:multipage id="MultiPage1" runat="server" />
</form>
</body>
</html>

 
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
Tabstrip and position and formatting multipage pageview gce ASP .Net 0 03-30-2005 08:52 AM
HOW TO: showing datagrid in multipage (pageview) RedEagle ASP .Net 0 08-20-2004 10:16 AM
Adding dynamic controls to pageview - set location elad ASP .Net Building Controls 0 11-06-2003 02:22 PM
the line between tab and the pageview David ASP .Net Web Controls 0 09-16-2003 04:33 PM
WebControls: TabStrip, MultiPage, PageView szabelin ASP .Net 1 08-20-2003 07:24 AM



Advertisments