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

RadGrid and rebinding on closing RadWindow

2 Answers 190 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Drammy
Top achievements
Rank 1
Drammy asked on 13 Jul 2008, 08:39 PM
Hi all,

I am struggling to work out when 1 of my RadGrids will rebind when a RadWindow (opened from the Grid) closes and another doesn't.

People.aspx works and has the following characteristics:
  • Name column is databoundcolumn
  • Edit button opens only RadWindow for editing records.
  • When closing updates are made and the RadGrid rebinds.

Competitions.aspx doesn't work and has the following characteristics:

  • Name column is a gridtemplatecolumn with a hyperlink control within, built programatically.

  • Name column opens up another RadGrid in a RadWindow.

  • Edit button opens a RadWindow for editing records.

  • When closing the Edit buttons RadWindow updates are made but the RadGrid doesn't rebind - errors: Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.

Any help appreciated.

Code:

People.aspx

<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="People.aspx.cs" Inherits="HonoursBoard.Admin.People" Title="Untitled Page" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">  
</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">  
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">  
        <script type="text/javascript">  
        function ShowEditForm(id, rowIndex)  
        {  
            var grid = $find("<%= RadGrid1.ClientID %>");  
                        
            var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();  
            grid.get_masterTableView().selectItem(rowControl, true);  
 
            window.radopen("PersonEditForm.aspx?intPersonID=" + id, "UserListDialog");  
            return false;  
        }  
        function ShowInsertForm()  
        {  
            window.radopen("PersonEditForm.aspx", "UserListDialog");  
            return false;  
        }  
        function refreshGrid(arg)  
        {  
            if(!arg)  
            {  
                $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");  
            }  
            else  
            {  
                $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");  
            }  
        }  
        </script> 
    </telerik:RadCodeBlock> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting>        
            <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting>                                    
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">  
        <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True"   
            AllowPaging="True" AllowSorting="True" DataSourceID="SqlDataSource1" GridLines="None"   
            Skin="Telerik" AllowAutomaticDeletes="true" Width="800px" OnItemCreated="RadGrid1_ItemCreated" 
            AllowMultiRowSelection="false" AllowMultiRowEdit="false">  
            <PagerStyle Mode="NextPrevNumericAndAdvanced" /> 
            <GroupingSettings CaseSensitive="false" /> 
            <MasterTableView Width="100%" CommandItemDisplay="TopAndBottom" AutoGenerateColumns="False" 
                DataKeyNames="intPersonID" DataSourceID="SqlDataSource1" PageSize="15">  
                <RowIndicatorColumn Visible="False">  
                </RowIndicatorColumn> 
                <ExpandCollapseColumn Visible="False" Resizable="False">  
                </ExpandCollapseColumn> 
                <Columns> 
                    <telerik:GridBoundColumn DataField="intPersonID" DataType="System.Int32"   
                        HeaderText="intPersonID" ReadOnly="True" SortExpression="intPersonID"   
                        UniqueName="intPersonID" Visible="false">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="strTitle" HeaderText="Title"   
                        SortExpression="strTitle" UniqueName="strTitle" AllowFiltering="false">  
                        <ItemStyle Width="40px" /> 
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="strFirstName" HeaderText="First Name"   
                        SortExpression="strFirstName" UniqueName="strFirstName" AutoPostBackOnFilter="true">  
                        <ItemStyle Width="100px" /> 
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="strInitials" HeaderText="Initials"   
                        SortExpression="strInitials" UniqueName="strInitials" AllowFiltering="false">  
                        <ItemStyle Width="40px" /> 
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="strLastName" HeaderText="Last Name"   
                        SortExpression="strLastName" UniqueName="strLastName" AutoPostBackOnFilter="true">  
                        <ItemStyle Width="150px" /> 
                    </telerik:GridBoundColumn> 
                    <telerik:GridHTMLEditorColumn UniqueName="strBiography" SortExpression="strBiography" 
                        HeaderText="Biography" DataField="strBiography" AllowFiltering="false">  
                        <ItemStyle Width="350px" /> 
                    </telerik:GridHTMLEditorColumn> 
                    <telerik:GridDateTimeColumn DataField="datDateOfBirth" DataType="System.DateTime" 
                        UniqueName="datDateOfBirth" PickerType="DatePicker" HeaderText="Date of Birth" 
                        AllowFiltering="false" DataFormatString="{0:dd/MM/yyyy}">  
                        <ItemStyle Width="80px" /> 
                    </telerik:GridDateTimeColumn> 
                    <telerik:GridTemplateColumn UniqueName="TemplateEditColumn" AllowFiltering="false">  
                        <ItemStyle Width="20px" /> 
                        <ItemTemplate> 
                            <asp:HyperLink ImageUrl="~/Images/Edit.gif" ID="EditLink" runat="server" Text="Edit"></asp:HyperLink> 
                        </ItemTemplate> 
                    </telerik:GridTemplateColumn> 
                    <telerik:GridButtonColumn ConfirmText="Are you sure you want to delete this person?" 
                        ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="ImageButton" 
                        CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">  
                        <ItemStyle HorizontalAlign="Center" Width="10px" /> 
                    </telerik:GridButtonColumn> 
                </Columns> 
                <CommandItemTemplate> 
                    <asp:Image ID="AddRecord1" runat="server" 
                        ImageUrl="~/Skins/Default/Grid/AddRecord.gif" AlternateText="Add New Person" /> 
                    <href="#" onclick="return ShowInsertForm();">Add New Person</a> 
                </CommandItemTemplate> 
                <EditFormSettings> 
                    <PopUpSettings ScrollBars="None"></PopUpSettings> 
                </EditFormSettings> 
            </MasterTableView> 
        </telerik:RadGrid> 
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Telerik">  
            <Windows> 
                <telerik:RadWindow ID="UserListDialog" runat="server" Title="Add/Edit Person" Height="500px" 
                    Width="510px" Left="150px" ReloadOnShow="true" Modal="true" Skin="Telerik" 
                    KeepInScreenBounds="true" ShowContentDuringLoad="false" VisibleStatusbar="false" /> 
            </Windows> 
        </telerik:RadWindowManager> 
    </telerik:RadAjaxPanel> 
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"   
        ConnectionString="<%$ ConnectionStrings:dbGolfHonoursConnectionString %>"   
        DeleteCommand="DeleteAPerson" DeleteCommandType="StoredProcedure" 
        SelectCommand="SelectAllPeople" SelectCommandType="StoredProcedure">  
        <DeleteParameters> 
            <asp:Parameter Name="intPersonID" Type="Int32" /> 
        </DeleteParameters> 
    </asp:SqlDataSource> 
