lundi, avril 03, 2006

GridView template

Among the best composing of the gridView it is the use of the templates. Here are some methods for good handling them:

1 - Data Binding : Imagine we put on the template a TextBox named txtName, and we want to bind into the box the field UserName, first you must declare your data source

GV.Datasource = MyDataSet.Users

Then you can user 2 ways to do it, click right on the textbox and choose Databinding, on the binding field write :

DataBinder.Eval(Container.DataItem, "UserName")

Aucun commentaire: