Hi,

Don't understand why 'hello' doesn't appear in the buttons.
Check this code:
private void Page_Load(object sender, System.EventArgs e)
{

// Put user code to initialize the page here
ArrayList arr;
if(!IsPostBack)
{
arr=new ArrayList();
arr.Add("test1");
arr.Add("test2");
arr.Add("test3");

ViewState["arr"]=arr;

DataList1.DataSource=arr;
DataList1.DataBind();
}
arr=(ArrayList)ViewState["arr"];
arr[0]="hello";
ViewState["arr"]=arr;
}
arr[0] is now "hello" in the debugger as it should be.



I use this DataList:
<aspataList id="DataList1" style="Z-INDEX: 101; LEFT: 41px; POSITION: absolute; TOP: 28px" runat="server">
<ItemTemplate>
<asp:Button id="Button1" runat="server" CommandName="A"></asp:Button>
<asp:Button id="Button2" runat="server" CommandName="B"></asp:Button>
</ItemTemplate>
</aspataList>


I set the button text dynamically.

private void DataList1_ItemDataBound(object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
{
ArrayList arr=(ArrayList)ViewState["arr"];
foreach(Control wc in e.Item.Controls)
{
if(wc is Button)
{
Button bt=(Button)wc;
bt.Text=(string)arr[e.Item.ItemIndex];
}
}
}

Shouldn't 'hello' be in the first pair of buttons bound. It doesn't.

I appreciate any information from you on this.

Yours sincerely
Andla