</asp:Content> 
 

codebehind:
using System;  
using System.Collections;  
using System.Configuration;  
using System.Data;  
using System.Linq;  
using Telerik.Web.UI;  
using System.Web;  
using System.Web.Security;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.Web.UI.WebControls.WebParts;  
using System.Web.UI.HtmlControls;  
using System.Xml.Linq;  
 
namespace HonoursBoard.Admin  
{  
    public partial class People : System.Web.UI.Page  
    {  
        protected void Page_Load(object sender, EventArgs e)  
        {  
        }  
 
        protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)  
        {  
            if (e.Item is GridDataItem)  
            {  
                HyperLink editLink = (HyperLink)e.Item.FindControl("EditLink");  
                editLink.Attributes["href"] = "#";  
                editLink.Attributes["onclick"] = String.Format("return ShowEditForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["intPersonID"], e.Item.ItemIndex);  
            }  
        }  
 
        protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)  
        {  
            if (e.Argument == "Rebind")  
            {  
                RadGrid1.MasterTableView.SortExpressions.Clear();  
                RadGrid1.MasterTableView.GroupByExpressions.Clear();  
                RadGrid1.Rebind();  
            }  
            else if (e.Argument == "RebindAndNavigate")  
            {  
                RadGrid1.MasterTableView.SortExpressions.Clear();  
                RadGrid1.MasterTableView.GroupByExpressions.Clear();  
                RadGrid1RadGrid1.MasterTableView.CurrentPageIndex = RadGrid1.MasterTableView.PageCount - 1;  
                RadGrid1.Rebind();  
            }  
        }   
    }  
}  
 

