|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Display an images in DatagridHi All,
heres an easy question which for benig new , i cannot figure it out. A datatable pulled from the database which has 10 columns is binded to a datagrid and it shows all of them in the datagrid successfully. Now i want to add an image next to each record inteh grid, the image is stored on the server( not in the dabtase) but the datatable has the path of the image (since the path is stored in the database). The question is how can i show this image in the datagrid right next to each record. Woudl be great if someone points to samples. thanks You can add a TemplateColumn with a Image server control defined inside its
ItemTemplate: <asp:TemplateColumn HeaderText="Person Name"> <ItemTemplate> <asp:Image ImageUrl =<%# DataBinder.Eval(Container.DataItem, "ImagePath")%> Runat=server ></asp:Image> </ItemTemplate> </asp:TemplateColumn> Show quoteHide quote "sameer" wrote: > Hi All, > heres an easy question which for benig new , i cannot figure it out. > > A datatable pulled from the database which has 10 columns is binded to a > datagrid and it shows all of them in the datagrid successfully. Now i want to > add an image next to each record inteh grid, the image is stored on the > server( not in the dabtase) but the datatable has the path of the image > (since the path is stored in the database). > > The question is how can i show this image in the datagrid right next to each > record. > Woudl be great if someone points to samples. > > thanks > right now i did not set any template for the columns of this grid,i jsut take
the datatable and bind it to the datagrid. So when i add this template column , woudl i have to change any properties like define all the other columns as well? or it shold work seemless? thanks Show quoteHide quote "Phillip Williams" wrote: > You can add a TemplateColumn with a Image server control defined inside its > ItemTemplate: > > <asp:TemplateColumn HeaderText="Person Name"> > <ItemTemplate> > <asp:Image ImageUrl =<%# DataBinder.Eval(Container.DataItem, "ImagePath")%> > Runat=server ></asp:Image> > </ItemTemplate> > </asp:TemplateColumn> > > -- > HTH, > Phillip Williams > http://www.societopia.net > http://www.webswapp.com > > > "sameer" wrote: > > > Hi All, > > heres an easy question which for benig new , i cannot figure it out. > > > > A datatable pulled from the database which has 10 columns is binded to a > > datagrid and it shows all of them in the datagrid successfully. Now i want to > > add an image next to each record inteh grid, the image is stored on the > > server( not in the dabtase) but the datatable has the path of the image > > (since the path is stored in the database). > > > > The question is how can i show this image in the datagrid right next to each > > record. > > Woudl be great if someone points to samples. > > > > thanks > > Hi Sameer,
Explicitly declared template columns appear first followed by the Auto-generated columns. --- HTH, Phillip Williams http://www.societopia.net http://www.webswapp.com Show quoteHide quote "sameer" wrote: > right now i did not set any template for the columns of this grid,i jsut take > the datatable and bind it to the datagrid. So when i add this template column > , woudl i have to change any properties like define all the other columns as > well? or it shold work seemless? > > thanks > > "Phillip Williams" wrote: > > > You can add a TemplateColumn with a Image server control defined inside its > > ItemTemplate: > > > > <asp:TemplateColumn HeaderText="Person Name"> > > <ItemTemplate> > > <asp:Image ImageUrl =<%# DataBinder.Eval(Container.DataItem, "ImagePath")%> > > Runat=server ></asp:Image> > > </ItemTemplate> > > </asp:TemplateColumn> > > > > -- > > HTH, > > Phillip Williams > > http://www.societopia.net > > http://www.webswapp.com > > > > > > "sameer" wrote: > > > > > Hi All, > > > heres an easy question which for benig new , i cannot figure it out. > > > > > > A datatable pulled from the database which has 10 columns is binded to a > > > datagrid and it shows all of them in the datagrid successfully. Now i want to > > > add an image next to each record inteh grid, the image is stored on the > > > server( not in the dabtase) but the datatable has the path of the image > > > (since the path is stored in the database). > > > > > > The question is how can i show this image in the datagrid right next to each > > > record. > > > Woudl be great if someone points to samples. > > > > > > thanks > > >
VS2005 is a PIECE of Garbage and is bug Ridden
Checkbox and Javascript VS2005 DataList with Nested GridView using ObjectDataSource BoundField and DataFormatString in ASP.NET 2.0 - Bug ? issues using webbrowser in a service drop down list box - client side code won't execute OnSelectedIndexChange GridView whole row select Custom control that ingerits from textbox Losing Session Values gridview.boundfield.dataformatstring doesn't work |
|||||||||||||||||||||||