Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
73 views

Requirements

RadControls  version     2009Q2 Trial

 

.NET version 3.5 SP1

 

Visual Studio version    2008 SP1

 

programming language    C#

 

browser support

all browsers supported by RadControls


PROJECT DESCRIPTION
Example SharePoint 2007 SP2 webpart using RadAjaxTreeView, context menu, RadAjaxPanel, and loading panel. 

Requires use of VSeWSS 1.3 March 2009 CTP to facilitate rapid development/deployment.  Just click Build/Deploy menu item after making any changes and it will deploy automatically to your SharePoint environment.

Best used in a SharePoint development virtual machine envrionment.  Tested with Windows Server 2003 R2 SP2, SQL Server 2008 SP1, Office SharePoint Server 2007 SP2, IE 8 using Virtual PC 2007 SP1 on Windows Vista SP2 (all 32-bit).

Pay close attention to the post-build event since it seems to be a reasonable work-around to an error known to exist in VSeWSS 1.3 March 2009 CTP.

Pay close attention to the notes at the top of the main .cs file which explains some strange things I had to do to get this all to work correctly.

Being new to Telerik controls, I found I had to may be overkill or unnecessary, but perhaps you can improve on things I coded incorrectly or inefficiently.

Since SharePoint webparts require a Document Library, I would suggest creating one in the site where you plan to test rather than rely on a default one, such as Shared Documents.  In my development environment, I created a Document Library named "Webparts", then created a Webpart Page called WebPartTesting based on the single web part on one page template.  Its on that page that I added my web part to test.  If the web part won't add, try attaching to the correct instance of w3wp.exe just before you click the Add button to see where in your code things might be going wrong.
Yavor
Telerik team
 answered on 08 Oct 2009
4 answers
147 views
Hi, I can't figure out why the checkboxes doesn't align correct. Can you help me?
See printscreen

<telerik:RadGrid ID="radGridDivisions" runat="server" AllowPaging="false" 
            AllowSorting="false" AutoGenerateColumns="False" GridLines="Horizontal"   
            oninsertcommand="radGridDivisions_InsertCommand"  
            onupdatecommand="radGridDivisions_UpdateCommand"  
            ondeletecommand="radGridDivisions_DeleteCommand" 
            onitemdatabound="radGridDivisions_ItemDataBound"  
            onneeddatasource="radGridDivisions_NeedDataSource" 
            OnColumnCreated="radGridDivisions_ColumnCreated" 
            OnItemCreated="radGridDivisions_ItemCreated" 
            Skin="Default" ShowHeader="true"
            <ClientSettings AllowExpandCollapse="true" /> 
            <mastertableview commanditemdisplay="Top" datakeynames="ID, ParentID"  
                editmode="EditForms" name="Master" nomasterrecordstext="Det finns inga divisioner" 
                HierarchyDefaultExpanded="true" HierarchyLoadMode="Client"
                <SelfHierarchySettings ParentKeyName="ParentID" KeyName="ID" /> 
                  
            <commanditemsettings addnewrecordtext="Lägg till" refreshtext="Uppdatera" /> 
            <Columns> 
                <telerik:GridBoundColumn UniqueName="ID" DataField="ID" HeaderText="Id" Visible="false" /> 
                <telerik:GridBoundColumn UniqueName="ParentID" DataField="ParentID" HeaderText="Parent Id" Visible="false" /> 
                <telerik:GridBoundColumn UniqueName="Name" Headertext="Division" DataField="Name" /> 
                <telerik:GridCheckBoxColumn UniqueName="IsEnabled" HeaderText="Aktiverad" DataField="IsEnabled" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" /> 
                <telerik:GridDateTimeColumn DataField="CreateDate" DataFormatString="{0:g}" 
                    HeaderStyle-HorizontalAlign="Right" HeaderText="Skapad"  
                    ItemStyle-HorizontalAlign="Right" ReadOnly="true" UniqueName="CreateDate" SortExpression="e.CreateDate"
                    <HeaderStyle HorizontalAlign="Right" /> 
                    <ItemStyle HorizontalAlign="Right" /> 
                </telerik:GridDateTimeColumn> 
 
                <telerik:GridEditCommandColumn CancelText="Avbryt" EditText="Ändra" InsertText="Spara" UpdateText="Spara" ButtonType="ImageButton" UniqueName="EditCommandColumn"
                    <HeaderStyle HorizontalAlign="Right" Width="20" /> 
                    <ItemStyle HorizontalAlign="Right" Width="20" /> 
                </telerik:GridEditCommandColumn> 
                <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete"  
                ConfirmText="Är du säker pÃ¥ att du vill radera denna division?"  
                ConfirmTitle="Delete" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="20px"  
                Text="Radera" UniqueName="DeleteColumn"
                    <ItemStyle HorizontalAlign="Right" Width="20px" /> 
                </telerik:GridButtonColumn> 
            </Columns> 
            </mastertableview> 
        </telerik:RadGrid> 

