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

[Solved] !!!!!!!!!NullReference Exception for ever new EDIT Column!!!!!!!!!!!!

7 Answers 215 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 2
Markus asked on 20 Jun 2008, 06:48 AM
Hello everybody!

For two days we are encountering very strange behaviour with the radgrid! For two days now, every new radgrid that contains an editbuttoncolumn doesn't work! There is always a NullReferenceException if you click the Edit button.
Even the simplest radgrid that works perfectly well in another new clean solution doesn't work. The "old" radgrids in the solution perform as expected.
No new updates were made, it just started happening.

Here's the stacktrace:

[NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.]

   Telerik.Web.UI.GridEditFormItem.CellsDataBound(GridColumn[] columns) +183

   Telerik.Web.UI.GridEditFormItem.SetupItem(Boolean dataBind, Object dataItem, GridColumn[] columns, ControlCollection rows) +312

   Telerik.Web.UI.GridItemBuilder.CreateItems(GridGroupingContext group) +861

   Telerik.Web.UI.GridTableView.CreateItems(IEnumerator enumerator, GridColumn[] columns, ControlCollection controls) +167

   Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +890

   Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +532

   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +59

   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +111

   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +29

   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149

   Telerik.Web.UI.GridTableView.PerformSelect() +23

   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70

   Telerik.Web.UI.GridTableView.DataBind() +321

   Telerik.Web.UI.GridTableView.Rebind() +79

   Telerik.Web.UI.GridCommandEventArgs.ExecuteCommand(Object source) +361

   Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) +171

   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35

   Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +147

   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35

   System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +115

   System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +132

   System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7

   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11

   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +177

   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746


this happens always when you click the edit of newly added radgrids. Even radgrids that are copied / paste from other, working, aspx pages don't work  in editmode.

Pls help us, this issue is very urgent as I can't go on with development!


Thx in advance & kind Regards

7 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 20 Jun 2008, 06:51 AM
Hello Markus,

Can you post a bit more info how the grid is bound/created in your case?

Greetings,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Markus
Top achievements
Rank 2
answered on 20 Jun 2008, 06:57 AM
Here is an example:

<telerik:RadGrid ID="rgFiles" runat="server"
    Skin="Office2007"
    meta:resourcekey="radGrid"
    OnNeedDataSource="rgFiles_NeedDataSource"
    AutoGenerateColumns="false">
    <MasterTableView>
        <Columns>
        <telerik:GridButtonColumn
                    ButtonType="ImageButton"
                    UniqueName="Download"
                    CommandName="ItemCommand"
                    ImageUrl="~/Img/Type.gif"
                    CommandArgument="download">
            </telerik:GridButtonColumn>

      <telerik:GridBoundColumn meta:resourcekey="colFilename" ReadOnly="true"
                UniqueName="Filename" DataField="Filename" HeaderText="Filename">
            </telerik:GridBoundColumn>

                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" />
        </Columns>
  
    </MasterTableView>
</telerik:RadGrid>

  protected void rgFiles_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            Test test = new Test();
            test.Id = "1";
            test.Filename = "asdf";
            rgFiles.DataSource = new Test[] { test };
        }

     public class Test
        {
            string id;

            public string Id
            {
                get { return id; }
                set { id = value; }
            }
            string filename;

            public string Filename
            {
                get { return filename; }
                set { filename = value; }
            }

        }

Same code works well in a new solution, but not in the existing one

edit: The last step when debugging before the excecption is thrown is the call of the getter of the last property and element that is bound to the grid.

in this example: get { return filename; } - allthough filename has a value

0
Markus
Top achievements
Rank 2
answered on 20 Jun 2008, 08:56 AM
we just checked out a revision that is 1 month old. For one month we've been adding radgrid over radgrid. Everything worked until two days ago.
Now I tried to add a radgrid to this old version - exact the same failure!

Isn't this weird? how can something like this happen? This is a real showstopper now!
0
Nikolay Rusev
Telerik team
answered on 20 Jun 2008, 01:35 PM
Hi Markus,

Thank you for contacting us. As far as i can see the null reference error occurs because of an incorrect ID within the AJAX settings:

<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1"/>
</UpdatedControls>
</telerik:AjaxSetting>

Your grid name is: <telerik:RadGrid ID="rgtest

I hope that was helpful.


Kind regards,
Nikolay
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Markus
Top achievements
Rank 2
answered on 23 Jun 2008, 05:54 AM
Hello!

This is NOT the solution to our problem. The wrong name in the AjaxSettings was only to show the exception. When adding the correct name the exception is "swallowed" in javascript but the RadGrid does not switch to edit mode.

Please test the behavior i am describing and provide a solution.

Thank you in advance.

Josef Grabner
0
Nikolay Rusev
Telerik team
answered on 23 Jun 2008, 12:47 PM
Hi Markus,

Thank you for getting back to us and excuse me for the misunderstanding.

If you set <MasterTableView EditMode="InPlace"> for your first grid it should operate properly. The problem is that the default value of EditMode is  EditForms and this somehow breaks the edit form. After further testing I was able to isolate the problem. If you open the main Web.config file at line 98 you will see something that looks like this:                 
<add path="*.aspx" verb="*" type="Spring.Web.Support.PageHandlerFactory, Spring.Web"/>

The usage of this handler breaks the grid control. If you comment this line everything will be OK. Unfortunately I am unable to track what's wrong inside this handler. Please check this issue - comment and test with different EditModes and see if this is really what causes the erroneous result.

Kind regards,
Nikolay
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Markus
Top achievements
Rank 2
answered on 24 Jun 2008, 08:31 AM
That was the point!!!!

Thank you for solving our problem...

Tags
Grid
Asked by
Markus
Top achievements
Rank 2
Answers by
Vlad
Telerik team
Markus
Top achievements
Rank 2
Nikolay Rusev
Telerik team
Share this question
or