简体   繁体   中英

How do I bind a non database column value to repeater label using asp.net

I have a little challenge that I can't get around. I have a result from the code below.

if (Request.Cookies["ProductRecord"] != null)
{
    s = Convert.ToString(Request.Cookies["ProductRecord"].Value);
    string[] strArr = s.Split('|');
    for (int i = 0; i < strArr.Length; i++)
    {
        t = Convert.ToString(strArr[i].ToString());
        string[] strArr1 = t.Split(',');
        for (int j = 0; j < strArr1.Length; j++)
        {
            a[j] = strArr1[j].ToString();

        }
        SingleCount = (Convert.ToDecimal(a[1].ToString()) * Convert.ToDecimal(a[3].ToString()));

    }
}

How do I bind the results of SingleCount to a label inside a repeater.

RepeaterId.DataSource = SingleCount is the closest i have thought of but its not working.

我根据您的代码进行了一些假设,因此我可能会偏离您要实现的目标,但是您不能采用SingleCount并将其添加到小数列表中,然后将该列表绑定到你的中继器?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM