Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
62 views
I can update just fine in a custom templated form but when I click the "Add new record" button that is generated by the RadGrid, I get an exception in my "InstantiateIn" method of "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index". I'm guessing I have to check whether the grid is performing an insert vs and update, but I'm not sure how to do this. 



public void InstantiateIn(System.Web.UI.Control container) 
            //This throws exception
            GridEditFormItem item = ((GridEditFormItem)(container.NamingContainer)); 
 
Michael Malone
Top achievements
Rank 1
 answered on 14 May 2010
3 answers
664 views
Hi,

I know this is probably a very simple scenario but I cannot work it out. I need to get the "Username" value from a GridTemplateColumn and place it into the ItemDataBound event in the code behind, here is the column:

<telerik:GridTemplateColumn DataField="Username"  
                            HeaderText="Username" 
                            UniqueName="Username"  
                            SortExpression="Username">

<ItemTemplate> 
         <asp:Label ID="lblUsername" runat="server" Text='<%# Eval("Username") %>' /> 
        </ItemTemplate> 
</telerik:GridTemplateColumn> 

And here is the code behind:

    protected void MembersGrid_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if ((e.Item is GridDataItem))  
        { 
            GridDataItem dataItem = (GridDataItem)e.Item; 
            string username = dataItem["Username"].Text; 
 
            ImageButton btnEditUser = (ImageButton)e.Item.FindControl("EditUserImgBtn"); 
            btnEditUser.Attributes["href"] = "#"
            btnEditUser.Attributes["onclick"] = String.Format("return ShowEditUser('{0}', '{1}');", username, e.Item.ItemIndex); 
    } 
    } 

I need to get the value of the GridTemplateColumn ("Username") into the ShowEditUser('{0}', '{1}');", username, e.Item.ItemIndex), can someone please offer some advice this would be much appreciated.

Do I need to use a GridBoundColumn instead of the above? I don't think that would make any difference though.

Thank you in advance for help :)

Mike
Top achievements
Rank 2
 answered on 14 May 2010
2 answers
193 views
Hi,

 is there any easy solution to have still selected row when Grid looses control? When it happens row is not selected any more. Such solution is for example in windows controls, when the row just changes colour (i.e. on grey ).

Thanks for any answer
M.
Cartoon Head
Top achievements
Rank 1
 answered on 14 May 2010
2 answers
92 views
Okay, so I've got a ComboBox that contains a RadTreeView, very similar to the Telerik demo.  Neat functionality.  However, when I'm first loading the page, I naturally want to set both the state of the embedded RadTreeView control and the RadComboBox itself.

In the snippet of code pasted below, you can see how I'm doing this.  (This is all from the Code-Behind.)  The name of the RadComboBox is "WebsiteDocumentationParent," and as you can see in the final line, I'm setting it's .Text property value to be the same as the .Text property of the node that's been selected in the embedded RadTreeView.

