Skip to main content

Datagrid with image on Web

  • June 7, 2018
  • 2 replies
  • 0 views

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 "localhost:49955/.../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?

 


      

2 replies

Chris Glazier
Forum|alt.badge.img+2

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 "localhost:49955/.../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?

 


      

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

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 "localhost:49955/.../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?

 


      

Thank you !!!

I did test ad everything was work ok.