Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
67 views
Is it possible to save the entire RibbonBar in a Session variable and use it on page load?
I tried the following but on PostBack it fails.

if (!Page.IsPostBack)
{
 TCMenu _rb = new TCMenu();
 _rb.InitRibbonBar(ref trans_RibbonBarMenu); //dynamically adding tabs, groups and buttons - see code below
 Session["Test"] = trans_RibbonBarMenu;
}
else
{
 trans_RibbonBarMenu = (Session["Test"] as RadRibbonBar);
}


public void InitRibbonBar(ref RadRibbonBar ribbonBar, string formName, int userLevel)
 
{
 
    CriteriaOperator filter;           
 
    filter = CriteriaOperator.Parse(String.Format("FormName = '{0}'", formName));
 
  
 
    XPCollection _xpoObjects = new XPCollection(DbUtils.GetDefaultSession, typeof(XPOMenuSettings), filter, null);
 
  
 
    SortProperty TabSortOrder = new SortProperty("TabSortOrder", DevExpress.Xpo.DB.SortingDirection.Ascending);
 
    _xpoObjects.Sorting.Add(TabSortOrder);
 
  
 
    SortProperty GroupSortOrder = new SortProperty("GroupSortOrder", DevExpress.Xpo.DB.SortingDirection.Ascending);
 
    _xpoObjects.Sorting.Add(GroupSortOrder);
 
  
 
    SortProperty sortOrder = new SortProperty("SortOrder", DevExpress.Xpo.DB.SortingDirection.Ascending);
 
    _xpoObjects.Sorting.Add(sortOrder);
 
  
 
    RibbonBarTab rbt;
 
    RibbonBarGroup rbg;
 
  
 
    foreach (XPOMenuSettings _xpoButton in _xpoObjects)
 
    {
 
        bool rbt_found = true;
 
        bool rbg_found = true;
 
          
 
        rbt = ribbonBar.FindTabByValue(_xpoButton.TabValue);
 
        if (rbt == null)
 
        {
 
            rbt = new RibbonBarTab();
 
            rbt.ID = _xpoButton.TabId;
 
            rbt.Text = _xpoButton.TabText;
 
            rbt.Value = _xpoButton.TabValue;
 
            rbt_found = false;
 
        }
 
  
 
        rbg = ribbonBar.FindGroupByValue(_xpoButton.GroupValue);
 
        if (rbg == null)
 
        {
 
            rbg = new RibbonBarGroup();
 
            rbg.ID = _xpoButton.GroupId;
 
            rbg.Text = _xpoButton.GroupText;
 
            rbg.Value = _xpoButton.GroupValue;
 
            rbg_found = false;
 
        }
 
  
 
        RibbonBarButton rbb = new RibbonBarButton();
 
        rbb.Size = (RibbonBarItemSize)_xpoButton.Size;
 
        rbb.Text = _xpoButton.Text;
 
        rbb.Value = _xpoButton.Value;
 
        rbb.ID = _xpoButton.Id;
 
        rbb.ImageUrl = _xpoButton.ImageUrl;
 
        rbb.ImageUrlLarge = _xpoButton.ImageUrlLarge;
 
        rbb.Visible = _xpoButton.Visible && (_xpoButton.UserLevel >= userLevel);
 
  
 
        rbb.Width = 80;
 
  
 
        rbg.Items.Add(rbb);
 
        if (!rbg_found)
 
            rbt.Groups.Add(rbg);
 
        if (!rbt_found)
 
            ribbonBar.Tabs.Add(rbt);
 
    }
 
}

