Hello everyone,
I have updated Telerik Controls today and i have an issue.
Before the upgrade, i had this behaviour :
I have a RadNumericTextBox on my page. When i set a value, it generate a RadGrid with header groups, headers and bind a datatable to it. On this RadNumericTextBox, i also have spin buttons. When i click on it, with the AutoPostback="true" and the onTextChanged="mymethod", i refresh the grid. by generating new headers and a new datatable.
Now, i have this one :
When i go on the page for the first time, my grid is generated properly. But when i click on spin buttons or change manually the value, i got this stack trace (please see the attached file). This stack trace seems to be about the RadGrid column groups, and each time i try to generate for the second time my grid with a new value.
I didn't modify anything inside my application. I thought it was my mistake, but set the old DLLs "resolve" the issue.
My numericTextBox :
My method :
My grid header generation is done inside "getControlList" method in this way :
I have updated Telerik Controls today and i have an issue.
Before the upgrade, i had this behaviour :
I have a RadNumericTextBox on my page. When i set a value, it generate a RadGrid with header groups, headers and bind a datatable to it. On this RadNumericTextBox, i also have spin buttons. When i click on it, with the AutoPostback="true" and the onTextChanged="mymethod", i refresh the grid. by generating new headers and a new datatable.
Now, i have this one :
When i go on the page for the first time, my grid is generated properly. But when i click on spin buttons or change manually the value, i got this stack trace (please see the attached file). This stack trace seems to be about the RadGrid column groups, and each time i try to generate for the second time my grid with a new value.
I didn't modify anything inside my application. I thought it was my mistake, but set the old DLLs "resolve" the issue.
My numericTextBox :
<
telerik:RadNumericTextBox
ID
=
"INP_uniqueKey"
runat
=
"server"
OnTextChanged
=
"onUniqueKeyChanged"
ShowSpinButtons
=
"True"
AutoPostBack
=
"true"
LabelWidth
=
"64px"
Width
=
"160px"
>
<
NumberFormat
DecimalDigits
=
"0"
/>
</
telerik:RadNumericTextBox
>
My method :
protected
void
onUniqueKeyChanged(
object
sender, EventArgs e)
{
// Check if there is a value.
if
(INP_uniqueKey.Value !=
null
)
{
i_uniqueKey = (
int
)INP_uniqueKey.Value;
TBL_data = setOutResults.getControlList(i_uniqueKey, GRD_controlListContainer);
// Initialization of labels and datafields
if
(setOutResults.getContainer !=
null
)
{
INP_container.Text = setOutResults.getContainer;
INP_containerReference.Text = setOutResults.getContainerReference;
INP_dateSample.SelectedDate = setOutResults.getDateSample;
INP_shopNumber.Text = setOutResults.getLineNumber;
INP_operator.Text = setOutResults.getOperator;
INP_productionNumber.Text = setOutResults.getProductionNumber;
// Databinding
GRD_controlListContainer.DataSource = TBL_data;
GRD_controlListContainer.DataBind();
}
// If there is no results, empty all fields
if
(TBL_data.Rows.Count == 0)
{
INP_dateSample.Clear();
INP_container.Text =
""
;
INP_containerReference.Text =
""
;
INP_dateSample.Clear();
INP_shopNumber.Text =
""
;
INP_operator.Text =
""
;
INP_productionNumber.Text =
""
;
}
}
}
My grid header generation is done inside "getControlList" method in this way :
// Third header row : Buttons
GCG_headerGroup =
new
GridColumnGroup();
GCG_headerGroup.Name =
"buttons0"
;
GCG_headerGroup.HeaderText =
""
;
GCG_headerGroup.ParentGroupName =
"control0"
;
GRD_CONTROLLIST.MasterTableView.ColumnGroups.Add(GCG_headerGroup);
8 Answers, 1 is accepted
0
Hello Maxime,
I suspect that problem is that the OnTextChanged event is fired too late for the column groups to be changed on it. However it is strange that the same code have worked for previous versions. To further investigate this issue, I would suggest that you strip down a sample runnable page based on your scenario and send it back to me. This way I will be able to draw a clear picture of your case and provide more to the point resolution.
Kind regards,
Martin
the Telerik team
I suspect that problem is that the OnTextChanged event is fired too late for the column groups to be changed on it. However it is strange that the same code have worked for previous versions. To further investigate this issue, I would suggest that you strip down a sample runnable page based on your scenario and send it back to me. This way I will be able to draw a clear picture of your case and provide more to the point resolution.
Kind regards,
Martin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Maxime
Top achievements
Rank 1
answered on 02 Aug 2012, 08:41 AM
Hello,
I have the same issue if I replace the RadNumericInput field by a standard ASP.NET input field. The first time i set a value, the grid creation is OK, but the next one give me the same stack trace. If I refresh the page, in both case, i can generate only one grid.
I'll try to make this project sample quickly.
Many thanks !
I have the same issue if I replace the RadNumericInput field by a standard ASP.NET input field. The first time i set a value, the grid creation is OK, but the next one give me the same stack trace. If I refresh the page, in both case, i can generate only one grid.
I'll try to make this project sample quickly.
Many thanks !
0
Maxime
Top achievements
Rank 1
answered on 02 Aug 2012, 02:24 PM
Hi guys,
My sample project is sent :)
Hope that will help.
Thanks !
My sample project is sent :)
Hope that will help.
Thanks !
0
Hello Maxime,
Could you please be more specific - I don't see any attachments or other threads for your account. If you have opened a support ticket from another account, would you mind providing the ticket id please?
All the best,
Martin
the Telerik team
Could you please be more specific - I don't see any attachments or other threads for your account. If you have opened a support ticket from another account, would you mind providing the ticket id please?
All the best,
Martin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Maxime
Top achievements
Rank 1
answered on 02 Aug 2012, 02:46 PM
Hello Martin,
I didn't saw that it was impossible to attach a ZIP file on this topic. I am not able to open a ticket since my support subscription is over. However, I can also put all my code here if that's better or send an e-mail.
Regards.
I didn't saw that it was impossible to attach a ZIP file on this topic. I am not able to open a ticket since my support subscription is over. However, I can also put all my code here if that's better or send an e-mail.
Regards.
0
Accepted
Hello Maxime,
I have reviewed your code and would like to point out the following paragraph from our documentation:
"To define the structure of a RadGrid control that is declared in the ASPX page, use the Page_Load event handler. Columns and detail table should be added to the corresponding collection first, before the values for their properties are set. This is important because no ViewState is managed for the object before it has been added to the corresponding collection."
I am attaching the modified version of your code behind file that applies the required modifications.
Greetings,
Martin
the Telerik team
I have reviewed your code and would like to point out the following paragraph from our documentation:
"To define the structure of a RadGrid control that is declared in the ASPX page, use the Page_Load event handler. Columns and detail table should be added to the corresponding collection first, before the values for their properties are set. This is important because no ViewState is managed for the object before it has been added to the corresponding collection."
I am attaching the modified version of your code behind file that applies the required modifications.
Greetings,
Martin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Maxime
Top achievements
Rank 1
answered on 07 Aug 2012, 02:52 PM
Hello Martin !
Many thanks for all the time you spent on this sample project.
Everything is good for me now, i have modified my project in that way and it is working :)
Regards,
Maxime.
Many thanks for all the time you spent on this sample project.
Everything is good for me now, i have modified my project in that way and it is working :)
Regards,
Maxime.
0
Salman
Top achievements
Rank 1
answered on 12 Nov 2012, 01:11 PM
Hi
I have same problem .I add GridColumnGroup and column to grid in page load event .but when post back server i get this error
Invalid column name:
This is my code
I have same problem .I add GridColumnGroup and column to grid in page load event .but when post back server i get this error
Invalid column name:
This is my code
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack == false)
{
txtDate.Text = clsMain.GetPersianDate();
CreateStructureTable();
fillZoneData();
fillAreaData();
fillPlacetype();
if (objZone.dtblZone.Rows.Count == 0 || objArea.dtblZone.Rows.Count==0)
{
string script = "Error('شما به منطقه ای مشخص دسترسی ندارید')";
// ScriptManager.RegisterStartupScript(this, GetType(), "MyKey", script, true);
}
else
{
FillPlaceInTable();
FillDataInTable();
}
}
}
private void CreateStructureTable()
{
int i = 0;
string s = "";
#region "GridClear"
dgdZone.MasterTableView.Columns.Clear();
// dgdZone0.MasterTableView.Columns.Clear();
dgdZone.MasterTableView.ColumnGroups.Clear();
#endregion
#region "GridColumnGroup"
objContractItem.dtblContractItem = clsMain.SelectByCondition("Select * from vContractItem where iNumber In(Select iParentNumber from vContractItem) Order by ContractItemLevel asc");
for (i = 0; i <= objContractItem.dtblContractItem.Rows.Count - 1; i++)
{
if (!dgdZone.MasterTableView.ColumnGroups.Contains(objContractItem.dtblContractItem.Rows[i]["iNumber"]))
{
GridColumnGroup grp = new GridColumnGroup();
grp.HeaderText = objContractItem.dtblContractItem.Rows[i]["strName"].ToStr().Replace(" ", "").Replace(":", "");
grp.Name = "grp" + objContractItem.dtblContractItem.Rows[i]["iNumber"].ToStr().Replace(" ", "").Replace(":", "");
grp.HeaderStyle.VerticalAlign = VerticalAlign.Middle;
grp.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
if (objContractItem.dtblContractItem.Rows[i]["iParentNumber"].ToInt() != 0)
{
grp.ParentGroupName = "grp" + objContractItem.dtblContractItem.Rows[i]["iParentNumber"].ToStr().Replace(" ", "").Replace(":", "");
}
dgdZone.MasterTableView.ColumnGroups.Add(grp);
}
}
#endregion
//------------------------------ردیف
Telerik.Web.UI.GridBoundColumn iRowNumber = new Telerik.Web.UI.GridBoundColumn();
dgdZone.MasterTableView.Columns.Add(iRowNumber);
//dgdZone0.MasterTableView.Columns.Add(iRowNumber);
iRowNumber.HeaderText = "ردیف";
iRowNumber.UniqueName = "iRowNumber";
iRowNumber.DataField = "iRowNumber";
iRowNumber.Visible = true;
iRowNumber.HeaderStyle.Width = Unit.Pixel(40);
iRowNumber.ItemStyle.Width = Unit.Pixel(20);
iRowNumber.ForceExtractValue = GridForceExtractValues.Always;
iRowNumber.AllowFiltering = false;
iRowNumber.HeaderStyle.VerticalAlign = VerticalAlign.Middle;
iRowNumber.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
iRowNumber.ItemStyle.VerticalAlign = VerticalAlign.Middle;
iRowNumber.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
dt.Columns.Add("iRowNumber", i.GetType());
dt2.Columns.Add("iRowNumber", s.GetType());
//------------------------------------------
//------------------------شناسه محل
Telerik.Web.UI.GridBoundColumn iZonePlaceNumberCol = new Telerik.Web.UI.GridBoundColumn();
dgdZone.MasterTableView.Columns.Add(iZonePlaceNumberCol);
// dgdZone0.MasterTableView.Columns.Add(iZonePlaceNumberCol);
iZonePlaceNumberCol.HeaderText = "iZonePlaceNumber";
iZonePlaceNumberCol.UniqueName = "iZonePlaceNumber";
iZonePlaceNumberCol.DataField = "iZonePlaceNumber";
iZonePlaceNumberCol.Visible = false;
iZonePlaceNumberCol.ForceExtractValue = GridForceExtractValues.Always;
dt.Columns.Add("iZonePlaceNumber", i.GetType());
dt.Columns.Add("strPlaceName", s.GetType());
//------------------------------
//--------------------------------نام محل
Telerik.Web.UI.GridBoundColumn strPlaceNameCol = new Telerik.Web.UI.GridBoundColumn();
dgdZone.MasterTableView.Columns.Add(strPlaceNameCol);
// dgdZone0.MasterTableView.Columns.Add(strPlaceNameCol);
strPlaceNameCol.HeaderText = "نام محل";
strPlaceNameCol.UniqueName = "strPlaceName";
strPlaceNameCol.DataField = "strPlaceName";
strPlaceNameCol.Visible = true;
strPlaceNameCol.HeaderStyle.Width = Unit.Pixel(180);
strPlaceNameCol.ItemStyle.Width = Unit.Pixel(180);
strPlaceNameCol.ForceExtractValue = GridForceExtractValues.Always;
strPlaceNameCol.AllowFiltering = false;
strPlaceNameCol.HeaderStyle.VerticalAlign = VerticalAlign.Middle;
strPlaceNameCol.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
strPlaceNameCol.ItemStyle.VerticalAlign = VerticalAlign.Middle;
strPlaceNameCol.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
strPlaceNameCol.AllowSorting = false;
strPlaceNameCol.AllowFiltering = false;
dt2.Columns.Add("iZonePlaceNumber", i.GetType());
dt2.Columns.Add("strPlaceName", s.GetType());
//------------------------------
objContractItem.dtblContractItem = clsMain.SelectByCondition("Select * from vContractItem where bShowDailyReport=1" + " Order by iParentNumber asc");
for (i = 0; i <= objContractItem.dtblContractItem.Rows.Count - 1; i++)
{
Telerik.Web.UI.GridBoundColumn col = new Telerik.Web.UI.GridBoundColumn();
if (objContractItem.dtblContractItem.Rows[i]["bIncomplete"].ToBool() == true)
{
// dgdZone0.MasterTableView.Columns.Add(col);
dt2.Columns.Add(objContractItem.dtblContractItem.Rows[i]["iNumber"].ToString(), i.GetType());
}
else
{
dgdZone.MasterTableView.Columns.Add(col);
dt.Columns.Add(objContractItem.dtblContractItem.Rows[i]["iNumber"].ToString(), i.GetType());
}
if (objContractItem.dtblContractItem.Rows[i]["iParentNumber"].ToStr().Length > 0)
{
//col.ColumnGroupName = "grp" + objContractItem.dtblContractItem.Rows[i]["iParentNumber"].ToStr();
}
col.UniqueName =objContractItem.dtblContractItem.Rows[i]["iNumber"].ToString();
col.DataField = objContractItem.dtblContractItem.Rows[i]["iNumber"].ToString();
col.ForceExtractValue = GridForceExtractValues.Always;
col.HeaderText = objContractItem.dtblContractItem.Rows[i]["strName"].ToString();
col.HeaderStyle.VerticalAlign = VerticalAlign.Middle;
col.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
col.ItemStyle.VerticalAlign = VerticalAlign.Middle;
col.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
col.HeaderStyle.Width = Unit.Pixel(100);
col.AllowSorting = false;
col.AllowFiltering = false;
col.Groupable = false;
}
// }
GlobalMActivity.dt = dt;
GlobalMActivity.dt2 = dt2;
dgdZone.DataSource = dt;
//dgdZone0.DataSource = dt2;
dgdZone.DataBind();
// dgdZone0.DataBind();
}