protected void Page_Load(object sender, EventArgs e) 
        { 
            radGridDivisions.MasterTableView.FilterExpression = "ParentID.Equals(Guid.Empty)"
 
        } 
 
 
        public void Page_PreRenderComplete(object sender, EventArgs e) 
        { 
            HideExpandColumnRecursive(radGridDivisions.MasterTableView); 
        } 
 
        public void HideExpandColumnRecursive(GridTableView tableView) 
        { 
            GridItem[] nestedViewItems = tableView.GetItems(GridItemType.NestedView); 
            foreach (GridNestedViewItem nestedViewItem in nestedViewItems) 
            { 
                foreach (GridTableView nestedView in nestedViewItem.NestedTableViews) 
                { 
                    nestedView.Style["border"] = "0"
 
                    Button MyExpandCollapseButton = (Button)nestedView.ParentItem.FindControl("MyExpandCollapseButton"); 
                    if (nestedView.Items.Count == 0) 
                    { 
                        if (MyExpandCollapseButton != null
                        { 
                            MyExpandCollapseButton.Style["visibility"] = "hidden"
                        } 
                        nestedViewItem.Visible = false
                    } 
                    else 
                    { 
                        if (MyExpandCollapseButton != null
                        { 
                            MyExpandCollapseButton.Style.Remove("visibility"); 
                        } 
                    } 
 
                    if (nestedView.HasDetailTables) 
                    { 
                        HideExpandColumnRecursive(nestedView); 
                    } 
                } 
            } 
        } 
 
 
        protected void radGridDivisions_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) 
        { 
            //int recordCount; 
            string search = textBoxSearch.Text.Trim(); 
 
            //foreach (Division d in DivisionService.GetDivisions()) 
              //  Response.Write(d.Name); 
 
            radGridDivisions.DataSource = DivisionService.GetDivisions();//.GetDivisions(null, search, "", 0, 0, out recordCount); 
            //radGridDivisions.VirtualItemCount = recordCount; 
        } 
 
 
        protected void radGridDivisions_ColumnCreated(object sender, GridColumnCreatedEventArgs e) 
        { 
            if (e.Column is GridExpandColumn) 
            { 
                e.Column.Visible = false
            } 
            else if (e.Column is GridBoundColumn) 
            { 
                //e.Column.HeaderStyle.Width = Unit.Pixel(100); 
            } 
        } 
 
        protected void radGridDivisions_ItemCreated(object sender, GridItemEventArgs e) 
        { 
            //CreateExpandCollapseButton(e.Item, "Name"); 
 
            //Response.Write(e.Item.GetType().ToString() + "<br />"); 
            if ((e.Item is GridHeaderItem || e.Item is GridCommandItem) && e.Item.OwnerTableView != radGridDivisions.MasterTableView) 
            { 
                e.Item.Style["display"] = "none"
            } 
            /*
            if (e.Item is GridHeaderItem && e.Item.OwnerTableView != radGridDivisions.MasterTableView)
            {
                e.Item.Style["display"] = "none";
            }
            */ 
            if (e.Item is GridNestedViewItem) 
            { 
                e.Item.Cells[0].Visible = false
            } 
 
            
 
 
        } 
 
 
        public void CreateExpandCollapseButton(GridItem item, string columnUniqueName) 
        { 
            if (item is GridDataItem) 
            { 
                if (item.FindControl("MyExpandCollapseButton") == null
                { 
                    Division division = (Division)item.DataItem; 
 
                    Button button = new Button(); 
                    button.Click += new EventHandler(button_Click); 
                    button.CommandName = "ExpandCollapse"
                    button.CssClass = (item.Expanded) ? "rgCollapse" : "rgExpand"
                    button.ID = "MyExpandCollapseButton"
 
                    if (item.OwnerTableView.HierarchyLoadMode == GridChildLoadMode.Client) 
                    { 
                        string script = String.Format(@"$find(""{0}"")._toggleExpand(this, event); return false;", item.Parent.Parent.ClientID); 
 
                        button.OnClientClick = script; 
                    } 
 
                    int level = item.ItemIndexHierarchical.Split(':').Length; 
                    if (level > 1) 
                    { 
                        button.Style["margin-left"] = level + 10 + "px"
                    } 
 
                    TableCell cell = ((GridDataItem)item)[columnUniqueName]; 
                    cell.Controls.Add(button); 
                    cell.Controls.Add(new LiteralControl("&nbsp;")); 
                    cell.Controls.Add(new LiteralControl(division.Name)); 
                    //cell.Controls.Add(new LiteralControl(((GridDataItem)item).GetDataKeyValue("ID").ToString())); 
                } 
            } 
        } 
 
        void button_Click(object sender, EventArgs e) 
        { 
            ((Button)sender).CssClass = (((Button)sender).CssClass == "rgExpand") ? "rgCollapse" : "rgExpand"
        } 
 
 
        protected void radGridDivisions_ItemDataBound(object sender, GridItemEventArgs e) 
        { 
 
            CreateExpandCollapseButton(e.Item, "Name"); 
 
            GridDataItem gridItem; 
            GridEditFormItem gridEditItem; 
            Division division; 
 
 
            switch (e.Item.OwnerTableView.Name) 
            { 
                case "Master"
 
                    if (e.Item is GridDataItem) 
                    { 
                        gridItem = (GridDataItem)e.Item; 
                        division = (Division)gridItem.DataItem; 
 
                    } 
 
                    break
            } 
 
             
        } 



Mattias
Top achievements
Rank 1
 answered on 08 Oct 2009
1 answer
187 views
Hello,

I need to retrieve the currently selected row index from the data source point of view.

I have grouped/sorted grid, and I need to know the selected row data source index in order to compute some action on this row.
This should be done 100% client-side, in order then to send a request to the valid data row index.

I just met the "GridClientDeleteColumn" that seems to use this kind of information to delete the proper row on the data source. I didn't got time to test it in grouped or sorted context in order to see if this control works properly but I hope so :)

Unfortunately my use case is different and I can't use this control, but need to handle it manually using the data source row index.

Any clue on how to get this original data index from client-side code ?!

Thanks in advance for your answer.

Regards.

Seb.
Yavor
Telerik team
 answered on 08 Oct 2009
1 answer
91 views
I am using the scrolling option with my bar chart and everything is working fine except that I am using the DeepBlue skin and the ajax loading circle is visible through the background. Is there anything I can do so that once the chart is loaded the circle will not be visible?
Vladimir Milev
Telerik team
 answered on 08 Oct 2009
4 answers
183 views

I previously had a RadGrd nested like so:

RadSplitter => RadSplitter => RadGrid  (i.e. RadGrid nested 2 Splitters deep)

Then on the AjaxManager's ClientEvents-OnResponseEnd, my Javascript looked like so:

function setDimensions(sender, args) {  
    var splitter = $find(PageControls.RadSplitter1.id);  
 
    if (splitter != null)  
        splitter.resize(contentPaneWidth - 60, contentPaneHeight - 80);  
   

This worked perfect for resizing the 2nd level Splitter pane to the contentPane's width and height and thus the Grid to match.

Now, I've removed the 2nd Splitter and moved the Grid up one level.  I can get the pane's width and height still.  But how do I resize the grid?

Thanks.
Yavor
Telerik team
 answered on 08 Oct 2009
1 answer
62 views
Hello,

We are using the ASP.NET AJAX Q2 2009 SP1 version of the Telerik controls. We have a horizontal RadMenu on our pages which shows the Level2 group dynamically, after detecting the screen boundary. We are currently migrating the skins, by rewriting the CSS classes.

The problem is that we had, for each item in the Level1 group, arrow images which were loaded dynamically, as the class changed dynamically from expandRight to expandLeft when the Level2 group was shown to the left side of the Level1 group.

Now, the rmExpandLeft class is never assigned to the Level1 elements, even if the Level2 group is shown on the left side. The class still remains rmExpandRight.

Is the expected behaviour and we should look up for a different approach?

Thank you.
Kamen Bundev
Telerik team
 answered on 08 Oct 2009
3 answers
78 views
HI , 
    I am using Rad Telrik 2008 Controls . I am using the Rad grid with Filter option i am binding teh Grdi data with my own Business layer functions. It is working fine for all filter options. but when i am filtering the column data with  "  '  "(Single Course), it is throing some type of error. it is working fine in Mozella But not in IE. Please sugeste me  i also check all related forums thread but not able to find the actual issue,

Thanks With Regard
Victor
Shinu
Top achievements
Rank 2
 answered on 08 Oct 2009
5 answers
131 views

hi ,,
I am using rad grid at webpart ,  using NestedItem at Grid but after Add Events Fixup Ajax working fine at all grid but i faced 2 issues please help me to find a soultion on them ...

1- the collapse buttom didn't work ( the grid post back and then the nested item didn't collapsed).
2- I can't expand more than 1 nested item at , if i trying to open nested item and it was one else opened the previous one collapsed and the new one expanded ,

here is rad grid code

      <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" Skin="WebBlue" 
                AllowFilteringByColumn="true" dir="rtl" GridLines="None" AllowPaging="True" AllowSorting="True" 
                PageSize="15">  
                <PagerStyle Mode="NumericPages" HorizontalAlign="Center" Font-Bold="true" VerticalAlign="Middle">  
                </PagerStyle> 
                <GroupingSettings CaseSensitive="false" /> 
                <ItemStyle HorizontalAlign="Right" /> 
                <FilterItemStyle HorizontalAlign="Right" /> 
                <CommandItemStyle HorizontalAlign="Left" /> 
                <AlternatingItemStyle HorizontalAlign="Right" /> 
                <HeaderStyle HorizontalAlign="Right" /> 
                <MasterTableView DataKeyNames="STUDENTNO" GridLines="None" DataSourceID="ObjectDataSource1" 
                    CommandItemDisplay="Top">  
                    <NoRecordsTemplate> 
                        
                    </NoRecordsTemplate> 
                    <ExpandCollapseColumn Visible="True">  
                    </ExpandCollapseColumn> 
                    <CommandItemTemplate> 
                        <asp:LinkButton ID="clearFilter" runat="server" Text="مسح ÙƒÙ„ Ø§Ù„بحث" ToolTip="الغاء Ø§Ù„بحث" 
                            OnClick="ClearFilter_Click" Font-Bold="true" Font-Size="14px"></asp:LinkButton> 
                    </CommandItemTemplate> 
                    <Columns> 
                    ... SOME COLUMNS ...  
                    </Columns> 
                    <NestedViewTemplate> 
                        <table> 
                        ... NESTED TEMPATE GOES HERE ...            
                        </table> 
                    </NestedViewTemplate> 
                </MasterTableView> 
                <ClientSettings> 
                    <Selecting AllowRowSelect="true" /> 
                </ClientSettings> 
            </telerik:RadGrid> 

there no important code behind to grid to be diaplay just some binding code ..

i used Event Fixup like the demp here is it
        #region Events & Fixers  
 
        protected override void OnInit(EventArgs e)  
        {  
            base.OnInit(e);  
            ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);  
            if (scriptManager == null)  
            {  
                scriptManager = new ScriptManager();  
                scriptManager.ID = "ScriptManager1";  
                this.Page.Form.Controls.AddAt(0, scriptManager);  
            }  
 
            RadAjaxManager ram = RadAjaxManager.GetCurrent(this.Page);  
            if (ram == null)  
            {  
                ram = new RadAjaxManager();  
                ram.ID = "RadAjaxManager1";  
                Page.Form.Controls.Add(ram);  
                Page.Items.Add(ram.GetType(), ram);  
            }  
 
            EnsureChildControls();  
        }  
 
        protected override void OnPreRender(EventArgs e)  
        {  
            base.OnPreRender(e);  
            RadAjaxManager manager = RadAjaxManager.GetCurrent(Page);  
            if (manager != null)  
            {  
                manager.DefaultLoadingPanelID = this.EmployeesListUserControl.AjaxLoadingPanel.ID;  
 
                manager.AjaxSettings.AddAjaxSetting(this.EmployeesListUserControl.GridRootDep, this.EmployeesListUserControl.GridRootDep);  
            }  
        }  
 
        private void EnsureUpdatePanelFixups()  
        {  
            if (this.Page.Form != null)  
            {  
                string formOnSubmitAtt = this.Page.Form.Attributes["onsubmit"];  
                if (formOnSubmitAtt == "return _spFormOnSubmitWrapper();")  
                {  
                    this.Page.Form.Attributes["onsubmit"] = "_spFormOnSubmitWrapper();";  
                }  
            }  
 
            ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "UpdatePanelFixup""_spOriginalFormAction = document.forms[0].action; _spSuppressFormOnSubmitWrapper=true;"true);  
        }  
 
        protected override void Render(HtmlTextWriter writer)  
        {  
            EnsureUpdatePanelFixups();  
            base.Render(writer);  
        }
        #endregion 


