i write a function to find a control in formview:
#region
protected Control GetControlOfFormView(FormView fv, string strControlID)
{
Control ctl = new Control();
FormViewRow fvr = fv.Row;
TableCell tc = new TableCell();
Control CellCtl = new Control();
int nCell,nCellCtl;
int j, k;
nCell = fvr.Cells.Count;
for (j = 0; j < nCell; j++)
{
tc = fvr.Cells[j];
nCellCtl = tc.Controls.Count;
for (k = 0; k < nCellCtl; k++)
{
CellCtl = tc.Controls[k];
ctl = CellCtl.FindControl(strControlID);
if (ctl != null)
{
k = nCellCtl;
j = nCell;
}
}
}
return ctl;
}
#endregion
use it :
protected void FormView1_DataBound(object sender, EventArgs e)
{
DataRowView row = (DataRowView)FormView1.DataItem;
TextBox tb = null;
tb = (TextBox)GetControlOfFormView(FormView1, "textbox");
tb.Text = row["Bsf_FormID"].ToString();
}
thanks erveryone, if have good idea ,i want to know how you do it.thanks