Click here to Skip to main content
15,912,400 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Asp to asp.net 2.0 migration Pin
Ankur\m/29-Apr-10 0:12
professionalAnkur\m/29-Apr-10 0:12 
QuestionSend online SMS [modified] Pin
lrsalunkhe25-Apr-10 19:55
lrsalunkhe25-Apr-10 19:55 
AnswerRe: Send online SMS Pin
Michel Godfroid25-Apr-10 20:45
Michel Godfroid25-Apr-10 20:45 
AnswerRe: Send online SMS Pin
Michel Godfroid25-Apr-10 23:56
Michel Godfroid25-Apr-10 23:56 
QuestionDrag And Drop between 2 listboxes in ASP.NET Pin
AnandDesai1925-Apr-10 19:15
AnandDesai1925-Apr-10 19:15 
AnswerRe: Drag And Drop between 2 listboxes in ASP.NET Pin
Brij25-Apr-10 20:45
mentorBrij25-Apr-10 20:45 
AnswerRe: Drag And Drop between 2 listboxes in ASP.NET Pin
Abhijit Jana25-Apr-10 20:51
professionalAbhijit Jana25-Apr-10 20:51 
QuestionRadGrid - dynamically building a grid and adding a hierarchy with declarative relations row? Pin
Steve Holdorf25-Apr-10 14:11
Steve Holdorf25-Apr-10 14:11 
I have searched the internet and can't find out what my final problem is. What I have is a RadGrid that I am adding a bound sub-column to a parent bound column. Now, the relation field's bound column appearing but even though I am binding a List<> to it I get the message: No child records to display. Below is the code so if anyone can help with my final problem that would be great!



public partial class _Default : System.Web.UI.Page
{
protected RadGrid grid;
protected static List<testlistitem> list = new List<testlistitem>();
protected static List<testlistitem2> list2 = new List<testlistitem2>();

override protected void OnInit(EventArgs e)
{
DefineGridStructure();
base.OnInit(e);
}
private void DefineGridStructure()
{
this.grid = new RadGrid();
this.grid.AutoGenerateColumns = false;
this.grid.NeedDataSource += new GridNeedDataSourceEventHandler(OnNeedDataSource);
this.grid.ItemDataBound += new GridItemEventHandler(grid_ItemDataBound);
this.grid.DetailTableDataBind += new GridDetailTableDataBindEventHandler(grid_DetailTableDataBind);
this.grid.AllowMultiRowEdit = true;
this.grid.AllowPaging = true;
this.grid.AllowSorting = true;
this.grid.Width = 700;



//other columns definitions ----------------------------
string gridEditColumnLinkName = "Action Column";
GridEditCommandColumn gridEditColumn = new GridEditCommandColumn();
gridEditColumn.ButtonType = GridButtonColumnType.LinkButton;
gridEditColumn.EditText = "Edit";
gridEditColumn.UpdateText = "Save";
gridEditColumn.CancelText = "Cancel";
gridEditColumn.UniqueName = "ActionButton";
gridEditColumn.HeaderText = gridEditColumnLinkName;
gridEditColumn.HeaderStyle.Width = 50;

string boundColumnName1 = "Column 1";
GridBoundColumn boundColumn1 = new GridBoundColumn();
boundColumn1.DataField = "A";
boundColumn1.UniqueName = "Column1";
boundColumn1.HeaderText = boundColumnName1;
boundColumn1.HeaderStyle.Width = 300;

string boundColumnName2 = "Column 2";
GridBoundColumn boundColumn2 = new GridBoundColumn();
boundColumn2.DataField = "B";
boundColumn2.UniqueName = "Column2";
boundColumn2.HeaderText = boundColumnName2;
boundColumn2.HeaderStyle.Width = 300;

string boundColumnName3 = "Column 3";
GridBoundColumn boundColumn3 = new GridBoundColumn();
boundColumn3.DataField = "C";
boundColumn3.UniqueName = "Column3";
boundColumn3.HeaderText = boundColumnName3;
boundColumn3.HeaderStyle.Width = 300;

string dropdownColumnName = "Dropdown Column2";
GridBoundColumn dropdownColumn = new GridBoundColumn();
dropdownColumn.UniqueName = "Column4";
dropdownColumn.DataField = "D";
dropdownColumn.HeaderText = dropdownColumnName;
dropdownColumn.HeaderStyle.Width = 300;

//Detail table - (II in hierarchy level)
GridTableView tableView = new GridTableView(this.grid);
tableView.Width = Unit.Percentage(100);

tableView.DataKeyNames = new string[1] { "A1" };

GridRelationFields relationFields = new GridRelationFields();
relationFields.MasterKeyField = "A";
relationFields.DetailKeyField = "A1";
tableView.ParentTableRelation.Add(relationFields);

grid.MasterTableView.DetailTables.Add(tableView);

//Add columns
GridBoundColumn boundColumnr = new GridBoundColumn();
boundColumnr.DataField = "A1";
boundColumnr.HeaderText = "A1";
tableView.Columns.Add(boundColumnr);

this.grid.MasterTableView.DataKeyNames = new string[] { "A" };
this.grid.MasterTableView.Columns.Add(gridEditColumn);
this.grid.MasterTableView.Columns.Add(boundColumn1);
this.grid.MasterTableView.Columns.Add(boundColumn2);
this.grid.MasterTableView.Columns.Add(boundColumn3);
this.grid.MasterTableView.Columns.Add(dropdownColumn);
this.grid.MasterTableView.EditMode = GridEditMode.InPlace;
grid.PageSize = 5;
grid.ClientSettings.Scrolling.ScrollHeight = 230;
grid.ClientSettings.Scrolling.ScrollWidth = 750;
grid.ClientSettings.EnableClientKeyValues = true;
this.PlaceHolder1.Controls.Add(grid);

}

void grid_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e)
{
e.DetailTableView.DataSource = list2;

}



