I have a GridView with one template column which contains a user control (an Image and a Label). I use the code below to get list of images in a directory:
string[] filePaths = Directory.GetFiles(Server.MapPath("~/Resources/Pictures"),"*.jpg");
GridView1.DataSource = filePaths;
GridView1.DataBind();
It will create an extra column which contains the image's path. for example if we have 5 files in the folder, then we have 5 rows in our gridview. But in first column which is a template column with user control, you can see raw image and raw label. It means in every row we have a template column with raw controls and a column which contains image's path getting from code above. I need to access the user control's image and label control and update them in each row.
For example if in first row image's path is "~/pics/.jpg" I need to update the image control's imageurl to this path so we can see the image and then I need to update the label's text into another text.
How Can I do this and access to template column's controls in each row?
Aucun commentaire:
Enregistrer un commentaire