本文介绍了绑定评估值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里需要一些有关如何在gridview中正确绑定文本评估值的帮助.

请参见下面的代码.

Need some help here as to how to bind a text eval value properly in a gridview.

Please see code below.

 <asp:TemplateField HeaderText="Rate" Visible="True">
                    <ItemTemplate>
                       
                        <asp:Label ID="lblRate" runat="server"

Text='<%#GetLabelText(Eval("platinumRate"), Eval("goldRate"), Eval("silverRate"))%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>



后面的代码是:



code behind is:

public string GetLabelText(Object platinumRate, Object goldRate, Object silverRate)
       {
           if (DropDownList1.SelectedValue == "Platinum")
           {
               return DataBinder.Eval(platinumRate,"platinumRate").ToString();
           }
           else if (DropDownList1.SelectedValue == "Gold")
           {
               return DataBinder.Eval(goldRate, "goldRate").ToString();
           }
           else
           {
               return DataBinder.Eval(silverRate, "silverRate").ToString();
           }

       }



此刻我得到了错误:

数据绑定:"System.Decimal"不包含名称为"platinumRate"的属性.

如果可以的话请帮忙.

关于



At the moment I get the error:

DataBinding: ''System.Decimal'' does not contain a property with the name ''platinumRate''.

Please help if you can.

Regards

推荐答案


这篇关于绑定评估值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 20:43