please help me ..
Yavor
Telerik team
 answered on 08 Oct 2009
1 answer
85 views
I'm using AJAX 2008 Q3. How can I add RadMenu to  RadWindow? I add RadMenu as below:

<telerik:RadWindowManager ID="RadWindowManager" runat="server" >
        <Windows>
            <telerik:RadWindow ID="RadWindow" runat="server" Title="test">
               <telerik:RadMenu ID="RadMenu" runat="server" Width="100%" dir="rtl">
                    <CollapseAnimation Duration="200" Type="OutQuint" />
                    <Items>
                        <telerik:RadMenuItem runat="server" Text="File" Font-Names="Tahoma">                           
                        </telerik:RadMenuItem>
                        <telerik:RadMenuItem runat="server" Text="Setting">                          
                        </telerik:RadMenuItem>
                    </Items>
                </telerik:RadMenu>                 
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>

But RadMenu is not appaired. Why?
I want to add for all RadWindows, and whne I drag them, RadMenu be dragged with them.

Regards
Hadi Bahrbegi
Georgi Tunev
Telerik team
 answered on 08 Oct 2009
2 answers
115 views
I'm using AJAX 2008 Q3. How can I add RadMenu to  RadWindow? I add RadMenu as below:

<telerik:RadWindowManager ID="RadWindowManager" runat="server" >
        <Windows>
            <telerik:RadWindow ID="RadWindow" runat="server" Title="test">
               <telerik:RadMenu ID="RadMenu" runat="server" Width="100%" dir="rtl">
                    <CollapseAnimation Duration="200" Type="OutQuint" />
                    <Items>
                        <telerik:RadMenuItem runat="server" Text="File" Font-Names="Tahoma">                           
                        </telerik:RadMenuItem>
                        <telerik:RadMenuItem runat="server" Text="Setting">                          
                        </telerik:RadMenuItem>
                    </Items>
                </telerik:RadMenu>                 
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>

But RadMenu is not appaired. Why?
I want to add for all RadWindows, and whne I drag them, RadMenu be dragged with them.

Regards
Hadi Bahrbegi
Georgi Tunev
Telerik team
 answered on 08 Oct 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?