Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

asp.net - display data differently in a datagrid -


i have following in data table , want display differently in second example below in datagrid. 1 know if there way this?

userid          questions                                      answers  1            dog’s name                            belle  1            tell why should win.                  because need win  2            dog’s name                            leigh  2            tell why should win.                  i’ve never won before 

i'd result displayed below in grid view.

userid      question: dog’s name       question: tell why should win.  1                  answer: belle                       answer: because need win  2                  answer: leigh                       answer: i’ve never won before 

this going:

public class questionanswermap {     public string question { get; set; }     public string answer { get; set; } }  class program {      static void main(string[] args)     {         var list = new list<questionanswermap>();         list.add(new questionanswermap() { question = "q1", answer = "a1" });         list.add(new questionanswermap() { question = "q1", answer = "a2" });         list.add(new questionanswermap() { question = "q2", answer = "a3" });         list.add(new questionanswermap() { question = "q2", answer = "a4" });         list.add(new questionanswermap() { question = "q2", answer = "a5" });          var result = list.groupby(y => y.question).todictionary(y => y.key);         foreach (var item in result)         {             console.writeline("question: " + item.key);             foreach(var value in item.value.tolist())                 console.writeline("answer: {0}", value.answer);         }         console.readline();     } } 

i'm illustrating first table questionanswermap. grouping per question answers per question. when have shouldn't hard build gridview dynamically.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -