title: Problem with Telerik RadGrid: ‘Telerik.Web.UI.GridInsertionObject’ does not contain a property with the name 'XXX '
body: <p>I've been trying to find the workaround for the following problem for the last couple of hours, but without any success. I've found many of the possible solutions on the Internet, but none of them was solution to my problem. I've also posted the same question on official Telerik's forum even though I'm almost sure that I'll get no response from them.</p>
  
  <p>The problem occurs when I want to insert data into empty datasource. I've been able to find workarounds for RadComboBoxes, but not for the Textboxes. The error that is displayed is: "DataBinding: 'Telerik.Web.UI.GridInsertionObject' does not contain a property with the name 'OpciPrioritet'."</p>
  
  <p>Here is the code:</p>
  
  <p><strong>.ascx (needed for RadGrid):</strong></p>
  
  <pre><code>&lt;table&gt;
  &lt;tr&gt;
      &lt;td&gt;
          Nadređeni ticket:
      &lt;/td&gt;
      &lt;td colspan="3"&gt;
          &lt;telerik:RadComboBox ID="rcbNadredeniTicket" AppendDataBoundItems="true" runat="server"
              Width="455px"&gt;
          &lt;/telerik:RadComboBox&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;
          Prijavio:
      &lt;/td&gt;
      &lt;td colspan="3"&gt;
          &lt;telerik:RadComboBox ID="rcbPrijavio" AppendDataBoundItems="true" runat="server"
              Width="455px"&gt;
          &lt;/telerik:RadComboBox&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;
          Asset:
      &lt;/td&gt;
      &lt;td colspan="3"&gt;
          &lt;telerik:RadComboBox ID="rcbAsset" AppendDataBoundItems="true" runat="server" Width="455px"&gt;
          &lt;/telerik:RadComboBox&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;
          Opći prioritet:
      &lt;/td&gt;
      &lt;td&gt;
          &lt;asp:TextBox ID="txtOpciPrioritet" runat="server" Text='&lt;%# DataBinder.Eval(Container, "DataItem.OpciPrioritet") %&gt;'&gt;&lt;/asp:TextBox&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;
          Tip:
      &lt;/td&gt;
      &lt;td&gt;
          &lt;telerik:RadComboBox ID="rcbTip" runat="server"&gt;
          &lt;/telerik:RadComboBox&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;
          Status:
      &lt;/td&gt;
      &lt;td&gt;
          &lt;telerik:RadComboBox ID="rcbStatus" runat="server"&gt;
          &lt;/telerik:RadComboBox&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;
          Datum prijave:
      &lt;/td&gt;
      &lt;td&gt;
          &lt;asp:TextBox ID="txtDatumPrijave" runat="server" Text='&lt;%# DataBinder.Eval(Container, "DataItem.DatumPrijave") %&gt;'&gt;&lt;/asp:TextBox&gt;
      &lt;/td&gt;
      &lt;td&gt;
          Vrsta prijave:
      &lt;/td&gt;
      &lt;td&gt;
          &lt;telerik:RadComboBox ID="rcbVrstaPrijave" Text='&lt;%# DataBinder.Eval(Container, "DataItem.VrstaPrijave") %&gt;'
              runat="server"&gt;
          &lt;/telerik:RadComboBox&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;
          Prioritet:
      &lt;/td&gt;
      &lt;td&gt;
          &lt;telerik:RadComboBox ID="rcbPrioritet" Text='&lt;%# DataBinder.Eval(Container, "DataItem.Prioritet") %&gt;'
              runat="server"&gt;
          &lt;/telerik:RadComboBox&gt;
      &lt;/td&gt;
      &lt;td&gt;
          Deadline:
      &lt;/td&gt;
      &lt;td&gt;
          &lt;asp:TextBox ID="txtDeadline" runat="server" Text='&lt;%# DataBinder.Eval(Container, "DataItem.DatumDo") %&gt;'&gt;&lt;/asp:TextBox&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;
          Opis:
      &lt;/td&gt;
      &lt;td colspan="3"&gt;
          &lt;asp:TextBox ID="txtOpis" runat="server" TextMode="MultiLine" Width="455px" Height="200px"
              Text='&lt;%# DataBinder.Eval(Container, "DataItem.Opis") %&gt;'&gt;&lt;/asp:TextBox&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;
          Zatvoren ticket:
      &lt;/td&gt;
      &lt;td&gt;
          &lt;asp:CheckBox ID="chkZatvoren" runat="server" Checked='&lt;%# CheckNull(DataBinder.Eval(Container, "DataItem.Zatvoren")) %&gt;' /&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;
          Opis zatvorenog ticketa:
      &lt;/td&gt;
      &lt;td colspan="3"&gt;
          &lt;asp:TextBox ID="txtOpisZatvorenog" runat="server" TextMode="MultiLine" Width="455px"
              Height="200px" Text='&lt;%# DataBinder.Eval(Container, "DataItem.OpisZatvoren") %&gt;'&gt;&lt;/asp:TextBox&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;
          Bilješke:
      &lt;/td&gt;
      &lt;td colspan="3"&gt;
          &lt;asp:TextBox ID="txtBiljeske" runat="server" TextMode="MultiLine" Width="455px" Height="200px"
              Text='&lt;%# DataBinder.Eval(Container, "DataItem.Biljeske") %&gt;'&gt;&lt;/asp:TextBox&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;
          &lt;asp:Button ID="btnUpdate" Text="Spremi" runat="server" CommandName="Update" Visible='&lt;%# !(DataItem is Telerik.Web.UI.GridInsertionObject) %&gt;'&gt;
          &lt;/asp:Button&gt;
          &lt;asp:Button ID="btnInsert" Text="Spremi" runat="server" CommandName="PerformInsert"
              Visible='&lt;%# DataItem is Telerik.Web.UI.GridInsertionObject %&gt;'&gt;&lt;/asp:Button&gt;
  
          &lt;asp:Button ID="btnCancel" Text="Odustani" runat="server" CausesValidation="False"
              CommandName="Cancel"&gt;&lt;/asp:Button&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>.aspx.cs (only the needed code snippet):</strong></p>
  
  <pre><code>        protected void gvTicketi_ItemDataBound(object sender, GridItemEventArgs e)
      {
          int idFirma = Convert.ToInt16(Request.QueryString["idt"]);
  
          if ((e.Item is GridEditFormItem) &amp;&amp; e.Item.IsInEditMode )
          {
              GridEditFormItem editFormItem = (GridEditFormItem)e.Item;
              UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
  
              TSEntities db = new TSEntities();
              Ticket ticket = new Ticket();
              TicketAsset ticketAsset = new TicketAsset();
  
              RadComboBox rcbTip = (RadComboBox)userControl.FindControl("rcbTip");
              rcbTip.Items.Add(new RadComboBoxItem("Incident"));
              rcbTip.Items.Add(new RadComboBoxItem("Reklamacija"));
              rcbTip.Items.Add(new RadComboBoxItem("Nova funkcionalnost"));
              rcbTip.DataBind();
              rcbTip.Text = "'&lt;%# DataBinder.Eval(Container, 'DataItem.Tip') %&gt;'";
  
              RadComboBox rcbStatus = (RadComboBox)userControl.FindControl("rcbStatus");
              rcbStatus.Items.Add(new RadComboBoxItem("New"));
              rcbStatus.Items.Add(new RadComboBoxItem("U radu"));
              rcbStatus.Items.Add(new RadComboBoxItem("On hold"));
              rcbStatus.Items.Add(new RadComboBoxItem("Pending"));
              rcbStatus.Items.Add(new RadComboBoxItem("Scheduled"));
              rcbStatus.Items.Add(new RadComboBoxItem("Canceled"));
              rcbStatus.Items.Add(new RadComboBoxItem("Completed"));
              rcbStatus.DataBind();
              rcbStatus.Text = "'&lt;%# DataBinder.Eval(Container, 'DataItem.Status') %&gt;'";
  
              RadComboBox rcbVrstaPrijave = (RadComboBox)userControl.FindControl("rcbVrstaPrijave");
              rcbVrstaPrijave.Items.Add(new RadComboBoxItem("Usmeno"));
              rcbVrstaPrijave.Items.Add(new RadComboBoxItem("Telefon"));
              rcbVrstaPrijave.Items.Add(new RadComboBoxItem("E-mail"));
              rcbVrstaPrijave.Items.Add(new RadComboBoxItem("Web"));
              rcbVrstaPrijave.DataBind();
              rcbVrstaPrijave.Text = "'&lt;%# DataBinder.Eval(Container, 'DataItem.VrstaPrijave') %&gt;'";
  
              RadComboBox rcbPrioritet = (RadComboBox)userControl.FindControl("rcbPrioritet");
              rcbPrioritet.Items.Add(new RadComboBoxItem("Low"));
              rcbPrioritet.Items.Add(new RadComboBoxItem("Normal"));
              rcbPrioritet.Items.Add(new RadComboBoxItem("High"));
              rcbPrioritet.Items.Add(new RadComboBoxItem("Odmah"));
              rcbPrioritet.DataBind();
              rcbPrioritet.Text = "'&lt;%# DataBinder.Eval(Container, 'DataItem.Prioritet') %&gt;'";
  
              RadComboBox rcbNadredeniTicket = (RadComboBox)userControl.FindControl("rcbNadredeniTicket");
              var nadredenTicketList = (from t in db.Ticket
                                          select t).ToList();
  
              if (nadredenTicketList.Count &gt; 0)
              {
                  rcbNadredeniTicket.DataSource = from t in nadredenTicketList
                                                  where t.idFirma == idFirma &amp;&amp; t.Zatvoren == false
                                                  select new { t.idTicket, t.idNadredeniTicket, OpisTicketa = t.idTicket + " - " + t.Opis };
  
                  rcbNadredeniTicket.DataTextField = "OpisTicketa";
                  rcbNadredeniTicket.DataValueField = "idTicket";
                  rcbNadredeniTicket.Text = "'&lt;%# DataBinder.Eval(Container, 'DataItem.idNadredeniTicket') %&gt;'";
              }
  
              rcbNadredeniTicket.Items.Add(new RadComboBoxItem("Bez nadređenog ticketa", "0"));
              rcbNadredeniTicket.DataBind();
  
              RadComboBox rcbPrijavio = (RadComboBox)userControl.FindControl("rcbPrijavio");
              rcbPrijavio.DataSource = from k in db.Kontakt
                                       where k.idFirma == idFirma
                                       select new { k.idKontakt, kontaktNaziv = k.Ime + " " + k.Prezime };
  
              rcbPrijavio.Items.Add(new RadComboBoxItem("Bez kontakta", "0"));
              rcbPrijavio.DataTextField = "kontaktNaziv";
              rcbPrijavio.DataValueField = "idKontakt";
              rcbPrijavio.Text = "'&lt;%# DataBinder.Eval(Container, 'DataItem.idKontakt') %&gt;'";
              rcbPrijavio.DataBind();
  
              RadComboBox rcbAsset = (RadComboBox)userControl.FindControl("rcbAsset");
              var assetList = (from a in db.Asset
                               where a.idFirma == idFirma
                               select a).ToList();
  
              if (assetList.Count &gt; 0)
              {
                  var assets = from a in assetList
                               where a.idFirma == idFirma
                               select new { a.idAsset, Naziv = a.Naziv + " (" + a.Kontakt.Ime + " " + a.Kontakt.Prezime + ")" };
  
                  rcbAsset.DataSource = assets;
                  rcbAsset.DataTextField = "Naziv";
                  rcbAsset.DataValueField = "idAsset";
                  rcbAsset.Text = "'&lt;%# DataBinder.Eval(Container, 'DataItem.Naziv') %&gt;'";
                  rcbAsset.Items.Add(new RadComboBoxItem("Bez pridruženog asseta", "0"));
                  rcbAsset.DataBind();
              }                             
  
  
              if (!e.Item.OwnerTableView.IsItemInserted)
              {
                  int idTicket = Convert.ToInt32(editFormItem.GetDataKeyValue("idTicket"));
                  ticket = db.Ticket.SingleOrDefault(t =&gt; t.idTicket == idTicket);
  
                  string tip = ticket.Tip;
                  rcbTip.Items.FindItemByText(tip).Selected = true;
  
                  string status = ticket.Status;
                  rcbStatus.Items.FindItemByText(status).Selected = true;
  
                  string vrstaPrijave = ticket.VrstaPrijave;
                  rcbVrstaPrijave.Items.FindItemByText(vrstaPrijave).Selected = true;
  
                  string prioritet = ticket.Prioritet;
                  rcbPrioritet.Items.FindItemByText(prioritet).Selected = true;
  
                  int kontakt = Convert.ToInt32(ticket.idKontakt);
  
                  if (ticket.idKontakt == null)
                  {
                      rcbPrijavio.Items.FindItemByValue("0").Selected = true;
                  }
                  else
                  {
                      rcbPrijavio.Items.FindItemByValue(kontakt.ToString()).Selected = true;
                  }
  
                  int nadredeniTicket = Convert.ToInt32(ticket.idNadredeniTicket);
  
                  if (ticket.idNadredeniTicket == null)
                  {
                      rcbNadredeniTicket.Items.FindItemByValue("0").Selected = true;
                  }
                  else
                  {
                      rcbNadredeniTicket.Items.FindItemByValue(nadredeniTicket.ToString()).Selected = true;
                  }
  
                  var ticketAssetCount = from ta in db.TicketAsset
                                         where ta.idTicket == idTicket
                                         select ta;                  
  
                  if (ticketAssetCount.Count() &gt; 0)
                  {
                      ticketAsset = db.TicketAsset.SingleOrDefault(ta =&gt; ta.idTicket == idTicket);
  
                      int asset = Convert.ToInt32(ticketAsset.idAsset);
  
                      rcbAsset.Items.FindItemByValue(asset.ToString()).Selected = true;
                  }
                  else
                  {
                      rcbAsset.Items.FindItemByValue("0").Selected = true;
                  }
              }
              else if (e.Item.OwnerTableView.IsItemInserted)
              {
                  var newVals = new System.Collections.Specialized.ListDictionary();
                  newVals["OpciPrioritet"] = string.Empty;
                  e.Item.OwnerTableView.InsertItem(newVals);
              }
          }
      }
  </code></pre>
  
  <p><strong>.aspx:</strong></p>
  
  <pre><code>    &lt;telerik:RadGrid ID="gvTicketi" runat="server" AllowPaging="True" AllowSorting="True"
      AutoGenerateColumns="False" CellSpacing="0" GridLines="None" 
      onneeddatasource="gvTicketi_NeedDataSource" 
      onitemdatabound="gvTicketi_ItemDataBound" 
      oninsertcommand="gvTicketi_InsertCommand" 
      onupdatecommand="gvTicketi_UpdateCommand"&gt;
      &lt;MasterTableView DataKeyNames="idTicket" CommandItemDisplay="TopAndBottom" InsertItemPageIndexAction="ShowItemOnCurrentPage"&gt;
          &lt;CommandItemSettings AddNewRecordText="Dodaj novi ticket" RefreshText="Prikaži sve tickete" /&gt;
          &lt;Columns&gt;
              &lt;telerik:GridBoundColumn UniqueName="idTicket" HeaderText="Ticket" DataField="idTicket"&gt;
              &lt;/telerik:GridBoundColumn&gt;
              &lt;telerik:GridBoundColumn UniqueName="idKontakt" HeaderText="Kontakt" DataField="idKontakt"&gt;
              &lt;/telerik:GridBoundColumn&gt;
              &lt;telerik:GridBoundColumn UniqueName="idManager" HeaderText="Manager" DataField="idManager"&gt;
              &lt;/telerik:GridBoundColumn&gt;
              &lt;telerik:GridBoundColumn UniqueName="Opis" HeaderText="Opis" DataField="Opis"&gt;
              &lt;/telerik:GridBoundColumn&gt;
              &lt;telerik:GridBoundColumn UniqueName="TicketNumber" HeaderText="Broj ticketa" DataField="TicketNumber"&gt;
              &lt;/telerik:GridBoundColumn&gt;
              &lt;telerik:GridBoundColumn UniqueName="DatumPrijave" HeaderText="Datum prijave" DataField="DatumPrijave" DataFormatString="{0:dd.MM.yyyy.}"&gt;
              &lt;/telerik:GridBoundColumn&gt;
              &lt;telerik:GridBoundColumn UniqueName="VrstaPrijave" HeaderText="Vrsta prijave" DataField="VrstaPrijave"&gt;
              &lt;/telerik:GridBoundColumn&gt;
              &lt;telerik:GridBoundColumn UniqueName="Tip" HeaderText="Tip" DataField="Tip"&gt;
              &lt;/telerik:GridBoundColumn&gt;
              &lt;telerik:GridBoundColumn UniqueName="Status" HeaderText="Status" DataField="Status"&gt;
              &lt;/telerik:GridBoundColumn&gt;
              &lt;telerik:GridBoundColumn UniqueName="Prioritet" HeaderText="Prioritet" DataField="Prioritet"&gt;
              &lt;/telerik:GridBoundColumn&gt;
              &lt;telerik:GridBoundColumn UniqueName="OpciPrioritet" HeaderText="Opći prioritet" DataField="OpciPrioritet"&gt;
              &lt;/telerik:GridBoundColumn&gt;
              &lt;telerik:GridBoundColumn UniqueName="Deadline" HeaderText="Deadline" DataField="DatumDo" DataFormatString="{0:dd.MM.yyyy.}"&gt;
              &lt;/telerik:GridBoundColumn&gt;
              &lt;telerik:GridCheckBoxColumn UniqueName="Zatvoren" HeaderText="Zatvoren" DataField="Zatvoren"&gt;
              &lt;/telerik:GridCheckBoxColumn&gt;
              &lt;telerik:GridEditCommandColumn UniqueName="EditCommandColumn"&gt;
              &lt;/telerik:GridEditCommandColumn&gt;
              &lt;telerik:GridButtonColumn UniqueName="DeleteColumn" Text="Delete" CommandName="Delete"
                  ConfirmDialogType="RadWindow" ConfirmText="Brisanje ticketa!" /&gt;
          &lt;/Columns&gt;
          &lt;EditFormSettings UserControlName="UserControls/TicketUserControl.ascx" EditFormType="WebUserControl"&gt;
              &lt;EditColumn UniqueName="EditCommandColumn1"&gt;
              &lt;/EditColumn&gt;
          &lt;/EditFormSettings&gt;
      &lt;/MasterTableView&gt;
  &lt;/telerik:RadGrid&gt;
  </code></pre>
  
  <p>I really hope you guys will be able to help me so any help would be appreciated!</p>