Dynamic column value mapping

3 posts, 0 answers
  1. George
    George avatar
    17 posts
    Member since:
    May 2014

    Posted 02 Mar 2018 Link to this post

    Hi,

    I have a Radgrid with a ColName that consist of value of A to G, that represent the value to be displayed in the corresponding column (Column A, Column B, etc) with the value of ID. Kindly refer to the attached image.

    Below is the logic, but I'm not familiar with the correct syntax, can anyone please correct my syntax such as how to retrieve and set the value from the column.

    Thank you.

     

    Best regards,

    George

     

     

     

     

     

     

  2. George
    George avatar
    17 posts
    Member since:
    May 2014

    Posted 02 Mar 2018 Link to this post

     

        protected void dg_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
        {
            if (e.Column.UniqueName.Contains("ColName"))
            {
                if (e.Column.ToString() == "A")
                {
                    e.Column.UniqueName.Contains("A").Value = e.Column.UniqueName.Contains("ID").ToString();
                }
                else if (e.Column.ToString() == "B")
                {
                    e.Column.UniqueName.Contains("B").Value = e.Column.UniqueName.Contains("ID").ToString();
                }
                else if (e.Column.ToString() == "C")
                {
                    e.Column.UniqueName.Contains("C").Value = e.Column.UniqueName.Contains("ID").ToString();
                }
                else if (e.Column.ToString() == "D")
                {
                    e.Column.UniqueName.Contains("D").Value = e.Column.UniqueName.Contains("ID").ToString();
                }
                else if (e.Column.ToString() == "E")
                {
                    e.Column.UniqueName.Contains("E").Value = e.Column.UniqueName.Contains("ID").ToString();
                }

            }

        }

     

     

  3. George
    George avatar
    17 posts
    Member since:
    May 2014

    Posted 06 Mar 2018 Link to this post

    Anyone can help?

     

Back to Top