Read carefully the answer
Iwant to display images from the table of SQL Server 200 to the datagrid of ASP.net using any VB.net or C# language.
I have Visual studio2003 with .Netframework1.1
It is not easy to answer this question?
It's pretty easy to do. You need to set up a template column in your datagrid and add an asp:image object with an ID myThumbID say to your template. Then, in the datagrid's ItemDataBound event (which you will either declare or register depending upon if you use C# or VB.Net), you'd use something like the following code
Protected Sub Item_Bound(ByVal sender As Object, ByVal e As DataGridItemEventArgs)
...
Dim myThumb as Image = e.Item.FindControl( "myThumbID" )
Dim imgsrc as string = Databinder.Eval( e.Item.DataItem ,"imageLocationColumn")
myThumb.src = imgsrc
....
Databinder.eval being used in case you bound your datagrid to a datatable or a dataview and "imageLocationColumn" being one of the columns of that bound object.
Some of this is off the top of my head. That should give you enough to start researching and figure things out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment