well, you can bind in a previous event of the page. for isntance. i've built a small page that shows the kind of problem you're gonna face with this approach:
public struct A
{
private string nome;
public string Nome
{
get { return nome; }
set { nome = value; }
}
private string morada;
public string Morada
{
get { return morada; }
set { morada = value; }
}
public A(string n, string m)
{
nome = n;
morada = m;
}
}
public void Bind()
{
A[] a= new A[]{
new A( "1", "1" ),
new A( "2", "2" ),
new A( "3", "3" )
};
grid.DataSource = a;
grid.DataBind();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
Bind();
}
void T(object sender, EventArgs Args)
{
info.Text = ((TextBox)sender).Text;
}
string Handle(A a)
{
return a.Nome;
}
Untitled Page
value=''
AutoPostBack="true"
OnTextChanged="T"/>
when you run the page you'll see that the label allways presents the text of the last row...
No comments:
Post a Comment