Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
148 views
I am using a RadSlidingPane, with the TabView set to ImageOnly. The splitter's orientation is horizontal. The sliding pane is the only tab in the sliding zone, and it occupies 100% of the available width. I am trying to get the image referenced by the sliding pane's iconurl attribute, to align horizontally in the center of the tab. I am working with a customized version of the Outlook skin. Can you please show me how to accomplish this with the Outlook skin.

Thanks,
Kory
Tsvetie
Telerik team
 answered on 15 May 2010
2 answers
126 views
Hi,
Greeting,

Recently we updated  RadControls "Prometheus" for ASP.NET in our project, in that we facing some issues.

1.Im not seeing any control in the name of 'RadScriptManager' in my ToolBox,  but the control used in Online Demo and Code Library of Telerik sites.

2. Also im not able see RadGrid in Toolbox.

Can anyone help to solve this issues, so only i can move forward.

Thanks and Regards
Jeyaraman


Sebastian
Telerik team
 answered on 15 May 2010
1 answer
92 views
I am trying to implement Export functionality in Multilevel Grid. I came to know that this is currently not supported in RadGrid.

As a workaround i am trying to get the Multilevel grid data into a Datatable and progrmatically create a RadGrid

and call the export methods on the RadGrid.  To do this i created a Button on webpage and when  the button is clicked i am doing the

following. I took this code from this post
http://www.telerik.com/community/forums/aspnet-ajax/grid/exporting-programatically-created-grid.aspx
This works fine if make a normal call. If i make a ajax call the export is not working. The call is made to server side but after the method is executed the Save dialog box is not showing up. It shows up if i make a non ajax call. I trying to attach the whole project , but it is not allowing me to add Zip files.

Thanks,
Sravan

RadGrid RadGrid1 = new RadGrid(); 
          XmlDataSource xmlSource = new XmlDataSource(); 
          RadGrid1.ID = "RadGrid1"; 
          this.PlaceHolder1.Controls.Add(RadGrid1); 
          xmlSource.DataFile = @"~/XMLDB.xml"; 
          RadGrid1.DataSource = xmlSource; 
          RadGrid1.Rebind(); 
          RadGrid1.ExportSettings.OpenInNewWindow = true; 
          RadGrid1.MasterTableView.ExportToExcel(); 
Daniel
Telerik team
 answered on 15 May 2010
1 answer
101 views
The automatic edit form provided by the RadGrid creates a control for each item in the datasource... If I need to change the control type of one of these items, for example, change a standard TextBox to a DropDownList that has its own datasource, do I have to abandon the automatic edit form totally and use Templates?

thanks,
Martin
Telerik team
 answered on 15 May 2010
2 answers
70 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
673 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
204 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
100 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
124 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
312 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?