The code runs fine, no errors are generated.  However, on the browser the default EmptyMessage always displays.  What could be going on to cause this?

                if (reader.Read())
                {
                    WebsiteDocumentationID.Value = Convert.ToString(reader["webdocID"]);
                    WebsiteDocumentationPageTitle.Text = Convert.ToString(reader["webdocPageTitle"]);
                    WebsiteDocumentationFileEditor.Content = Convert.ToString(reader["webdocContent"]);
                    WebsiteDocumentationParentID.Value = parentID = reader["webdocParentID"].ToString();
                    WebsiteDocumentationParent.Text = ""; // by default empty out the Parent name
                    if (parentID != "")
                    {
                        RadTreeView RadTreeView2 = (RadTreeView)WebsiteDocumentationParent.Items[0].FindControl("RadTreeView2");
                        RadTreeNode foundNode = RadTreeView2.FindNodeByValue(parentID);
                        if (foundNode != null)
                        {
                            foundNode.Selected = true;
                        }
                        WebsiteDocumentationParent.Text = foundNode.Text;
                    }

Jesse Lawler
Top achievements
Rank 1
 answered on 14 May 2010
2 answers
121 views
Hello Guys,

i testet some of the functions of your Rad Grid, i can not add the Grid or the Columns
via design mode, they are dynamical added  serverside.
I checked all the Samples that you wrote but can find nothing that fits to my situation.

Sorting stays enabled, but the selected Rows are gone through paging.


Code in ascx

 
<telerik:RadAjaxPanel ID="_panFilec" runat="server" Height="188px" 
    Width="90%" LoadingPanelID="_fileconloadpan" oninit="RadAjaxPanel1_Init" Visible="false" > 
<telerik:RadAjaxLoadingPanel ID="_fileconloadpan" runat="server" Height="75px" 
            Width="75px" Transparency="30"
<img src="/_layouts/images/myTestloader.gif" alt="Loading..." style="border: 0; margin-top: 45px; color:Black;"/> 
</telerik:RadAjaxLoadingPanel> 
    </telerik:RadAjaxPanel> 

Code for Grid:
public partial class TestWebControl : System.Web.UI.UserControl 
    { 
        private const string _LOADINGSOURCE = "/_controltemplates/TestWebControl.ascx"
        private const string _VIEWSTATEITEMID = "VIEWSTATEITEMID"
        private const string _DATASOURCECACHE = "_DATASORCECACHE"
 
        private ICachingOperations _caching; 
        private ITelerikBehavior _telerikbehavior; 
        private ISearchBehavior _search; 
 
        private RadGrid _gridViewContent; 
        private List<GridColumn> _columns; 
 
        public List<GridColumn> Columns 
        { 
            get 
            { 
                 return this._columns; 
            } 
            set 
            { 
                this._columns= value; 
            } 
        } 
        private string _lastchacheDependency; 
 
        private string _chacheDependency; 
 
        public string CacheDependency 
        { 
            get { return _chacheDependency; } 
            set { _chacheDependency = value; } 
        } 
 
        public ISearchBehavior Search 
        { 
            get { return _search; } 
            set { _search = value; } 
        } 
 
        private bool _enableSelectColumn = true
 
        public bool EnableSelectColumn 
        { 
            get { return _enableSelectColumn ; } 
            set { _enableSelectColumn = value; } 
        } 
 
 
        public ITelerikBehavior Telerikbehavior 
        { 
            get 
            { 
                if (_telerikbehavior != null
                { return _telerikbehavior; } 
                else 
                { 
                    this._telerikbehavior = new TestTelerikBehavior(); 
                    return _telerikbehavior; 
                } 
            } 
            set 
            { 
                if (_telerikbehavior != null
                { 
                    _telerikbehavior = value; 
                } 
            } 
        } 
 
        public ICachingOperations Caching 
        { 
            get { 
                 
                if(_caching!=null
                {return _caching;} 
 
                else 
                { 
                    this._caching = new ControlToSession(this.ID); 
                    return _caching; 
                } 
            } 
            set 
            { 
                if (value != null
                {_caching = value;} 
            } 
        } 
 
        public static TestWebControl LoadFileContent(Page page) 
        { 
            return page.LoadControl(_LOADINGSOURCE) as FileContentWebControl; 
        } 
 
        private int pageSize = 5; 
        /// <summary> 
        /// Gets or sets the number of items to show per page 
        /// </summary> 
        public int PageSize 
        { 
            get { return pageSize; } 
            set { pageSize = value; } 
        } 
 
        //public void ResetColumns(List<GridColumn> columns) 
        //{ 
 
        //     
        //} 
 
        protected override void OnInit(EventArgs e) 
        { 
            base.OnInit(e); 
 
            
 
            _gridViewContent = new RadGrid(); 
            _gridViewContent.AutoGenerateColumns = false
            _gridViewContent.Attributes.Add("Width""80%"); 
            _gridViewContent.AllowPaging = true
            _gridViewContent.PageSize = this.PageSize; 
            _gridViewContent.AllowSorting = true
            _gridViewContent.AllowMultiRowSelection = true
            _gridViewContent.PagerStyle.Mode=GridPagerMode.NextPrev; 
            //_gridViewContent.ClientSettings.AllowDragToGroup = true; 
            _gridViewContent.ClientSettings.EnableRowHoverStyle = true
            _gridViewContent.ClientSettings.EnablePostBackOnRowClick = true
            //_gridViewContent.ClientSettings.Selecting.AllowRowSelect = true; 
            //_gridViewContent.ItemCreated += new GridItemEventHandler(_gridViewContent_ItemCreated); 
            _gridViewContent.Skin = this.Telerikbehavior.TelerikSkin; 
            //_gridViewContent.EnableViewState = false; 
            _gridViewContent.NeedDataSource+=new GridNeedDataSourceEventHandler(_gridViewContent_NeedDataSource); 
        } 
 
        void _gridViewContent_NeedDataSource(object source, GridNeedDataSourceEventArgs e) 
        { 
            if (!string.IsNullOrEmpty(_chacheDependency) && Columns != null
            { 
 
                DataTable datssource = getData(); 
                if (source != null && datssource.Rows.Count > 0) 
                { 
                     
                  _gridViewContent.DataSource = datssource; 
  
                } 
                else 
                { 
                    _gridViewContent.DataSource = null
                } 
            } 
            else 
            { 
                _gridViewContent.DataSource = null
            } 
        } 
 
        //void _gridViewContent_ItemCreated(object sender, GridItemEventArgs e) 
        //{ 
 
        //    if (e.Item is GridDataItem) 
        //    { 
        //        e.Item.PreRender += new EventHandler(Item_PreRender); 
        //    } 
        //} 
 
        //void Item_PreRender(object sender, EventArgs e) 
        //{ 
        //    ((sender as GridDataItem)["CheckBoxTemplateColumn"].FindControl("IMGchbx") as CheckBox).Checked = (sender as GridDataItem).Selected; 
        //} 
 
        protected void RadAjaxPanel1_Init(object sender, EventArgs e) 
        { 
        
        } 
 
        protected override void CreateChildControls() 
        { 
            base.CreateChildControls(); 
            string traceConst = _TRACECONST + "CreateChildControls()"
            ECSpand.Logging.Log.WriteDebug("Entering", traceConst); 
 
            
              if (Columns != null
              { 
                  if (_enableSelectColumn ) 
                  { 
                      TESTCHBoxColumn columnun = new TESTCHBoxColumn(); 
                      columnun.UniqueName = "CheckBoxTemplateColumn"
                      _gridViewContent.MasterTableView.Columns.Add(columnun); 
 
                  } 
 
                  //_gridViewContent.Columns.Clear(); 
                  Columns.ForEach(o => _gridViewContent.Columns.Add(o)); 
              } 
             
            if (ViewState[_VIEWSTATEITEMID] != null
                _lastchacheDependency = (ViewState[_VIEWSTATEITEMID] as string); 
 
            _panFilec.Controls.Add(_gridViewContent); 
        } 
 
        protected override void OnPreRender(System.EventArgs e) 
        { 
              if (!string.IsNullOrEmpty(_chacheDependency) && Columns !=null
            { 
                DataTable source = getData(); 
                if (source !=null && source.Rows.Count > 0) 
                { 
                    _gridViewContent.DataSource = source; 
                    if (ItemChanged()) 
                    { 
                        _gridViewContent.Rebind(); 
                    } 
                    _panFilec.Visible = true
                } 
                else 
                { _gridViewContent.Rebind(); } 
 
                ViewState[_VIEWSTATEITEMID] = this._chacheDependency; 
            } 
            else 
            { 
                _gridViewContent.Rebind(); 
                ViewState[_VIEWSTATEITEMID] = null
            } 
 
           
        } 
 
        public void ResetGridView() 
        { 
            if (_gridViewContent != null
            { 
                //_gridViewContent.DataSource = null; 
                this._chacheDependency = null
                _gridViewContent.Rebind(); 
                _panFilec.Controls.Clear(); 
                _panFilec.Visible = false
                this.Caching.RemoveObjectFromSession(_DATASOURCECACHE); 
            } 
        } 
 
        private DataTable getData() 
        { 
 
            if (ItemChanged()&& Search!=null
            { 
                DataTable table = this.Search.PerformSearch(); 
                this.Caching.SaveObjectToSession(_DATASOURCECACHE, table); 
                return table; 
            } 
 
            else 
            { 
                return this.Caching.GetObjectFromSession(_DATASOURCECACHE) as DataTable; 
            } 
        } 
 
 
        protected override void Render(HtmlTextWriter writer) 
        { 
 
            _panFilec.RenderControl(writer); 
 
        } 
 
        /// <summary> 
        /// Checks, if a different item is displayed 
        /// </summary> 
        /// <returns></returns> 
        bool ItemChanged() 
        { 
            return !(_chacheDependency.CompareTo(_lastchacheDependency)==0); 
        } 
 
    } 

Code for Column Template:
 
  public class TESTCHBoxColumn: GridTemplateColumn 
    { 
        public TESTCHBoxColumn() 
        { 
            ISImageButtonTemplate btntemplate = new ISImageButtonTemplate(); 
            ISImageCheckBox chbxtempalte = new ISImageCheckBox(); 
 
            this.HeaderTemplate = btntemplate; 
            this.ItemTemplate = chbxtempalte; 
        } 
    } 
 
 public class ISImageButtonTemplate : System.Web.UI.ITemplate 
    { 
        #region ITemplate Members 
        private const string _CHECKATT = "CHECKATT"
        ImageButton _btn; 
 
        public ISImageButtonTemplate() 
        { 
            _btn = new ImageButton(); 
            _btn.ID = "ISImgBtn"
            _btn.ImageUrl = "/_layouts/images/niceTestpic.png"
            _btn.Click += new System.Web.UI.ImageClickEventHandler(_btn_Click); 
            _btn.Attributes.Add(_CHECKATT, "false"); 
        } 
 
        public void InstantiateIn(System.Web.UI.Control container) 
        { 
            container.Controls.Add(_btn); 
        } 
 
        void _btn_Click(object sender, System.Web.UI.ImageClickEventArgs e) 
        { 
            ImageButton imgbtn = sender as ImageButton; 
            RadGrid grid = imgbtn.Parent.Parent.Parent.Parent.Parent.Parent as RadGrid; 
            if (grid != null
            { 
                bool check = !My.ConversionHelper.StringToBool(imgbtn.Attributes[_CHECKATT] as string); 
 
                foreach (GridDataItem dataItem in grid.Items) 
                { 
                    (dataItem.FindControl("IMGchbx"as CheckBox).Checked = check; 
                    dataItem.Selected = check; 
                } 
                imgbtn.Attributes[_CHECKATT] = (check).ToString(); 
            } 
 
        } 
    } 
 
  public class ISImageCheckBox :System.Web.UI.ITemplate 
    { 
 
       private CheckBox _box; 
       private int number = 0; 
 
        public ISImageCheckBox() 
        { 
            number = 0; 
        } 
 
        public void InstantiateIn(System.Web.UI.Control container) 
        { 
            number++; 
            _box = new CheckBox(); 
            _box.AutoPostBack = true
            _box.ID = "IMGchbx"
            _box.CheckedChanged += new EventHandler(_box_CheckedChanged); 
 
            container.Controls.Add(_box); 
        } 
 
          void _box_CheckedChanged(object sender, EventArgs e) 
        { 
            ((sender as CheckBox).Parent.Parent as GridItem).Selected = (sender as CheckBox).Checked; 
        } 
 
   
    } 




David
Top achievements
Rank 1
 answered on 14 May 2010
19 answers
288 views
Hello,

Telerik verision: 2009.1.402.35

This is driving me nuts.  VS 2008 SP1, IIS 5.1 on XP Pro SP3 no problems whatsoever.  However, try to deploy on a customers laptop running Vista Home Premium IIS7 and the fun starts.

I am getting the error below, line 30 highlighted.  I have tried the help article on deploying under IIS located here:

http://www.telerik.com/help/aspnet-ajax/installtroubleshootingproductionserver.html

But I have no experience of IIS 7 before and this article does not match the IIS7 interface or options as far as I can see.






Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Cannot create an object of type 'System.Type' from its string representation 'System.Int32' for the 'DataType' property.

Source Error:

Line 28:         <asp:Label ID="LabelBackupsToKeep" runat="server" Text="Number of Backups to Keep:"
Line 29:             Width="300px"></asp:Label>
Line 30:         <telerik:RadNumericTextBox ID="RadNumericTextBoxBackupsToKeep" runat="server" DataType="System.Int32"
Line 31:             EmptyMessage="0 to 100" MaxValue="100" MinValue="0" ReadOnly="True">
Line 32:             <NumberFormat AllowRounding="False" DecimalDigits="0" />
Fred
Top achievements
Rank 1
 answered on 14 May 2010
9 answers
471 views
   I'm not exactly sure if this is a Rad control issue or not, but i'm thinking it is because the error started occurring after I added a rad grid to the program.  I have a web page that has several controls in it, including an ajax manager/loading panel.  the user adds an item number and when the add button is clicked, the manager is activated and it adds the item number to a grid (asp:GridView).  Everything works fine with that.  I just added a RadGrid and when a submit button (not the add button) is clicked, it sends out a url, which brings back info and enters that info into the rad grid. This is working just fine when using most internet browsers.  When I use Firefox with this, it's erroring out, almost like it's not even reaching my code.  here's the page i get:

Server Error in '/' Application.

Input string was not in a correct format.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: Input string was not in a correct format.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[FormatException: Input string was not in a correct format.]
   System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +7469351
   System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +119
   System.Web.UI.WebControls.ImageButton.LoadPostData(String postDataKey, NameValueCollection postCollection) +193
   System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +14
   System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +693
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1743


Version Information: Microsoft .NET Framework Version:2.0.50727.3082; ASP.NET Version:2.0.50727.3082

Any possibly information would be greatly appreciated.  Thanks!
Amanda
Top achievements
Rank 2
 answered on 14 May 2010
2 answers
249 views
Hello,
  • .Net 3.5Sp1
  • Win2003 server
  • IE 7 and 8
  • Telerik RadControls 2010.1.45  (2010 NET35)
  • preferred programming language C#
  • Receiving the error: "Insert Item is available only when grid is in insert mode."  Shown at the end of this post.  I have a grid with 3 text boxes and 3 dropdown lists.  When I click a link " Add new item" it calls the RadGrid1_InsertCommand which would add a blank record to my data source and then I rebind.  I do not modify any of the controls directly just the data source and rebind.  Suddenly I have started to recieve this error and I don't understand what has changed for me to start getting this error. I've had this working fine.  Please provide any insight you may have.

    <Page snippet>
     <rad:RadGrid ID="RadGrid1"
                            runat="server"
                            AutoGenerateColumns="False"
                            BorderStyle="Groove"
                            BorderWidth="2px"                       
                            UseAccessibleHeader="true"                       
                            Width="95%"
                            EnableEmbeddedSkins="false"
                            Skin="Skin1"
                            OnPreRender="RadGrid1_PreRender" GridLines="None" >
                            <itemstyle backcolor="Gainsboro" />
                            <alternatingitemstyle backcolor="WhiteSmoke" />
                            <MasterTableView EditMode="InPlace" DataKeyNames="EKey"
                                CommandItemDisplay="Bottom" AddNewRecordText="New Item" horizontalalign="Center">
                                <CommandItemTemplate>
                                    <asp:LinkButton ID="lnkAddNew" runat="server" CommandName="PerformInsert" ><img style="border:0px;" alt="New Item" src="/Grid/AddRecord.gif" /> Add CPE</asp:LinkButton>
                                </CommandItemTemplate>
                                <rowindicatorcolumn>
                                    <HeaderStyle Width="20px" />
                                </rowindicatorcolumn>
                                <expandcollapsecolumn>
                                    <HeaderStyle Width="20px" />
                                </expandcollapsecolumn>
                                <Columns>                                                       
                               
                                <rad:GridBoundColumn DataField="EKey" ReadOnly="false" Visible="false" UniqueName="ElementCPEKey"/>
                                <%--<rad:GridBoundColumn DataField="CKey" ReadOnly="false" Visible="false" UniqueName="CPEKey"/>--%>                                                                                 
                                                           
                                <rad:GridTemplateColumn HeaderText="Item Name" ItemStyle-Wrap="true" ItemStyle-width="20%" ItemStyle-CssClass="StdFont">
                                    <ItemTemplate><%# Eval("ItemNameText")%></ItemTemplate>                                                  
                                    <EditItemTemplate >
                                        <rad:RadTextBox ID="txtItemName" runat="server" Columns="60" Text='<%# Eval("ItemName") %>' width="99%"  OnTextChanged="txtItemName_OnTextChanged" AutoPostBack="true"></rad:RadTextBox>
                                        <br />                                                              
                                    </EditItemTemplate>                            
                                    <ItemStyle Width="20%" Wrap="True" />
                                </rad:GridTemplateColumn>
    </End Page Snippet>
    <Code Behind Grid Events>
     #region Grid methods
        private void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item is GridEditableItem && (e.Item as GridEditableItem).IsInEditMode)
            {
                //LoadLookupData(RadGrid1.MasterTableView.Items.Count - 1);
                GridEditableItem editedItem = e.Item as GridEditableItem;
                EDTO gridDTO = e.Item.DataItem as EDTO;

                VMSDropDownList ddl = editedItem.FindControl("ddlList") as VMSDropDownList;
                ddl.DataTextField = "Descrip";
                ddl.DataValueField = "ListKey";
                ddl.DataSource = Manager.RetrieveList(session);
                ddl.DataBind();
                ddl.Items.Insert(0, new ListItem("None"));
                ddl.SelectedValue = 1;

                <... repeated twice with two other lists ...>
                }
        }
        void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)
        {
            //if (dsDTO == null)
            //{
            //    dsDTO = new DataSource<EDTO>();
            //    AddBlankRow();
            //}
            //else
            //{
            //    GridDataItem dataItem = RadGrid1.MasterTableView.Items[RadGrid1.MasterTableView.Items.Count - 1];

            //    RadTextBox itemTextBox = dataItem.FindControl("txtItemName") as RadTextBox;
            //    RadTextBox itemIDTextBox = dataItem.FindControl("txtItemID") as RadTextBox;
            //    if (itemTextBox.Text.Length > 0 && itemIDTextBox.Text.Length > 0)
            //    {
            //        //dataItem.Enabled = false;
            //        AddBlankRow();
            //    }
            //    else
            //    {
            //        SetResultText("An item must be selected before adding a new record to this element.");
            //        BindElementGrid();
            //    }
            //}
        }
         void RadGrid1_DeleteCommand(object source, GridCommandEventArgs e)
        {
            if (dsDTO != null)
            {
                if (dsDTO.DataItems[e.Item.ItemIndex].IsLoadedFlag == 1) //we loaded from database
                    dsDTO.DataItems[e.Item.ItemIndex].DeleteFlag = 1;
                else
                    dsDTO.DataItems.RemoveAt(e.Item.ItemIndex); //This is new, the user just added it so remove it from the list.
                if (e.Item.ItemIndex == 0)
                    dsDTO = null;

                BindElementGrid();
            }
        }
       private void BindElementGrid()
        {
            if (dsDTO != null)
            {
                RadGrid1.DataSource = dsDTO;
                //RadGrid1.DataSource = RetrieveActiveDataSource();
                for (int i = 0; i < RadGrid1.PageSize; i++)
                {
                    RadGrid1.EditIndexes.Add(i);
                }
                this.RadGrid1.DataBind();

                ViewState[this.UniqueID + "dsDTO"] = dsDTO;
            }
        }

    //Tried to use this instead to get rid of the GetInsert() error
        private void RadGrid_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName == "PerformInsert")
            {
                if (dsDTO == null)
                {
                    dsDTO = new DataSource<EDTO>();
                    AddBlankRow();
                }
                else
                {
                    GridDataItem dataItem = RadGrid1.MasterTableView.Items[RadGrid1.MasterTableView.Items.Count - 1];

                    
                    RadTextBox itemTextBox = dataItem.FindControl("txtItemName") as RadTextBox;
                    RadTextBox itemIDTextBox = dataItem.FindControl("txtItemID") as RadTextBox;
                    if (itemTextBox.Text.Length > 0 && itemIDTextBox.Text.Length > 0)
                    {
                        //dataItem.Enabled = false;
                        AddBlankRow();
                    }
                    else
                    {
                        SetResultText("An item must be selected before adding a new record to this element.");
                        BindElementCPEGrid();
                    }
                }
            }
        }
    #endregion
    </End Code Behind Grid Events>
    Server Error in '/' Application.
    --------------------------------------------------------------------------------

    Insert item is available only when grid is in insert mode.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: Telerik.Web.UI.GridException: Insert item is available only when grid is in insert mode.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

    Stack Trace:

    [GridException: Insert item is available only when grid is in insert mode.]
       Telerik.Web.UI.GridTableView.GetInsertItem() +211
       Telerik.Web.UI.GridCommandEventArgs.ExecuteCommand(Object source) +2910
       Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) +134
       System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
       Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +38
       System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
       Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +115
       System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
       System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +118
       System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +135
       System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

     

    Pete
    Top achievements
    Rank 1
     answered on 14 May 2010
    1 answer
    343 views
    Hi...I am trying to have a tooltip display whenever I hover over the items of a radCombo.
    I have done some of the work so far using an Item template, but I only know how to show either the DataTextField or dataValueField , yet the tooltip I want to show is a different field that I pull from the same table as per my query below. I want to show the suburb as my tooltip on hover.
    Below is the SQL Query and binding to radcombo:
    string AreasQuery = "select AreaID as AreaID,AreaName as AreaName,Suburbs as Suburbs from area order by AreaName ";
    dtAreas = dbo.sqldb_select(AreasQuery, 1);
    cmbAreas.DataTextField = "AreaName";
    cmbAreas.DataValueField = "AreaID";

    AreaID is my datavalueField and AreaName is my DataTextField.
    Below is my aspx code , and I have also attached a screen shot of how this currently looks at the moment. I just dont know how to bring the Suburb Field into my ItemTemplate...maybe an attribute, but I am not sure how to use that. Kindly assist.

    <td align="left" class="style11" valign="middle" bgcolor="#CC3300">
      <telerik:RadComboBox ID="cmbAreas"  Runat="server" Height="150px" MarkFirstMatch="True" 
      Skin="Hay" Width="236px" DataTextField="AreaName" DataValueField="AreaID">
      <ItemTemplate> 
            <asp:Label runat="server" ID="Label1" Text='<%# Eval("AreaName")%>' ></asp:Label> 
            <telerik:RadToolTip ID="RadToolTip1" runat="server" Width="100" Height="10" TargetControlID="Label1" Position="BottomRight" Text='<%# Eval("AreaName")%>' >
            </telerik:RadToolTip> 
      </ItemTemplate> 
      </telerik:RadComboBox>
    </td>


    Alex Odago
    Top achievements
    Rank 1
     answered on 14 May 2010
    4 answers
    137 views
    Hi,

    I use stand-alone dialogs. I switched to Q3 2009 and now I get the following ASP.NET error

    The ToolName property must be set!

    Nothing else was changed, I only switched DLL

    Please advice soonest.

    Regards,
    Marc
    Rumen
    Telerik team
     answered on 14 May 2010
    Narrow your results
    Selected tags
    Tags
    +? more
    Top users last month
    Hiba
    Top achievements
    Rank 1
    Iron
    Iron
    Rob
    Top achievements
    Rank 3
    Bronze
    Bronze
    Iron
    Max
    Top achievements
    Rank 1
    Veteran
    Iron
    Alina
    Top achievements
    Rank 1
    Rakhee
    Top achievements
    Rank 1
    Iron
    Iron
    Iron
    Want to show your ninja superpower to fellow developers?
    Top users last month
    Hiba
    Top achievements
    Rank 1
    Iron
    Iron
    Rob
    Top achievements
    Rank 3
    Bronze
    Bronze
    Iron
    Max
    Top achievements
    Rank 1
    Veteran
    Iron
    Alina
    Top achievements
    Rank 1
    Rakhee
    Top achievements
    Rank 1
    Iron
    Iron
    Iron
    Want to show your ninja superpower to fellow developers?
    Want to show your ninja superpower to fellow developers?