How to concatenate two table columns into third column?

Janine Fechter asked on July 13, 2016 19:50

I'm new to Kentico and am trying to build a page that includes a person's name and title as a page form field.

I created a custom table "staffList" with fields for name and title. I want to create a third field that combines the Name and Title columns. What is the best method to combine these two fields?

I'm planning to use the combined column on a different Page as a field that would be a dropdown list - the options would be "Name 1, Title 1", "Name 2, Title 2", etc.

But I'm at a loss for how to combine the table fields.

Correct Answer

Saurav Kumar answered on July 14, 2016 14:26

If I am understanding it correct, you want these two fields concatenated to show in a different page. Use the Query for the form control as
"Select name+', '+title as NameTitle from staffList"
and it will display the concatenated values in the dropdown .

1 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on July 13, 2016 20:03

In the transformation you would specify it, assuming you're using a repeater.

  <tr>
    <td><%# Eval("FullName") %> - <%# Eval("Title") %></td>
  </tr>
0 votesVote for this answer Mark as a Correct answer

Janine Fechter answered on July 13, 2016 20:10

Thanks Brenden. I hadn't considered using a transform. I had originally thought it would be easier to concatenate the two fields into a third column. I appreciate the quick response!

0 votesVote for this answer Mark as a Correct answer

Janine Fechter answered on July 14, 2016 16:05

Thanks, that's exactly what I was trying to do.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.