gpt4 book ai didi

c# - 无法将类型 'double' 隐式转换为 'RadTextBox'

转载 作者:太空宇宙 更新时间:2023-11-03 21:47:53 25 4
gpt4 key购买 nike

我有一个小问题,我这里有一个 RadTextBox,它应该在数据库中接收浮点值,日期类型也是浮点,所以现在如果我想绑定(bind) RadTextBox,总会出现这个奇怪的错误

Error 4 Cannot implicitly convert type 'double' to 'Telerik.Web.UI.RadTextBox'

我需要解析还是其他?

我的代码

private void bindData()
{
this.cbActive.Checked = this.paramBR.GetActive();
this.rtbCode.Text = this.paramBR.Code;
this.rtbDescription.Text = this.paramBR.Description;
this.rtbHourlyRate = this.paramBR.HourlyRate;
}

BillingRate br = ctx.BillingRate.Where(yx => yx.BillingRateId == this.paramBR.BillingRateId).FirstOrDefault();
if (br == null)
{
br = new BillingRate();
newEntity = true;
}
br.Code = this.rtbCode.Text;
br.Description = this.rtbDescription.Text;
br.SetActive(this.cbActive.Checked);
br.HourlyRate = this.rtbHourlyRate.Text;
br.CreatedDate = DateTime.Now;
br.CreatedBy = this.User.UserId;

最佳答案

你应该使用 .Text最后一行中的属性并使用 .ToString()double 转换为 string 的方法。

this.rtbHourlyRate.Text = this.paramBR.HourlyRate.ToString();

关于c# - 无法将类型 'double' 隐式转换为 'RadTextBox',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16015074/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com