This is a migrated thread and some comments may be shown as answers.

Grouping error on in code created column

1 Answer 93 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ABECON Groep BV
Top achievements
Rank 1
ABECON Groep BV asked on 16 Jan 2013, 10:45 AM
Hello,

I create a gridboundcolumn from codebehind and try to group it.
It throws an exception:

Unhandled exception at line 885, column 13 in http://server1/ScriptResource.axd?d=1A_JfTzkVI_BPK0wyueglza3uf3p5EQOp4lCh3bkZFj2kwIlPrGfNBqAYyJG42yrzLhNfZTtBWoYuqokkf-vNOdy8LQfqHEEJse-2Zpg5nGn_znQ0ma5rdc2XuV8eHZvGcbaSsZ0Wu1n7TPfMrcwAYGxAJyYoPMx7lFZ_2kSkbfeRFZ1GXIexwskAgJ3NeM67J1V_H9-C5a9cYJV09SQKA2&t=6119e399

0x800a139e - Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Expression cannot be null or empty

Whats the correct way to create a column from codebehind?

Marcel de Groot

-----------


I create the column like this:
GridBoundColumn col = new GridBoundColumn();
col.UniqueName = field.UniqueName;
col.HeaderText = field.Caption;
col.DataField = field.UniqueName;
// col.GroupByExpression =field.UniqueName + " Group by "+ field.UniqueName;
col.SortExpression = field.UniqueName;
col.HeaderButtonType = GridHeaderButtonType.TextButton;
RadGrid1.Columns.Add(col);


when i define the columns in the markup like this it works:
<MasterTableView Width="100%">
    <GroupByExpressions>
 
    </GroupByExpressions>
    <Columns>
        <telerik:GridBoundColumn SortExpression="Key" HeaderText="Key" HeaderButtonType="TextButton"
            DataField="Key" >
        </telerik:GridBoundColumn>
    </Columns>
</MasterTableView>

1 Answer, 1 is accepted

Sort by
0
Antonio Stoilkov
Telerik team
answered on 21 Jan 2013, 07:44 AM
Hello,

You could verify in which event you are creating the grid. The exception could be caused from incorrect creation of the RadGrid. You could take a look at the help article below for more information on the topic. Are you creating the grid entirely in code behind in the Page_Init method?

Regards,
Antonio Stoilkov
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.
Tags
Grid
Asked by
ABECON Groep BV
Top achievements
Rank 1
Answers by
Antonio Stoilkov
Telerik team
Share this question
or