void grid_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
GridDataItem item = e.Item as GridDataItem;

if (e.Item.IsInEditMode)
{

}
}
}

protected void Page_Load(object sender, EventArgs e)
{
List<string> alist = new List<string>();
list = new List<testlistitem>();
list2 = new List<testlistitem2>();

alist.Add("1");
alist.Add("2");
alist.Add("3");
alist.Add("4");
alist.Add("5");
alist.Add("5");
list.Add( new TestListItem( "ItemA 0", "ItemB a", "ItemC a", "ItemD a", alist ));
list.Add( new TestListItem( "ItemA 1", "ItemB b", "ItemC b", "ItemD b", alist ));
list.Add( new TestListItem( "ItemA 2", "ItemB c", "ItemC c", "ItemD c", alist ));
list.Add( new TestListItem( "ItemA 3", "ItemB d", "ItemC d", "ItemD d", alist ));
list.Add( new TestListItem( "ItemA 4", "ItemB e", "ItemC e", "ItemD e", alist ));
list.Add( new TestListItem( "ItemA 5", "ItemB f", "ItemC f", "ItemD f", alist ));

list2.Add (new TestListItem2("SubItem A"));
list2.Add(new TestListItem2("SubItem B"));
list2.Add(new TestListItem2("SubItem C"));
list2.Add(new TestListItem2("SubItem D"));
list2.Add(new TestListItem2("SubItem E"));
list2.Add(new TestListItem2("SubItem F"));
}


void OnNeedDataSource(object source, GridNeedDataSourceEventArgs e)
{
if (!e.IsFromDetailTable)
{
grid.DataSource = list;
}
else
{
//grid.MasterTableView.DataSource = list2;
}
}

public class TestListItem
{
private string _a;
private string _b;
private string _c;
private string _d;
List<string> _aList;

public TestListItem( string a, string b, string c, string d,List<string> aList )
{
this._a = a;
this._b = b;
this._c = c;
this._d = d;
this._aList = aList;
}

public string A
{
get
{
return this._a;
}
set
{
this._a = value;
}
}



public string B
{
get
{
return this._b;
}

set
{
this._b = value;
}

}

public string C
{
get
{
return this._c;
}

set
{
this._c = value;
}

}
public string D
{
get
{
return this._d;
}

set
{
this._d = value;
}

}

public List<string> AList
{
get
{
return this._aList;
}
set
{
this._aList = value;
}
}
}

public class TestListItem2
{
private string _a1;

public TestListItem2(string a1)
{
this._a1 = a1;
}

public string A1
{
get
{
return this._a1;
}
set
{
this._a1 = value;
}
}

}
}
AnswerRe: RadGrid - dynamically building a grid and adding a hierarchy with declarative relations row? Pin
Arindam Tewary25-Apr-10 18:55
professionalArindam Tewary25-Apr-10 18:55 
Questiondynamically increasing image size using asp.net with c# Pin
developerit25-Apr-10 3:23
developerit25-Apr-10 3:23 
AnswerRe: dynamically increasing image size using asp.net with c# Pin
Brij25-Apr-10 5:41
mentorBrij25-Apr-10 5:41 
Answer[Repost] Re: dynamically increasing image size using asp.net with c# Pin
Sandeep Mewara25-Apr-10 5:55
mveSandeep Mewara25-Apr-10 5:55 
AnswerRe: dynamically increasing image size using asp.net with c# Pin
daveyerwin25-Apr-10 6:36
daveyerwin25-Apr-10 6:36 
AnswerRe: dynamically increasing image size using asp.net with c# Pin
Tej Aj25-Apr-10 23:12
Tej Aj25-Apr-10 23:12 
Questionhow to increase the image size when image is click Pin
developerit25-Apr-10 1:57
developerit25-Apr-10 1:57 
AnswerRe: how to increase the image size when image is click Pin
Sandeep Mewara25-Apr-10 2:02
mveSandeep Mewara25-Apr-10 2:02 
Questiondisplaying image directly in image button from fileupload control Pin
developerit25-Apr-10 0:44
developerit25-Apr-10 0:44 
AnswerRe: displaying image directly in image button from fileupload control Pin
Sandeep Mewara25-Apr-10 1:57
mveSandeep Mewara25-Apr-10 1:57 
Questionhide and show popup menu Pin
Abdul Rahman Hamidy24-Apr-10 19:08
Abdul Rahman Hamidy24-Apr-10 19:08 
AnswerRe: hide and show popup menu Pin
Sandeep Mewara25-Apr-10 2:04
mveSandeep Mewara25-Apr-10 2:04 
AnswerRe: hide and show popup menu Pin
daveyerwin25-Apr-10 9:34
daveyerwin25-Apr-10 9:34 
GeneralRe: hide and show popup menu Pin
Abdul Rahman Hamidy25-Apr-10 19:01
Abdul Rahman Hamidy25-Apr-10 19:01 
GeneralRe: hide and show popup menu Pin
daveyerwin26-Apr-10 4:50
daveyerwin26-Apr-10 4:50 
QuestionSending emoticons between 2 applications Pin
Eagle3224-Apr-10 9:34
Eagle3224-Apr-10 9:34 
AnswerRe: Sending emoticons between 2 applications Pin
Eddy Vluggen24-Apr-10 23:03
professionalEddy Vluggen24-Apr-10 23:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.