David

David

  • NA
  • 3
  • 0

How to bind data to Text box

Jun 13 2006 3:57 AM

Hi,

I use a filter on a sqlDataSource which has uniq rows. I need to bind several fields of the result filtered row to textboxes. Here the code :

SqlDataSource dsPrev = (SqlDataSource)PreviousPage.FindControl("SqlDataSource1");
dsPrev.FilterExpression = "dr_id='" + id + "' ";
GridView gvTemp = new GridView();
gvTemp.DataSource = dsPrev;
gvTemp.DataBind();
TextBox1.Text = gvTemp.Rows[0].Cells[3].Text;

Is there a more professional way to do it ?

Thanks,

David


Answers (3)