我在我的 aspx 页面上有 Dropdwon:
<td>
<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1" DataTextFormatString = "{0} - {1}" DataTextField = "value1,value2" DataValueField="Value2" class="ctrDropDown" onBlur="this.className='ctrDropDown';" onMouseDown="this.className='ctrDropDownClick';" onChange="this.className='ctrDropDown';">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:XXXX_DevConnectionString_ddl %>"
SelectCommand="SELECT ParamId, ParamType, Value1, Value2, Value3, Status FROM Parameter WHERE (ParamType = 'BankId')">
</asp:SqlDataSource>
</td>
我想让数据文本字段显示在 value1 - value2 中,我这样做了,DataTextFormatString = "{0} - {1}" DataTextField = "value1,value2"
但它给了我一个错误:
Exception Details: System.Web.HttpException: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'value1,value2'.
是我的代码错了吗?还是我错过了什么?