Hi there,
Thanking you for very quick responses,
What I am trying to do is for a grid
1. add template columns to the grid
2. display the grid in edit mode
3. when click "save all", update all edited rows
What I did
for 1
GridTemplateColumn assResult = new GridTemplateColumn(); |
this.RadGridGradingBatchEntry.MasterTableView.Columns.Add(assResult); |
assResult.DataField = "UniqueDateField"; |
assResult.UniqueName = "UniqueDateField"; |
assResult.SortExpression = "UniqueDateField"; |
assResult.HeaderText = "UniqueDateField"; |
assResult.SortExpression = "UniqueDateField"; |
assResult.DataType = System.Type.GetType("System.Int32"); |
assResult.Resizable = true; |
assResult.ItemStyle.Wrap = true; |
assResult.ItemStyle.Width = 15; |
assResult.ItemTemplate = new MyTemplate() // Mytemplate returns implements Itemplate and I created this class according to one of forums I found here. |
for 2
protected void RadGridGradingBatchEntry_PreRender(object sender, System.EventArgs e) |
{ |
foreach (GridDataItem item in RadGridGradingBatchEntry.Items) |
{ |
item.Edit = true; |
RadGridGradingBatchEntry.Rebind(); |
} |
} |
for 3
protected override void RaisePostBackEvent(IPostBackEventHandler source, string eventArgument) |
{ |
base.RaisePostBackEvent(source, eventArgument); |
if (source is RadGrid) |
{ |
string[] postBackEventArgumentData = eventArgument.Split(':'); |
switch (postBackEventArgumentData[0]) |
{ |
case "SaveAll": |
foreach (string l_EachItem in postBackEventArgumentData[1].Split(',')) |
{ |
if (!(l_EachItem == "")) |
{ |
GridItem item = (GridItem)((Table)RadGridGradingBatchEntry.MasterTableView.Controls[0]).Rows[int.Parse(l_EachItem)]; |
GridEditableItem editedItem = (GridEditableItem)item; |
Hashtable newnewValues = new Hashtable(); |
item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem); |
} |
} |
break; |
} |
} |
} |
Now problem is that when I look up newValues, all dynamically created columns are not visible but only columns that have been specified as bound column are available to access.
Your help will be appreciated as always,
Toby