Clientside works fine, but as soon as I click a button that calls serverside, I get the following error message:

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
   System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) +64
   System.ThrowHelper.ThrowArgumentOutOfRangeException() +15
   System.Collections.Generic.List`1.get_Item(Int32 index) +7500084
   Telerik.Web.UI.RadRibbonBar.RaisePostBackEvent(String eventArgument) +272
   Telerik.Web.UI.RadRibbonBar.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +39
   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

Bozhidar
Telerik team
 answered on 10 Sep 2012
4 answers
110 views
this is my aspx code

 <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="100%" Width="100%" LoadingPanelID="LoadCombo" >
                            <div class="leftContainerIn">
                                <telerik:RadListBox ID="rlbAvailable" runat="server" Width="100%" AllowTransfer="true"
                                   TransferToID="rlbChosen" SelectionMode="Multiple"
                                  AllowTransferOnDoubleClick="true"
                                    


                                    Height="100%" EnableDragAndDrop="true" DataValueField="FieldId" DataTextField="tempHeader"
                                    Sort="Ascending" OnClientTransferring="rlbAvailable_OnClientTransferring" AutoPostBackOnTransfer="true"
                                    OnTransferred="rlbAvailable_OnTransferred" ButtonSettings-ShowTransferAll="true">
                                </telerik:RadListBox>
                            </div>
                            <div class="rightContainerIn">
                                <telerik:RadListBox ID="rlbChosen" runat="server" Sort="Ascending" Width="100%" Height="100%"
                                    AutoPostBack="true" OnSelectedIndexChanged="rlbChosen_SelectedIndexChange" SelectionMode="Multiple"
                                    EnableDragAndDrop="true"  AllowTransferOnDoubleClick="false"
                                    AllowReorder="true" DataTextField="tempHeader" DataValueField="FieldId" TransferToID="rlbAvailable">
                                </telerik:RadListBox>
                            </div>
                        </telerik:RadAjaxPanel>

this is my cs code

 protected void rlbAvailable_OnTransferred(object sender, RadListBoxTransferredEventArgs e)
        {
            try
            {


                List<smDocumentTypeField> avalible = FieldsOrganization;
                List<smDocumentTypeField> documentTypeFields = DocumentTypeField;


                if (e.DestinationListBox != sender) // from left to right
                {
                    foreach (RadListBoxItem ite in e.Items)
                    {
                        int id = Convert.ToInt32(ite.Value);
                        documentTypeFields.Insert(0, GetField(FieldsOrganization, id));
                        avalible.Remove(GetField(FieldsOrganization, id));


                    }


                   
                }
                else if (e.DestinationListBox == sender)// from right to left
                {
                    foreach (RadListBoxItem ite in e.Items)
                    {
                        int id = Convert.ToInt32(ite.Value);


                        avalible.Insert(0, GetField(DocumentTypeField, id));
                        documentTypeFields.Remove(GetField(DocumentTypeField, id));
                    }
                }


               FieldsOrganization = avalible;
                DocumentTypeField = documentTypeFields;
                rlbChosen.DataBind();
                rlbAvailable.DataBind();
            }
            catch (Exception ex)
            {
                Notification.LoadCatchNotification(ex, typeof (DocumentTypeForm).FullName);
            }
        }


this event does not execute when i did double click on radlistboxitem, Why?

I need help!!


regards

Bozhidar
Telerik team
 answered on 10 Sep 2012
1 answer
82 views
Hi All,

I've not had much experience with the rad controls, but what I see so far is pretty good.

I did some searching online, but either was using the wrong search terms or what I want to do is not possible.

I have a listbox on a page.  What I want to do is bind it to a linq datasource with checkboxes filled in from the datasource.

I'm hoping that I can pass in a datasource with 3 columns:

ReceivedEmail: Boolean
ClientID: Int
ClientName: String

True-1-Fred Smith
True-2-Betty White
False-3-Amy Whinehouse

This would produce a list with the three names and the first 2 items checked without any extra work in code...

I was talking to one of the other guys I work with and he said that he usually binds to a datasource and then loops through all the list items after binding has finished and then sets the checked flag..
This seemed a little inefficient, and figured that if the control handled it, why not do it in one go..

Does this make sense..??  Can it be done already..???

Many thanks
Ivana
Telerik team
 answered on 10 Sep 2012
0 answers
80 views
hi ,
kindly help me when i used drag drop in rad grid the destination grid sometimes =null 
i used this demo
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/draganddrop/defaultcs.aspx 

and args.get_destinationHtmlElement().id sometimes = the row that i selected it to drop it not the destination element 
even if  i dropped it at  the destination grid .
kindly help me ,
if i got the row index that i dropped on it i will solve my problem ,
how to get it ,
i tried all the methods
http://www.telerik.com/help/aspnet-ajax/grid-onrowdropping.html 
 
Ashraf
Top achievements
Rank 2
 asked on 09 Sep 2012
3 answers
211 views
I hope this is the right place to post this.  We just purchased the DevCraft Complete (Formerly Premium Collection) and I want to install the RadControls for ASP.NET AJAX and create a web form with a Grid.  The Grid is what I need primarily right now.  I've got a set of webforms with regular ASP.NET 4.0 GridViews, but our staff wants the Header and a couple of columns frozen in place when they scroll the large grid.

Anyway, my question is, "How do I get started?"  I've downloaded the Telerik.Web.UI_2012_2_724_Dev.msi file and some other files.  Do I just run the .msi file to install it in Visual Studio 2010 and then start dragging controls onto my page? 

I've got a new website with just a new Default.aspx page in it right now.  I'll do some testing and playing around here, then if possible I'd like to upgrade my existing webforms that have the .Net GridViews.  I imagine I'll have to replace the old GridViews with a new RadControl Grid.

Are there any "gotchas" that a newbie would need to know about?  Should VS be closed when I install it? 

Thanks!


I see no one wants to comment.  :(   I'm not asking for anything but advice, pointers, suggestions or just general comments.  I'd even be happy with a, "Good luck with that."
moegal
Top achievements
Rank 1
 answered on 09 Sep 2012
1 answer
6.3K+ views
hi,


i am using check box to select one row or multiple rows in the grid. I would like to get the key value(Id) for multiple selected rows in an On Click event of a button. The button is not part of the grid.

plz help me

i used this belwo code.in aspx file
 <telerik:RadGrid Width="50%" ID="RadGrid1" runat="server"
        AllowPaging="True" AllowSorting="True"  GridLines="None"     
        ShowFooter="True" AllowAutomaticInserts="True"
        AllowAutomaticUpdates="True" ShowStatusBar="True"  
        AutoGenerateColumns="False"
        ondeletecommand="RadGrid1_DeleteCommand"
        oninsertcommand="RadGrid1_InsertCommand"
        onupdatecommand="RadGrid1_UpdateCommand"
       
         AllowMultiRowSelection="True"
        Skin="Web20" ondetailtabledatabind="RadGrid1_DetailTableDataBind"
        onneeddatasource="RadGrid1_NeedDataSource" onselectedindexchanged="RadGrid1_SelectedIndexChanged"   
        >
  ....
       ......
         
 <telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn">
                            <HeaderStyle Width="30px"></HeaderStyle>
                            <HeaderTemplate>
                             <asp:CheckBox id="headerChkbox" OnCheckedChanged="ToggleSelectedState" AutoPostBack="True" runat="server"></asp:CheckBox>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:CheckBox id="Chkitem" OnCheckedChanged="ToggleRowSelection" AutoPostBack="True" runat="server"></asp:CheckBox>
                            </ItemTemplate>
                     </telerik:GridTemplateColumn>
                        ....
                       ......

<tellerik:radGrid>

 </telerik:RadGrid>
   
    <asp:Button ID="Button1"  runat="server" Text="Get" onclick="Button1_Click" />



        
in the button click event, i have to get the selected rows values.

i can get the count using radGrid1.SelectedItems.

plz guide me how to get the id value for selected rows

Thanks,
Dhana
Amit
Top achievements
Rank 1
 answered on 08 Sep 2012
2 answers
87 views
I open both edit and insert form. When I click update button(in insert form). I need to test validate any value  of controls by javascript.
How I find control in insert form only without in edit form?
if i use below function . It get 2 controls that have the same ID in Edit and Insert Form.  

 

function GetGridServerElement(radGridID, serverID, ControlType) { 

    var grid = document.getElementById(radGridID); 

    var elements = grid.getElementsByTagName("*"); 

    for (var i = 0; i < elements.length; i++) { 

        var element = elements[i]; 

        if (element.id.indexof(serverID)>0) { 

            if (ControlType == "rad") { 

                return $find(element.id);

            }

            else

                return element; 

                    }

            }

    }

}

Vvt
Top achievements
Rank 1
 answered on 08 Sep 2012
5 answers
331 views

Include file in RadEditor
<!--#include file = ../Shared/gridHeaderTemplates_Layout.htm-->

Thanks Advance,
Mohamed.
mohamed
Top achievements
Rank 1
 answered on 08 Sep 2012
0 answers
58 views
Hi

Select node RadTreeView Add Folder clcik to create folder then select folder name to rename.
see my attach my screen shot.
Button click coding:

protected void AddFolder_OnClick(object sender, EventArgs e)
        {
            RadTreeNode node = (RadTreeNode)TicketFoldersTreeview.SelectedNode;
            if (node != null)
            {
                node.Nodes.Add(new RadTreeNode("New Folder"));
            }
            int parentId = (int)Convert.ToInt32(GetNode.Value);
            Ticket_Folder ticFolder = new Ticket_Folder();
            Ticket_Folder parentFolder = DbClient.GetList<Ticket_Folder>("Ticket_Folders_ID = " + parentId)[0];
 
            RadTreeNode newNode = new RadTreeNode();
            string nodeName = Resources.Common.New_Folder;
            ticFolder.Ticket_Folders_Name = nodeName;
            ticFolder.Ticket_Folders_PARENT_ID = parentId;
            ticFolder.Ticket_Folders_Global = parentFolder.Ticket_Folders_Global;
            ticFolder.Ticket_Folders_People_ID = ((TBS.HelpDesk.Model.TBSSecurity)(Session["SecurityClass"])).People_ID;
 
            DbClient.Insert<Ticket_Folder>(ticFolder);
 
            newNode.Text = nodeName;
            newNode.Value = ticFolder.Ticket_Folders_ID.ToString();
            newNode.Attributes.Add("PeopleID", ((TBS.HelpDesk.Model.TBSSecurity)(Session["SecurityClass"])).People_ID.ToString());
            newNode.AllowEdit = true;
            hdNodeCount.Value = "1";
            string strScript = "Sys.Application.add_load(function(){ EditableNode(\"" + newNode.Value + "\")})";
            ScriptManager.RegisterStartupScript(this.Page, typeof(string), "ScriptKey", strScript, true);
        }

Java Script:
function EditableNode(value) {
        debugger
            if (document.getElementById('hdNodeCount').value == '1') {
                var tree = $find("<%= TicketFoldersTreeview.ClientID %>");
                var node = tree.findNodeByValue(value);
                if (node != null) {
                    node.startEdit();
                }
            }
        }


Thanks Advance,
New Gene
New
Top achievements
Rank 1
 asked on 08 Sep 2012
2 answers
439 views
I've done much reading about double-clicking on a RadTreeView node.  Apparently the default behaviour is for this to cause it to expand, showing its child nodes.

On my implementation of the RadTreeView it does not do this.  Might this be because I have some server-side code that processes the single-click, which serves to Select the node?  If so, please know that I absolutely need to maintain that server-side selection code.

Thus, my ultimate question is this: Is is possible to have a single-click of a RadNode run server-side code BUT have a double-click just expand the node?

Curious,

Robert W.
Robert
Top achievements
Rank 1
 answered on 07 Sep 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?