Competitions.aspx
<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Competitions.aspx.cs" Inherits="HonoursBoard.Admin.Competitions" Title="Untitled Page" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">  
</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">  
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">  
        <script type="text/javascript">  
        function ShowEditForm(id, rowIndex)  
        {  
            var grid = $find("<%= RadGrid1.ClientID %>");  
                        
            var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();  
            grid.get_masterTableView().selectItem(rowControl, true);  
 
            window.radopen("CompetitionEditForm.aspx?intCompetitionID=" + id, "UserListDialog");  
            return false;  
        }  
        function ShowInsertForm()  
        {  
            window.radopen("CompetitionEditForm.aspx", "UserListDialog");  
            return false;  
        }  
        function ShowAssignForm(id, rowIndex)  
        {  
            var grid = $find("<%= RadGrid1.ClientID %>");  
                        
            var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();  
            grid.get_masterTableView().selectItem(rowControl, true);  
 
            window.radopen("AssignCompetitions.aspx?intCompetitionID=" + id, "AssignCompetitions");  
            return false;  
        }  
        function refreshGrid(arg) {  
            if (!arg) {  
                $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");  
            }  
            else {  
                $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");  
            }  
        }  
        </script> 
    </telerik:RadCodeBlock> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting>        
            <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting>                                    
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="200px" Width="300px">  
        <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True"   
            AllowPaging="True" AllowSorting="True" DataSourceID="SqlDataSource1" GridLines="None"   
            Skin="Telerik" AllowAutomaticDeletes="true" Width="480px" OnItemCreated="RadGrid1_ItemCreated" 
            AllowMultiRowSelection="false" AllowMultiRowEdit="false">  
            <PagerStyle Mode="NextPrevNumericAndAdvanced" /> 
            <GroupingSettings CaseSensitive="false" /> 
            <MasterTableView Width="100%" CommandItemDisplay="TopAndBottom" AutoGenerateColumns="False" 
                DataKeyNames="intCompetitionID" DataSourceID="SqlDataSource1" PageSize="15">  
                <RowIndicatorColumn Visible="False">  
                </RowIndicatorColumn> 
                <ExpandCollapseColumn Visible="False" Resizable="False">  
                </ExpandCollapseColumn> 
                <Columns> 
                    <telerik:GridBoundColumn DataField="intCompetitionID" DataType="System.Int32"   
                        HeaderText="intCompetitionID" ReadOnly="True" SortExpression="intCompetitionID"   
                        UniqueName="intCompetitionID" Visible="false">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridTemplateColumn HeaderText="Competition" DataField="strCompetitionTitle" 
                        SortExpression="strCompetitionTitle" UniqueName="strCompetitionTitle" AllowFiltering="true" 
                        AutoPostBackOnFilter="true">  
                        <ItemStyle Width="250px" /> 
                        <ItemTemplate> 
                            <asp:HyperLink ID="AssignLink" runat="server"></asp:HyperLink> 
                        </ItemTemplate> 
                    </telerik:GridTemplateColumn> 
                    <telerik:GridBoundColumn DataField="intPrestigeOrder" DataType="System.Int32" 
                        HeaderText="Prestige Order" SortExpression="intPrestigeOrder" 
                        UniqueName="intPrestigeOrder" AutoPostBackOnFilter="true" AllowFiltering="false" 
                        visible="false">  
                        <ItemStyle Width="50px" /> 
                    </telerik:GridBoundColumn> 
                    <telerik:GridCheckBoxColumn DataField="bitMultipleWinners" DataType="System.Boolean" 
                        HeaderText="Mulitple Winners" SortExpression="bitMultipleWinners"   
                        UniqueName="bitMultipleWinners" AutoPostBackOnFilter="true" ReadOnly="false" 
                        AllowFiltering="false">  
                        <ItemStyle Width="50px" /> 
                    </telerik:GridCheckBoxColumn> 
                    <telerik:GridCheckBoxColumn DataField="bitDisplay" DataType="System.Boolean" 
                        HeaderText="Display" SortExpression="bitDisplay" AllowFiltering="false" 
                        UniqueName="bitDisplay" AutoPostBackOnFilter="true" ReadOnly="false">  
                        <ItemStyle Width="50px" /> 
                    </telerik:GridCheckBoxColumn> 
                    <telerik:GridCheckBoxColumn DataField="bitInternalCompetition" DataType="System.Boolean" 
                        HeaderText="Internal Competition" SortExpression="bitInternalCompetition" AllowFiltering="false" 
                        UniqueName="bitInternalCompetition" AutoPostBackOnFilter="true" ReadOnly="false">  
                        <ItemStyle Width="50px" /> 
                    </telerik:GridCheckBoxColumn> 
                    <telerik:GridTemplateColumn UniqueName="TemplateEditColumn" AllowFiltering="false">  
                        <ItemStyle Width="20px" /> 
                        <ItemTemplate> 
                            <asp:HyperLink ImageUrl="~/Images/Edit.gif" ID="EditLink" runat="server" Text="Edit"></asp:HyperLink> 
                        </ItemTemplate> 
                    </telerik:GridTemplateColumn> 
                    <telerik:GridButtonColumn ConfirmText="Are you sure you want to delete this competition?" 
                        ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="ImageButton" 
                        CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">  
                        <ItemStyle HorizontalAlign="Center" Width="10px" /> 
                    </telerik:GridButtonColumn> 
                </Columns> 
                <CommandItemTemplate> 
                    <asp:Image ID="AddRecord1" runat="server" 
                        ImageUrl="~/Skins/Default/Grid/AddRecord.gif" AlternateText="Add New Competition" /> 
                    <href="#" onclick="return ShowInsertForm();">Add New Competition</a> 
                </CommandItemTemplate> 
                <EditFormSettings> 
                    <PopUpSettings ScrollBars="None"></PopUpSettings> 
                </EditFormSettings> 
            </MasterTableView> 
        </telerik:RadGrid> 
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Telerik">  
            <Windows> 
                <telerik:RadWindow ID="UserListDialog" runat="server" Title="Add/Edit Competition" Height="500px" 
                    Width="510px" Left="150px" ReloadOnShow="true" Modal="true" Skin="Telerik" 
                    KeepInScreenBounds="true" ShowContentDuringLoad="false" VisibleStatusbar="false" /> 
                <telerik:RadWindow ID="AssignCompetitions" runat="server" Title="Assign Competitions" Height="600px" 
                    Width="550px" Left="150px" ReloadOnShow="true" Modal="true" Skin="Telerik" 
                    KeepInScreenBounds="true" ShowContentDuringLoad="false" VisibleStatusbar="false" /> 
            </Windows> 
        </telerik:RadWindowManager> 
    </telerik:RadAjaxPanel> 
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"   
        ConnectionString="<%$ ConnectionStrings:dbGolfHonoursConnectionString %>"   
        DeleteCommand="DeleteACompetition" DeleteCommandType="StoredProcedure" 
        SelectCommand="SelectAllCompetitions" SelectCommandType="StoredProcedure">  
        <DeleteParameters> 
            <asp:Parameter Name="intCompetitionID" Type="Int32" /> 
        </DeleteParameters> 
    </asp:SqlDataSource> 
