foreach (RadTreeNode oNode in oTreeView.Nodes){    Label oLbl = (Label)oNode.FindControl("spnDesignation");    oLbl.Visible = bShow;}<telerik:RadScheduler runat="server" ID="RadScheduler1" Width="748px" SelectedDate="2007-03-30"<br>            DayStartTime="08:00:00" DayEndTime="18:00:00" DataKeyField="ID" DataSubjectField="Subject"<br>            DataStartField="Start" DataEndField="End" DataRecurrenceField="RecurrenceRule"<br>            DataRecurrenceParentKeyField="RecurrenceParentID" <br>            DataSourceID="EntityDataSource1" ><br>            <ResourceTypes><br>                <telerik:ResourceType KeyField="ID" Name="Event1" TextField="Text1" ForeignKeyField="ID"<br>                    DataSourceID="EntityDataSource1" /><br>                <telerik:ResourceType KeyField="ID" Name="<span style="font-size: 14px; ">Event2</span>" TextField="Text2" ForeignKeyField="ID"<br>                    DataSourceID="EntityDataSource2" /><br>            </ResourceTypes><br>        </telerik:RadScheduler>function AddRootNodesToTree(nodes, tree) {   tree.trackChanges();   tree.get_nodes().clear();   for (var node in nodes) {      var dynamicNode = new Telerik.Web.UI.RadTreeNode();      dynamicNode._loadFromDictionary(nodes[node]);      tree.get_nodes().add(dynamicNode);   }   tree.commitChanges();}
Hi
I have been trying to use the RadGrid to maintain emergency contact information. I am having a difficulty getting my user control to perform the actual insert. I have looked through the documentation and still cannot figure out what I am doing wrong. My grid comes up ok and when I click on Add new record, my user control comes up and I can fill in the information. I even have validators on the page that fires ok. When I click the Insert button, the form returns and no record is added. I handle the InsertCommand event on the server side but it does not seem to get there. I really have an urgent need to move past this problem, so your urgent response here is very welcome.
Any leads will be very helpful. Here is my code
ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="pEmergencyContact.aspx.cs" Inherits="ARM.ETF.pEmergencyContact" %><%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server">    <title></title>    <style type="text/css">        .style1        {            width: 760px;        }    </style></head><body>    <form id="form1" runat="server">    <div>        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">        </telerik:RadScriptManager>        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">            <AjaxSettings>                <telerik:AjaxSetting AjaxControlID="grdEmergency">                    <UpdatedControls>                        <telerik:AjaxUpdatedControl ControlID="grdEmergency" LoadingPanelID="RadAjaxLoadingPanel1" />                    </UpdatedControls>                </telerik:AjaxSetting>            </AjaxSettings>        </telerik:RadAjaxManager>        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">        </telerik:RadAjaxLoadingPanel>        <table class="style1">            <tr>                <td>                    <asp:Panel ID="pnlGrid" runat="server">                        <telerik:RadGrid ID="grdEmergency" runat="server" AutoGenerateColumns="False"                            OnInsertCommand="grdEmergency_InsertCommand"                            OnNeedDataSource="grdEmergency_NeedDataSource"                            CellSpacing="0" GridLines="None">                            <MasterTableView CommandItemDisplay="Top" AllowAutomaticInserts="false" EditMode="PopUp" >                                <CommandItemSettings ExportToPdfText="Export to PDF" />                                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">                                </RowIndicatorColumn>                                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">                                </ExpandCollapseColumn>                                <Columns>                                    <telerik:GridBoundColumn DataField="FIRST_NAME"                                        FilterControlAltText="Filter firstname column" HeaderText="Contact First Name"                                        UniqueName="firstname">                                    </telerik:GridBoundColumn>                                    <telerik:GridBoundColumn DataField="LAST_NAME"                                        FilterControlAltText="Filter lastname column" HeaderText="Contact Last Name"                                        UniqueName="lastname">                                    </telerik:GridBoundColumn>                                    <telerik:GridBoundColumn DataField="RELATION"                                        FilterControlAltText="Filter relationship column" HeaderText="Relation"                                        UniqueName="relationship">                                    </telerik:GridBoundColumn>                                    <telerik:GridBoundColumn DataField="TELEPHONE_HOME"                                        FilterControlAltText="Filter homeTelephone column"                                        HeaderText="Telephone (Home)" UniqueName="homeTelephone">                                    </telerik:GridBoundColumn>                                    <telerik:GridBoundColumn DataField="TELEPHONE_BUSINESS"                                        FilterControlAltText="Filter workTelephone column"                                        HeaderText="Telephone (Work)" UniqueName="workTelephone">                                    </telerik:GridBoundColumn>                                    <telerik:GridBoundColumn DataField="TELEPHONE_EXTENSION"                                        FilterControlAltText="Filter extension column" HeaderText="Extension"                                        UniqueName="extension">                                    </telerik:GridBoundColumn>                                </Columns>                                <EditFormSettings UserControlName="~/Controls/emergencycontact.ascx" EditFormType="WebUserControl">                                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">                                    </EditColumn>                                </EditFormSettings>                            </MasterTableView>                            <FilterMenu EnableImageSprites="False">                            </FilterMenu>                            <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">                            </HeaderContextMenu>                        </telerik:RadGrid>                    </asp:Panel>                    </td>            </tr>            <tr>                <td>                </td>            </tr>        </table>         </div>    </form></body></html>ASCX
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="emergencycontact.ascx.cs" Inherits="ARM.ETF.Controls.emergencycontact" %><%@ Import Namespace="ARM.Common.Classes" %><style type="text/css">        .grdTable        {            font-size: 12px;            font-family: "Helvetica Neue", "Lucida Grande", "Segoe UI", Arial, Helvetica, Verdana, sans-serif;            margin: 0px;            padding: 0px;            color: #696969;                        width: 360px;        }        .grdText        {            font-family: 'Segoe UI';            font-size: 12px;            color: #000000;            background-color: #EAEAEA;            border: 1px solid #CCCCCC;        }        .grdlabel        {            width: 100px;        }    </style>    <table class="grdTable">        <tr>            <td class="grdlabel">                <asp:Label ID="lblgrdFirstName" runat="server" Text="lblgrdFirstName"></asp:Label>            </td>            <td>                <asp:TextBox ID="txtgrdFirstName" Runat="server" Width="200px" CssClass="grdText"></asp:TextBox>                 <asp:RequiredFieldValidator ID="rfvgrdFirstName" runat="server" ControlToValidate="txtgrdFirstName" ErrorMessage="*"></asp:RequiredFieldValidator>            </td>        </tr>        <tr>            <td class="grdlabel">                <asp:Label ID="lblgrdLastName" runat="server" Text="lblgrdLastName"></asp:Label>            </td>            <td>                <asp:TextBox ID="txtgrdLastName" Runat="server" Width="200px" CssClass="grdText"></asp:TextBox> <asp:RequiredFieldValidator ID="rfvgrdLastName" runat="server" ControlToValidate="txtgrdLastName" ErrorMessage="*"></asp:RequiredFieldValidator>            </td>        </tr>        <tr>            <td class="grdlabel">                <asp:Label ID="lblgrdHomeTelephone" runat="server" Width="100px" Text="lblgrdHomeTelephone"></asp:Label>            </td>            <td>                <asp:TextBox ID="txtgrdHomeTelephone" Runat="server" CssClass="grdText"></asp:TextBox>                 <asp:RequiredFieldValidator ID="rfvgrdHomeTelephone" runat="server" ControlToValidate="txtgrdHomeTelephone" ErrorMessage="*"></asp:RequiredFieldValidator>                <asp:RegularExpressionValidator ID="revgrdHomeTelephone" runat="server" ControlToValidate="txtgrdHomeTelephone" ValidationExpression="^[2-9]\d{2}-\d{3}-\d{4}$" ErrorMessage="*"></asp:RegularExpressionValidator>            </td>        </tr>        <tr>            <td class="grdlabel">                <asp:Label ID="lblgrdWorkTelephone" runat="server" Text="lblgrdWorkTelephone"></asp:Label>            </td>            <td>                <asp:TextBox ID="txtgrdWorkTelephone" Runat="server" Width="100px" CssClass="grdText"></asp:TextBox> <asp:RegularExpressionValidator                    ID="revgrdWorkTelephone" runat="server" ControlToValidate="txtgrdWorkTelephone" ValidationExpression="^[2-9]\d{2}-\d{3}-\d{4}$" ErrorMessage="*"></asp:RegularExpressionValidator>            </td>        </tr>        <tr>            <td class="grdlabel">                <asp:Label ID="lblgrdExtension" runat="server" Text="lblgrdExtension"></asp:Label>            </td>            <td>                <asp:TextBox ID="txtgrdExtension" Runat="server" Width="70px" CssClass="grdText"></asp:TextBox> <asp:RegularExpressionValidator                    ID="revExtension" runat="server" ControlToValidate="txtgrdExtension" ValidationExpression="^\d+$" ErrorMessage="*"></asp:RegularExpressionValidator>            </td>        </tr>        <tr>            <td class="grdlabel">                <asp:Label ID="lblgrdRelation" runat="server" Text="lblgrdRelation"></asp:Label>            </td>            <td>                <asp:DropDownList ID="cbogrdRelation" runat="server" CssClass="grdText"></asp:DropDownList>                 <asp:RequiredFieldValidator ID="rfvgrdRelation" runat="server" ControlToValidate="cbogrdRelation" InitialValue="0" ErrorMessage="*"></asp:RequiredFieldValidator>            </td>        </tr>        <tr>            <td colspan="2">                <asp:Button ID="btngrdSave" CommandName="PerformInsert" runat="server"                    Text="btngrdSave" />            </td>        </tr>    </table>Page Code Behind
using System;using System.Data;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using ARM.Common.Classes;using YorkU.Data;using Telerik.Web.UI;namespace ARM.ETF{    public partial class pEmergencyContact : System.Web.UI.Page    {        SqlServer sql = new SqlServer();        Command cmd = new Command();        DataFactory df = new DataFactory();        private string MyToken = "7EC07A5015A945A4A49037E315E9F8C3";        private int MyPerson = 2;        protected override void OnInit(EventArgs e)        {            grdEmergency.InsertCommand += new GridCommandEventHandler(grdEmergency_InsertCommand);            grdEmergency.NeedDataSource += new GridNeedDataSourceEventHandler(grdEmergency_NeedDataSource);            base.OnInit(e);        }        protected void grdEmergency_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)        {            this.grdEmergency.MasterTableView.Items[0].Edit = true;            ConfigureGrid();        }        protected void grdEmergency_InsertCommand(object sender, GridCommandEventArgs e)        {            if (e.CommandName == RadGrid.PerformInsertCommandName)            {                GridEditableItem itm = e.Item as GridEditableItem;                UserControl uc = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);                TextBox txtgrdFirstName = uc.FindControl("txtgrdFirstName") as TextBox;                TextBox txtgrdLastName = uc.FindControl("txtgrdLastName") as TextBox;                TextBox txtgrdHomeTelephone = uc.FindControl("txtgrdHomeTelephone") as TextBox;                TextBox txtgrdWorkTelephone = uc.FindControl("txtgrdWorkTelephone") as TextBox;                TextBox txtgrdExtension = uc.FindControl("txtgrdExtension") as TextBox;                DropDownList cbogrdRelation = uc.FindControl("cbogrdRelation") as DropDownList;                string firstName = txtgrdFirstName == null ? string.Empty : txtgrdFirstName.Text;                string lastName = txtgrdLastName == null ? string.Empty : txtgrdLastName.Text;                string homeTel = txtgrdHomeTelephone == null ? string.Empty : txtgrdHomeTelephone.Text;                string workTel = txtgrdWorkTelephone == null ? string.Empty : txtgrdWorkTelephone.Text;                string extn = txtgrdExtension == null ? string.Empty : txtgrdExtension.Text;                int relation = cbogrdRelation == null ? 0 : int.Parse(cbogrdRelation.SelectedItem.Value);                cmd.CommandText = ETFConstants.sp_CreateEmergencyContact;                cmd.CommandType = CommandType.StoredProcedure;                cmd.ParameterAdd("@PersonID", DbType.Int32, MyPerson);                cmd.ParameterAdd("@FirstName", DbType.String, firstName);                cmd.ParameterAdd("@LastName", DbType.String, lastName);                cmd.ParameterAdd("@Relation", DbType.Int32, relation);                cmd.ParameterAdd("@HomeTelephone", DbType.String, homeTel);                cmd.ParameterAdd("@WorkTelephone", DbType.String, workTel);                cmd.ParameterAdd("@Extension", DbType.String, extn);                sql.ExecuteNonQuery(cmd);            }        }        protected void Page_Load(object sender, EventArgs e)        {            ConfigureGrid();        }        private void ConfigureGrid()        {            grdEmergency.DataSource = df.GetERContactData(MyToken);            grdEmergency.DataBind();        }    }}And User Control Code Behind
using System;using System.Data;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using YorkU.Data;using ARM.Common.Classes;using Telerik.Web.UI;namespace ARM.ETF.Controls{    public partial class emergencycontact : UserControl    {        DataFactory df = new DataFactory();        public const int MyPerson = 2;        protected override void OnInit(EventArgs e)        {            base.OnInit(e);        }        protected void Page_Load(object sender, EventArgs e)        {            LoadLabels();            LoadCombo();        }        private void LoadLabels()        {            lblgrdExtension.Text = ETFConstants.Label_Extension;            lblgrdFirstName.Text = ETFConstants.Label_FirstName;            lblgrdHomeTelephone.Text = ETFConstants.Label_TelephoneHome;            lblgrdLastName.Text = ETFConstants.Label_LastName;            lblgrdRelation.Text = ETFConstants.Label_Relation;            lblgrdWorkTelephone.Text = ETFConstants.Label_TelephoneWork;            btngrdSave.Text = ETFConstants.Btn_Save;        }        private void LoadCombo()        {            ListItem itm;            DataTableReader dtr;                         cbogrdRelation.Items.Clear();            itm = new ListItem();            itm.Text = ETFConstants.ComboDefaultText;            itm.Value = ETFConstants.ComboDefaultValue;            cbogrdRelation.Items.Add(itm);            dtr = df.GetRelations();            while (dtr.Read())            {                itm = new ListItem();                itm.Text = dtr["REFERENCE"].ToString();                itm.Value = dtr["CODE"].ToString();                cbogrdRelation.Items.Add(itm);            }        }    }}<telerik:RadGrid ID="trgMaatschappijID" runat="server" AllowPaging="true" AllowSorting="True" GridLines="None" Culture="Dutch (Netherlands)" OnItemDataBound="trgMaatschappijID_ItemDataBound"    AutoGenerateColumns="false" OnNeedDataSource="trgMaatschappijID_NeedDataSource" OnItemCommand="trgMaatschappijID_Item">    <MasterTableView AllowMultiColumnSorting="false" AllowFilteringByColumn="true" DataKeyNames="MaatschappijId" EditMode="EditForms">        <Columns>            <telerik:GridEditCommandColumn ButtonType="LinkButton" UniqueName="EditCommandColumn" EditText="Bewerken" />            <telerik:GridBoundColumn DataField="Maatschappij" HeaderText="Maatschappij" />            <telerik:GridBoundColumn DataField="AantalProducten" HeaderText="Aantal Producten" ReadOnly="true" />        </Columns>        <EditFormSettings EditFormType="Template" CaptionDataField="MaatschappijId" CaptionFormatString="Bewerking van maatschappij met ID: {0}" ColumnNumber="1">            <%--<EditColumn UpdateText="Opslaan" CancelText="Annuleren" UniqueName="EditCommandColumn1" />--%>            <FormTemplate>                <table border="0" cellpadding="2">                    <tr>                        <td>Naam van maatschappij :</td>                        <td>                            <asp:TextBox runat="server" ID="txtMaatschappijID" Text='<%# Bind("Maatschappij") %>' />                        </td>                    </tr>                    <tr>                        <td colspan="2">                            <asp:LinkButton ID="btnOpslaanID" CommandName="Update" Text="Opslaan" runat="server" />                        </td>                    </tr>                </table>            </FormTemplate>        </EditFormSettings>    </MasterTableView>    <SortingSettings SortedBackColor="Azure" EnableSkinSortStyles="false" SortToolTip="Klik hier om te sorteren" />    <PagerStyle Mode="NextPrevAndNumeric" Position="Bottom" />    <HeaderStyle Width="100px" /></telerik:RadGrid>