Aug 11, 2011, 3:18 PM
Create Grid Panel Editor in Code Behind
Hi,
I am trying to create a gridpanel and associated column editors within code behind. Howerver I get a javascript error in during the page rendering.
If I don't bind the combobox editor to the data, the page renders completely. However if I try to bind the data, the page gets stuck and then eventually a javascript error appers on IE.
In case it's helpful here is the error IE is giving:
Message: Syntax error
Line: 266
Char: 134
Code: 0
URI: http://MyPage.com/MySite/extnet/extn...xt.axd?v=37522
Thank you.
I am trying to create a gridpanel and associated column editors within code behind. Howerver I get a javascript error in during the page rendering.
If I don't bind the combobox editor to the data, the page renders completely. However if I try to bind the data, the page gets stuck and then eventually a javascript error appers on IE.
In case it's helpful here is the error IE is giving:
Message: Syntax error
Line: 266
Char: 134
Code: 0
URI: http://MyPage.com/MySite/extnet/extn...xt.axd?v=37522
GridPanel grid = new GridPanel();
grid.ID = "mygrid";
grid.ClientIDMode = ClientIDMode.Static;
grid.Store.Add(store); //populated using HttpProxy
grid.ColumnModel.Columns.AddRange(colCollection);
grid.SelectionModel.Add(new RowSelectionModel() { SingleSelect = true });
//add editors
grid.ColumnModel.Columns[0].Editor.Add(new TextField() { AllowBlank = true });
ExtJS.JsonReader rdrCRD= new ExtJS.JsonReader();
rdrCRD.Fields.Clear();
foreach (PropertyInfo pi in oProps)
{
rdrCRD.Fields.Add(pi.Name);
}
Store storeCRD = new Store
{
AutoLoad=false, RemoteSort = false
};
storeCRDRatings.Reader.Add(rdrCRD);
ComboBox cbEd = new ComboBox
{
TypeAhead = true,
Mode = DataLoadMode.Local,
DisplayField = "FLD",
ValueField = "FLD",
EmptyText = "Loading...",
Width = Unit.Pixel(250),
AutoRender=false
};
cbEd.Store.Add(storeCRD);
storeCRDRatings.DataSource = DataRepository.GetDATA(cbRating.SelectedItem.Value); //repository returns a List<T>
storeCRDRatings.DataBind();
grid.ColumnModel.Columns[1].Editor.Add(cbEd);
I appreciate your help.Thank you.