Need a Query

I have 2 tables (tblQuestions and tblAnswers)
Column in the tables:
tblQuestions: QuestionId,Question
tblAnswers: AnswerId,QuestionId,Answer

I want a query with the results in a signle column as below:
Q: Where is Brooklyn bridge
A:  Los Angeles
      Washhington DC
      New York
      Chicago

Thanks in advance.  

cimscimsAsked:
Who is Participating?
 
malikirfan28Commented:
Instead of doing this in RadGrid. I suggest to keep your datasource (DataTable) which you bind with RadGrid in Session and when you want to move a row, move it in DataTable and then bind it with RadGrid.

I hope with this simple trick you will get what do you want.

0
 
malikirfan28Commented:
As you choosed to use the Detail Grid in RadGrid so you don't need to get this data in one query.
Your main RadGrid will be bounded to Questions table and then on Child Grid bound, you will need to get QuestionID and filter answer based on it and display Answers in Child Grid.
0
 
malikirfan28Commented:
Kindly correct if you are not working in Hierarchical RadGrid (Master-Detail RadGrid)?
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
knightEknightCommented:
select * from (
  select QuestionID, 0 as AnswerID, Question as Value
  from tblQuestion
  union
  select QuestionID, AnswerID, Answer as Value
  from tblAnswer
) tbl
order by 1,2
0
 
cimscimsAuthor Commented:
malikirfan28: I have plans to use Master-Detail Radgrid but i don't want the gridlines. I tried using Gridlines="None", it is not working. I think you have the format i was looking at in my earlier post. Please share your thoughts.
0
 
malikirfan28Commented:
You can remove the Grid Lines by customizing the CSS (style template). It will remove all Grid Lines.
0
 
Jagadishwor DulalBraces MediaCommented:
Why not use a join query which select all answer from tblAnswers Where questionid=tblquestions.questionid
0
 
cimscimsAuthor Commented:
malikirfan28: I have a problem if i use the hierarchy grid. I have move the Question and Answers row up and down in the radgrid. That's why i am looking to keep the Question and Answers in the same column.
0
 
malikirfan28Commented:
I am sure you can set the same format as you gave screen shot in another thread using RadGrid.

However I could not understand you here as what do you mean by row up and down?

Kindly note that you should understand how RadGrid populates its Detail (Child) Grid.

http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/hierarchyloadmodemixed/defaultcs.aspx
0
 
cimscimsAuthor Commented:
When the user selects the row and clicks on a up/down button, i have to move the rows up/down in the radgrid. Please see the below link for information:
http://www.telerik.com/community/forums/aspnet/grid/move-grid-rows-up-and-down.aspx
0
 
cimscimsAuthor Commented:
malikirfan28:
I have used the below link and i was able to

1) Move the rows up and down with the help of the below link
http://www.telerik.com/community/code-library/aspnet-ajax/grid/move-rows-up-down-using-radgrid-for-asp-net-ajax-prometheus.aspx

2) Format the grid as per the requirement. I wrote a Stored Procedure to get the Question and Answers to get into a single row.

I haven't tried your solution but my feeling is that would definetly work. Thank you for your time.


Move-Rows-up-and-down.png
0
 
cimscimsAuthor Commented:
Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.