</asp:Content> 
 

codebehind:
using System;  
using System.Collections;  
using System.Configuration;  
using System.Data;  
using System.Linq;  
using Telerik.Web.UI;  
using Telerik.Pdf;  
using System.Web;  
using System.Web.Security;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.Web.UI.WebControls.WebParts;  
using System.Web.UI.HtmlControls;  
using System.Xml.Linq;  
 
namespace HonoursBoard.Admin  
{  
    public partial class Competitions : System.Web.UI.Page  
    {  
        protected void Page_Load(object sender, EventArgs e)  
        {  
              
        }  
 
        protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)  
        {  
            if (e.Item is GridDataItem)  
            {  
                HyperLink editLink = (HyperLink)e.Item.FindControl("EditLink");  
                editLink.Attributes["href"] = "#";  
                editLink.Attributes["onclick"] = String.Format("return ShowEditForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["intCompetitionID"], e.Item.ItemIndex);  
 
                HyperLink AssignLink = (HyperLink)e.Item.FindControl("AssignLink");  
                AssignLink.Attributes["href"] = "#";  
                AssignLink.Attributes["onclick"] = String.Format("return ShowAssignForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["intCompetitionID"], e.Item.ItemIndex);  
 
                DataRowView dataRow = (System.Data.DataRowView)e.Item.DataItem;  
 
                AssignLink.Text = dataRow["strCompetitionName"].ToString();  
            }  
        }  
 
        protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)  
        {  
            if (e.Argument == "Rebind")  
            {  
                RadGrid1.MasterTableView.SortExpressions.Clear();  
                RadGrid1.MasterTableView.GroupByExpressions.Clear();  
                RadGrid1.Rebind();  
            }  
            else if (e.Argument == "RebindAndNavigate")  
            {  
                RadGrid1.MasterTableView.SortExpressions.Clear();  
                RadGrid1.MasterTableView.GroupByExpressions.Clear();  
                RadGrid1RadGrid1.MasterTableView.CurrentPageIndex = RadGrid1.MasterTableView.PageCount - 1;  
                RadGrid1.Rebind();  
            }  
        }   
    }  
}  
 

