how to put value in Label inside gridview during runtime?

Posted by nhoyti on Stack Overflow See other posts from Stack Overflow or by nhoyti
Published on 2010-06-14T08:00:29Z Indexed on 2010/06/14 8:12 UTC
Read the original article Hit count: 176

Filed under:
|

how to put value in Label inside gridview during runtime? I want to put dynamic values in my label inside gridview during pageload. here's my sample code

    private void SplitStrings()
    {
        List<string> listvalues = new List<string>();
        listvalues = (List<string>)Session["mylist"];
        string[] strvalues = listvalues.ToArray();

        if (listvalues != null)
        {
            foreach (string strElement in listvalues)
            { 
                string[] test = strElement.ToString().Split("|".ToCharArray());
                string prodQuantity = test[0].ToString();
                foreach (GridView row in gvOrderProducts.Rows)
                {
                    prodQuantity = ((Label)row.FindControl("lblQuantity")).Text;
                }
            }
        }
    }

i want the lblQuantity label to display the values of quantity in my gridview

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET