This is a migrated thread and some comments may be shown as answers.

[Solved] Binding RAD GRID Client side Error GridBinaryImageColumn when its BInd with Images

5 Answers 258 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Raghav Sharma
Top achievements
Rank 1
Raghav Sharma asked on 08 Oct 2009, 04:02 AM


                I have an problem in Binding Image in the GridBinaryImageColumn . The image comes in form of byte[] fromWebservices then serialize the data and same data deserilaize in the Javascriptnad bind to grid . The normal Bound column is working fine Let me show you howits work

<head id="Head1" runat="server">

  

   <telerik:RadCodeBlock ID="RadCodeBlock1"runat="server">

       <script type="text/javascript">

          

           function pageLoad(sender, args) {

          

WebService.JsonRecord(updateGrid);

           }

          

           function updateGrid(result) {

               //alert(result);

               var test =Sys.Serialization.JavaScriptSerializer.deserialize(result);

               var gridObject=$find("<%=RadGrid1.ClientID %>");

               var tableView = gridObject.get_masterTableView();

tableView.set_dataSource(test);

tableView.dataBind();

             

           }

           function OnRowDataBound(sender, args) {

              

               //alert(args.get_item().get_cell("txtModel"));

               varspanControl = args.get_item().get_cell("test").getElementsByTagName('img ')[0];

              

           }

          

       </script>

   </telerik:RadCodeBlock>

</head>

<body >

   <form runat="server"id="mainForm"method="post"style="width:100%;">

       <asp:ScriptManager  ID="RadScriptManager" runat="server">

           <Services>

               <asp:ServiceReference  Path="~/WebService.asmx" />

           </Services>

       </asp:ScriptManager>

      

       <telerik:RadGrid ID="RadGrid1"AutoGenerateColumns="false"runat="server"AllowPaging="true"PageSize="10">

           <MasterTableView>

               <Columns>

               

                    <telerik:GridBoundColumn   HeaderText="Model" DataField="txtModel">

                    </telerik:GridBoundColumn>  

                   

<telerik:GridBinaryImageColumnHeaderText="Images"DataField="binPicture"UniqueName ="test" ></telerik:GridBinaryImageColumn>

               

                    <telerik:GridBoundColumn   HeaderText="OEMPartNumber" DataField="txtOEMPartNumber">

                    </telerik:GridBoundColumn> 

                   

                

               </Columns>

           </MasterTableView>

           <ClientSettings>

               <ClientEvents OnCommand="function(){}"  />

            </ClientSettings>

       </telerik:RadGrid>

     

   </form>

  

</body>

This isa HTML and let me show you how its come from we services

  public objectJsonRecord()

    {

        JavaScriptSerializer javaSerializer = new JavaScriptSerializer();

       

        //List<string[]> lstEquipment = select();

        //List<string[]> lstEquipment = Test();

       

        List<Test>lstTest = foo();

       

        return javaSerializer.Serialize(lstTest);

   

    }

    [WebMethod]

    [ScriptMethod]

    public List<Test> foo()

    {

        List<Test>lstTest = new List<Test>();

        Test objTest = newTest();

lstTest=objTest.GetItems();

        return lstTest;

    }

Everytime I do thisits show the Error

“DataBinding: 'System.Data.DataRowView' does not containa property with the name 'binPicture'.”

Please any one Help me regarding this

5 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 14 Oct 2009, 05:27 AM
Hello Raghav,

You can not populate image on client by supplying it with byte array.
On possible way is to set src attribute to the image to some handler for example that will process the byte array as image.

Sincerely yours,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Raghav Sharma
Top achievements
Rank 1
answered on 15 Oct 2009, 03:52 AM
hi Nikolay

can you please some kind of example regarding handler in Telerik Grid this would be great help
Thanks
Raghav Sharma
0
Nikolay Rusev
Telerik team
answered on 20 Oct 2009, 10:56 AM
Hello Raghav,

Please find the attached application. It demonstrates client-side binding of RadGrid with GridImageColumn.

Best wishes,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Jidesh Guptha
Top achievements
Rank 1
answered on 26 Oct 2009, 02:25 PM
I too have similar issue. When went thru did not find the attachment.
0
Nikolay Rusev
Telerik team
answered on 27 Oct 2009, 09:41 AM
Hello Jidesh,

I am re-attaching sample application demonstrating population of GridImageColumn with client-side data-binding.

Regards,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Raghav Sharma
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Raghav Sharma
Top achievements
Rank 1
Jidesh Guptha
Top achievements
Rank 1
Share this question
or