Highlighted
Absent Member.
Absent Member.
549 views

Datagrid with image on Web

Jump to solution

How to work with Datagrid on the WEB and the column should be defined as an image.
The image will be brought from the database (.DAT).
I use Microfocus Cobol with Visual Cobol and use native database.

 

I tried ... but something is wrong

 

In .ASP, I wrote this code

  <asp:TemplateField HeaderText="Foto">
    <ItemTemplate>    
        <asp:Image ID="img" runat="server"
            ImageUrl=<%#Eval("wfoto") %> Width="100px" Height="100px" />     
    </ItemTemplate>
    </asp:TemplateField>   
 

 

In .asp.cbl (COBOL), this one

 

    declare Dt as type System.Data.DataTable
    invoke Dt::Columns::Add("wfoto",type System.Type::GetType::ToString())

   move "http://localhost:49955/Images/A30E.jpg" to wfoto

           move 1 to wind
           perform until wind > 10
               invoke Dt::Rows::Add(wfoto)
               add 1 to wind
           end-perform
           set GridView1::DataSource to Dt
           invoke GridView1::DataBind()

 

Someone can help me, please?

 


      

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Datagrid with image on Web

Jump to solution

What is the error that you are receiving?

With a couple changes in the program I can get it to work:

 

    declare Dt as type System.Data.DataTable = new System.Data.DataTable
    invoke Dt::Columns::Add("wfoto", type of type String)
	declare wfoto as string = "localhost:57484/.../logo.gif"
	perform varying wind as binary-long from 1 by 1 until wind > 10
       invoke Dt::Rows::Add(wfoto)
    end-perform
    set GridView1::DataSource to Dt
    invoke GridView1::DataBind

View solution in original post

2 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Datagrid with image on Web

Jump to solution

What is the error that you are receiving?

With a couple changes in the program I can get it to work:

 

    declare Dt as type System.Data.DataTable = new System.Data.DataTable
    invoke Dt::Columns::Add("wfoto", type of type String)
	declare wfoto as string = "localhost:57484/.../logo.gif"
	perform varying wind as binary-long from 1 by 1 until wind > 10
       invoke Dt::Rows::Add(wfoto)
    end-perform
    set GridView1::DataSource to Dt
    invoke GridView1::DataBind

View solution in original post

Highlighted
Absent Member.
Absent Member.

RE: Datagrid with image on Web

Jump to solution
Thank you !!!

I did test ad everything was work ok.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.