Hello all, specially Vlad ^_^
I have an issue for you. I encouter a NullPointerException with my grid.
As you will see in provided code, the grid is pretty simple, with EditMode set to /InPlace/, and it allows column sizing ...
I apologize in advance if this issue has already been raised, but I haven't seen related stuff in the existing threads ... except perhaps an old thread concerning an old version of the control with different behavior [ Bizarre Grid Behavior ]
In my case, the Edit/Update process works well, and the sizing process seems to do what it supposed to do as well .. with a little bemol here, but that's not the point of this topic ... The issue appears when you try to mix both, I mean click on Edit and while editing you resize any column .. then after when you try to validate your changes by clicking the Update link .. the exception is raised.
Same result in the opposite way, if you resize a column and after that click on Edit it breaks ... That's seems pretty ugly, because I cannot mix resize and edit ... :-(
At first it was javascript exception : Sys.WebForms.PageRequestManagerServerErrorException : Object reference not set to an instance of an object.
Much interesting call stack with Ajax disabled :
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Stack Trace:
|
Here the aspx definition.
<telerik:RadGrid ID="RadGridCommunication" runat="server" |
EnableViewState="False" |
AutoGenerateColumns="False" |
OnNeedDataSource="RadGridCommunication_NeedDataSource" |
GridLines="None" |
Skin="Office2007" |
AllowPaging="True" |
PageSize="3" |
ShowStatusBar = "true" |
> |
<MasterTableView |
CommandItemDisplay= "Top" |
EditMode="InPlace" |
> |
<Columns> |
<telerik:GridEditCommandColumn UniqueName="EditCommandColumn" /> |
<telerik:GridBoundColumn DataField="Name" HeaderText="Name" DataFormatString="<nobr>{0}</nobr>" /> |
<telerik:GridBoundColumn DataField="Age" HeaderText="Age" DataFormatString="<nobr>{0}</nobr>" /> |
<telerik:GridBoundColumn DataField="Email" HeaderText="Email" DataFormatString="<nobr>{0}</nobr>"/> |
<telerik:GridBoundColumn DataField="Phone" HeaderText="Phone" DataFormatString="<nobr>{0}</nobr>"/> |
</Columns> |
<CommandItemStyle CssClass="gridCommandBar" /> |
<CommandItemTemplate> |
<div style="float: left"> |
<asp:Label ID="Label1" CssClass="blockTitleForm" runat="server" EnableViewState="False" >Communication Medium</asp:Label> |
</div> |
<div style="float: right"> |
<asp:LinkButton Style="vertical-align: bottom" ID="btnEditSelected" runat="server" EnableViewState="False" |
CommandName="EditSelected" Visible='<%# RadGridCommunication.EditIndexes.Count == 0 %>' |
> |
<img style="border:0px" alt="" src="../im/btnGoToPage_01.png" / title="Edit selected item" EnableViewState="False" > |
</asp:LinkButton> |
</div> |
</CommandItemTemplate> |
</MasterTableView> |
<ClientSettings AllowColumnsReorder="true" > |
<ClientEvents OnCommand="RadGridCommunication_Command" /> |
<Resizing |
AllowColumnResize="True" |
AllowRowResize="false" |
ResizeGridOnColumnResize="false" |
ClipCellContentOnResize="true" |
EnableRealTimeResize="false" /> |
</ClientSettings> |
<StatusBarSettings LoadingText="Loading ..." ReadyText ="Ready"/> |
</telerik:RadGrid> |
then the code behind taken from some Kevin Babcock samples :
[WebMethod] |
public static IEnumerable<NWA.POC.Models.Contact> GetData() |
{ |
var path = HttpContext.Current.Server.MapPath(@"Data\contacts.xml"); |
var xml = System.Xml.Linq.XDocument.Load(path) |
.Descendants("Contact"); |
var contacts = from contact in xml |
select new NWA.POC.Models.Contact |
{ |
ID = Convert.ToInt32(contact.Element("ID").Value), |
Name = contact.Element("Name").Value, |
Age = Convert.ToInt32(contact.Element("Age").Value), |
Sex = contact.Element("Sex").Value, |
Email = contact.Element("Email").Value, |
Phone = contact.Element("Phone").Value |
}; |
return contacts; |
} |
Thanks in advance for your answer.