472,126 Members | 1,448 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,126 software developers and data experts.

control inheriting from CompositeDataBoundControl doesn't retreive it's state information.

I have a control derived from ComposeteDataBoundControl. Control doesn't
retreive it's state information. I am going to frick out! What should I do
I added two codes. One is for Default.aspx to Test the control
"SampleDataBound". When I click to the "Refresh" button here, the data
displayed in the SampleDataBound control become lost.


<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

<script runat="server" type="text/C#">
protected override void OnLoad(EventArgs e)



if (!Page.IsPostBack)


System.Collections.Generic.List<string> list = new




this.d.DataSource = list;





<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>Untitled Page</title>



<form id="form1" runat="server">


<Test:SampleDataBound runat="server" ID="d" EnableViewState="true" />


<asp:Button runat="server" ID="btn" Text="Refresh" />





public class SampleDataBound : CompositeDataBoundControl, INamingContainer


private Table table;

protected override int
CreateChildControls(System.Collections.IEnumerable dataSource, bool


System.Collections.IEnumerator e = dataSource.GetEnumerator();

table = new Table();


TableRow row = null;

TableCell cell = null;

int count = 0;

while (e.MoveNext())


row = new TableRow();

cell = new TableCell();

if (dataBinding)


cell.Text = e.Current.ToString();






return count;


Jun 29 '06 #1
0 1080

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by John Lau | last post: by
12 posts views Thread by Alex Clark | last post: by
7 posts views Thread by schaefty | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.