Ticket Q246426
Visible to All Users

WebDataRow does not contain a property with the name

created 15 years ago

I have an aspxgridview control that from time to time throws an error: DataBinding: 'DevExpress.Web.Data.WebDataRow' does not contain a property with the name 'Relevanta'.
I checked the stored procedure that binds to the grid and the field it's there.
This is the aspx code where the stack trace points.
<dxwgv:GridViewDataColumn FieldName="Relevanta" Caption="Relevanta">
     <CellStyle HorizontalAlign="Left"></CellStyle>
          <DataItemTemplate>
                 <div style="width:100%;background-color:#FFFFFF;height:6px;border:1px solid #808080">
                          <div style='background-color:#2a5f99;width:<%#(10 * Convert.ToInt32(DataBinder.Eval(Container.DataItem, "Relevanta"))).ToString()%>%;height:6px;'></div>
                  </div>
          </DataItemTemplate>
       </dxwgv:GridViewDataColumn>
thanks

Answers approved by DevExpress Support

created 15 years ago (modified 12 years ago)

Hello Dan,
I've compared your issue with the DevExpress.Web.Data.WebDataRow' does not contain a property with the name report, and I assume that the grid doesn't have the datasource at the moment of binding. Can you try to change your code in the following way, and test that the DataBinder provides correct data:

ASPx
<dxwgv:GridViewDataColumn FieldName="Relevanta" Caption="Relevanta"> <CellStyle HorizontalAlign="Left"></CellStyle> <DataItemTemplate> <div style="width:100%;background-color:#FFFFFF;height:6px;border:1px solid #808080"> <div style='<%# GetText(Container) %>'></div> </div> </DataItemTemplate> </dxwgv:GridViewDataColumn>
C#
public String GetText(Object container) { GridViewDataItemTemplateContainer cont = container as GridViewDataItemTemplateContainer; // check this string: container.DataItem != null Object rel = DataBinder.Eval(cont.DataItem, "Relevanta"); // rel isn't null or empty Int32 width = 10 * Convert.ToInt32(rel); return String.Format("background-color: #2a5f99; width: {0}; ;height:6px;", width); }

If my tips don't help you, please provide a small example, so I can reproduce the issue on my side, or the ASPX page layout, so I can create an example by myself.
Thanks,
Vest

    Comments (2)
    KR KR
    Karthik Rathinavel 12 years ago

      What if you want to use Bind() instead of Eval() ?

      DevExpress Support Team 12 years ago

        Hello Dave,
        I am not sure about the use of the Bind method. It cannot replace the GetText method since the latter contains additional logic rather than simple binding to a data field.
        If you wish to replace the DataBinder.Eval method, I am afraid that it is impossible since the DataBinder class does not provide the method for two-way data binding ('Bind').

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.