All Radwindows have the following code on the page:
                <script type="text/javascript">  
                function CloseAndRebind(args)  
                {  
                    GetRadWindow().Close();  
                    GetRadWindow().BrowserWindow.refreshGrid(args);  
                }  
                       
                function GetRadWindow()  
                {  
                    var oWindow = null;  
 
                    if (window.radWindow)  
                        oWindow = window.radWindow; //Will work in Moz in all cases, including classic dialog  
                    else if (window.frameElement.radWindow)  
                        oWindow = window.frameElement.radWindow;//IE (and Moz as well)  
                        return oWindow;  
                 }  
                 function CancelEdit()  
                 {  
                    GetRadWindow().Close();    
                 }  
                </script> 

codebehind:
using System;  
using System.Collections;  
using System.Configuration;  
using System.Data;  
using System.Linq;  
using Telerik.Web.UI;  
using System.Web;  
using System.Web.Security;  
using System.Web.UI;  
using System.Web.UI.HtmlControls;  
using System.Web.UI.WebControls;  
using System.Web.UI.WebControls.WebParts;  
using System.Xml.Linq;  
 
namespace HonoursBoard.Admin  
{  
    public partial class PersonEditForm : System.Web.UI.Page  
    {  
        protected void Page_Init(object sender, EventArgs e)  
        {  
            if (Request.QueryString["intPersonID"] == null)  
            {  
                DetailsView1.DefaultMode = DetailsViewMode.Insert;  
            }  
            else  
            {  
                DetailsView1.DefaultMode = DetailsViewMode.Edit;  
            }  
        }  
 
        protected void DetailsView1_ItemCommand(object sender, System.Web.UI.WebControls.DetailsViewCommandEventArgs e)  
        {  
            if (e.CommandName == "Update")  
            {  
                ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind();", true);  
            }  
            else if (e.CommandName == "Insert")  
            {  
                ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind('navigateToInserted');", true);  
            }  
            else  
            {  
                ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CancelEdit();", true);  
            }  
        }  
    }  


I really am stumped on this -spent AGES trying to fix it so any help appreciated...

Thanks,
Drammy


Anyone got any ideas?

2 Answers, 1 is accepted

Sort by
0
Drammy
Top achievements
Rank 1
answered on 14 Jul 2008, 01:44 PM
Please?
0
Rosen
Telerik team
answered on 16 Jul 2008, 12:29 PM
Hi Drammy,

The null reference exception is thrown because you are access the GridItem's DataItem inside ItemCreated event. I guess you know this event is raised either when grid is created from datasource and from the ViewState. If the latter, the DataItem is empty and accessing it will result in this exception.

Sincerely yours,
Rosen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Drammy
Top achievements
Rank 1
Answers by
Drammy
Top achievements
Rank 1
Rosen
Telerik team
Share this question
or