Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
152 views
Based on the information on this page,
http://www.telerik.com/products/aspnet-ajax/resources/right-to-left-support.aspx

It says that:

"Not/Applicable" means that the control does not have any "hard-coded" strings to localize and everything comes from datasource or properties.

What does this really mean? What about RTL? Should I assume that the Chart component does not offer an RTL support but there is nothing (i.e. no hard coding done) that would prevent it from rendering in an RTL fashion. If so, is there anything that can be  done to make it support RTL (i.e. css tweaks).

Judging from the numerous requests asking for  RTL support in radControls, I am puzzled by the slowness in building a seamless framework to support RTL in *all* controls. In this global economy, not being able to display information in a localized manner would surely have an impact on the bottom line.




Velin
Telerik team
 answered on 30 Dec 2009
2 answers
138 views
Hi there,
I'm facing a problem using XmlHttpPanel  here's my scenario:
I have two custom controls(webpart) in my page each one inside a different Panel , the first one has a RadGrid and second One a RadPanelbar that shows details for selected GridRow.
currently I'm using a AjaxSetting  to update the Panelbar by calling an AjaxRequest on row select function of RadGrid on client side and everything works as expected.
but unfortunately performance is really low this way! so I tried to use XmlHttpPanel , I'm doing this  by set_value() function in javascript function for rowSelected event of the Grid, the problem is that this way the panelBar won't load properly and clicking Bars won't work either very similar to the situation where RadScriptManager is not registerd  correctly. It seems like the problem is this issue but the provided solutions did not solve my problem.
I should also mention that since the ServiceRequest event fires after the CreateChildControl method of My RadPanelbar webpart I had to use another method to create the panel bar with ServiceRequest event value (I also tried creating and adding the panelBar in this method which made the situation even worth and panelBar lost it's skin too!), Is this a correct approach?
thanks In advance.
baha2r
Top achievements
Rank 1
 answered on 30 Dec 2009
2 answers
170 views
Hi,

I would like to limit the number of rows expandable in my grid to a single row.  My solution has a RadGrid with a NestedViewTemplate.  When a user selects the row and it is expanded I'd like to collapse any other rows that are already expanded. 

I'd like to do that on the client side before the new row is expanded and databound.  I've tried the client-event OnGroupExpanded but thats not the event being fired.

Thanks
Jase
Daniel
Telerik team
 answered on 30 Dec 2009
3 answers
173 views
I'm running my website on ie8 in compatablity View on.  I"m using ASP.net 2008 V3.5 Sp1.  When ever I click to expand a node I get an error "Microsoft JScript runtime error: Array length must be assigned a finite positive number" in prototype.js.  I can view the Javascript

shift: function() {  
    var result = this[0];  
    for (var i = 0; i < this.length - 1; i++)  
      this[i] = this[i + 1];  
    this.length--;  
    return result;  
  }, 

What's happening is that this.length is equals 0 so when the code subtracts 1 it become -1 which isn't a valid value. 

Here's my code
<%@ Register TagPrefix="radG" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="ContentTitle" runat="server">  
Documents  
</asp:Content> 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentBody" runat="server">  
<script type="text/javascript">  
 
 
            function RowContextMenu(sender, e)  
            {  
              
                var menu = $find("<%= cRadMenu.ClientID %>");  
                if(menu != null)  
                {  
                    var index = e.get_itemIndexHierarchical();     
                      
                    //-------------------------------------  
                   // var item = menu.findItemByText("Add");  
                    //var parentItem = item.get_parent();  
                    //Removes the item from the items collection of the clicked item's parent   
                    //item.hide();  
                           
                    //if(item != null)  
                     //   menu.delete(item);  
 
 
                    document.getElementById("radGridClickedRowIndex").value = index;  
                     var eevt = e.get_domEvent();  
                       
                         
                    menu.show(evt);  
                    evt.cancelBubble = true;  
                    if (evt.stopPropagation)  
                    {  
                        evt.stopPropagation();  
                    }  
                }  
                /*  
                var contextMenu = $find("<%= cRadMenu.ClientID %>");  
                document.getElementById("radGridClickedRowIndex").value = index;  
              
                if ((!e.relatedTarget) || (!$telerik.isDescendantOrSelf(contextMenu.get_element(), e.relatedTarget)))  
                {  
                   contextMenu.show(e);  
                }  
                        
                $telerik.cancelRawEvent(e);*/  
 
            }  
            </script> 
              
 
   <h1>Documents</h1> 
<div class="row">     
    <div class="left_text_column" style="width:350px;border-right:solid 1px #eee;padding-bottom:10px">  
         
        <radG:RadTreeView   
            ID="RadTreeView1"   
            runat="server"    
            SingleExpandPath ="true"    
            ExpandAnimation-Type="OutQuint"   
            ExpandAnimation-Duration="600"   
            OnNodeClick="RadTreeView1_NodeClick"    
            OnNodeExpand = "RadTreeView1_NodeExpand"   
        > 
        </radG:RadTreeView> 
          
    </div> 
      
    <radG:RadContextMenu   
        id="cRadMenu"    
        Runat="server"   
        Skin="WebBlue"    
        OnItemClick="RadMenu1_ItemClick" 
    > 
        <Items> 
                <radG:RadMenuItem Text="Delete"/>  
                <radG:RadMenuItem Text="Edit"/>  
 
        </Items> 
    </radG:RadContextMenu> 
    <div class="right_text_column" style="width:590px">  
        <radG:RadGrid   
            ID="RadGrid1"   
            OnItemCommand="RadGrid1_ItemCommand"   
            runat="server"   
            HorizontalAlign="NotSet"    
            Skin="WebBlue"    
            AutoGenerateColumns="False"   
            OnItemDataBound="RadGrid1_ItemDataBound"   
            OnNeedDataSource="RadGrid1_OnNeedDataSource"     
            OnInsertCommand="RadGrid1_InsertCommand" 
         > 
           <MasterTableView DataKeyNames"Id" EditMode ="EditForms" > 
               <Columns> 
                   <radG:GridTemplateColumn HeaderText="Name"  SortExpression="DocumentName">  
                        <ItemTemplate> 
                            <asp:LinkButton ID="lbLink" CommandName="Download" CommandArgument='<%# Bind("FileLocation")%>' runat="server" Text='<%# Bind("Name")%>'  Enabled='<%# !(bool)(DataBinder.Eval(Container, "DataItem.Disabled"))%>'></asp:LinkButton> 
                        </ItemTemplate> 
                   </radG:GridTemplateColumn> 
                   <radG:GridBoundColumn AllowSorting="true" DataField="Description" HeaderText="Description" SortExpression="Description"></radG:GridBoundColumn> 
                   <radG:GridBoundColumn AllowSorting="true" DataField="TypeName" HeaderText="Type" SortExpression="TypeName" ></radG:GridBoundColumn> 
                   <radG:GridBoundColumn AllowSorting="true" DataField="FileSizeString" HeaderText="Size" SortExpression="FileSize" ></radG:GridBoundColumn> 
               </Columns> 
               <RowIndicatorColumn UniqueName="RowIndicator" Visible="False">  
                   <HeaderStyle Width="20px" /> 
               </RowIndicatorColumn> 
               <EditFormSettings EditFormType="Template">  
                    <FormTemplate> 
                        <div style="clear:both;margin:3px;">  
                            <label for="docFileUpload">File:</label> 
                            <asp:FileUpload ID="docFileUpload" runat="server" width="70%"/>  
                              
                            <asp:TextBox   
                                ID="txtDescription"   
                                runat="server"   
                                Width="90%"   
                                Text='<%# Bind( "Description") %>' 
                            > 
                            </asp:TextBox> 
                            <asp:RegularExpressionValidator  
                            id="regExDocValidator1" runat="server" 
                            ErrorMessage="Upload .zip, .jpg, .gif, .pdf & .doc  only." 
                            ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.jpg|.JPG|.gif|.GIF|.pdf|.PDF|.doc|.DOC|.ZIP|.zip)$" 
                            ControlToValidate="docFileUpload" ValidationGroup="uploadValidationGroup" Display="Dynamic"></asp:RegularExpressionValidator> 
                        </div> 
                        <div style="clear:both;margin:3px;">  
                            <asp:Button ID="btnUpdate"   
                                        Text='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "Insert" : "Update" %>' 
                                        runat="server"   
                                        CommandName='<%# (Container as GridItem).OwnerTableView.IsItemInserted ? "PerformInsert" : "Update" %>' 
                            > 
                            </asp:Button>&nbsp;  
                            <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" 
                            CommandName="Cancel"></asp:Button> 
                        </div> 
                    </FormTemplate> 
                </EditFormSettings> 
           </MasterTableView> 
           <ClientSettings> 
                            <ClientEvents OnRowContextMenu="RowContextMenu" > 
                            </ClientEvents> 
                            <Selecting AllowRowSelect="true"  /> 
            </ClientSettings> 
           <FilterMenu  HoverBackColor="LightSteelBlue" HoverBorderColor="Navy" NotSelectedImageUrl="~/RadControls/Grid/Skins/Outlook/NotSelectedMenu.gif" 
               SelectColumnBackColor="Control" SelectedImageUrl="~/RadControls/Grid/Skins/Outlook/SelectedMenu.gif" 
               TextColumnBackColor="Window">  
                  
                  
           </FilterMenu> 
       </radG:RadGrid> 
         
          
        <asp:HiddenField ID="hfDocId" runat="server" /> 
        <input type="hidden" id="radGridClickedRowIndex" name="radGridClickedRowIndex" /> 
          
    </div> 
</div> 
 
 
</asp:Content> 

using System;  
using System.Data;  
using System.Configuration;  
using System.Collections;  
using System.Web;  
using System.Web.Security;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.Web.UI.WebControls.WebParts;  
using System.Web.UI.HtmlControls;  
using System.Data.SqlClient;  
using System.IO;  
using Telerik.Web.UI;  
 
namespace TDMSF15.Documents  
{  
    public partial class Default : System.Web.UI.Page  
    {  
        string ConString = ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString;  
        RadTreeNode rtn = null;  
        protected void Page_Load(object sender, EventArgs e)  
        {  
 
            if (!Page.IsPostBack)  
            {  
                Session["TreeID"] = 0;  
                GenerateTreeView();  
                /* MembershipUser u = Membership.GetUser(Page.User.Identity.Name);
                 if (!Roles.IsUserInRole(u.UserName, Globals.Role_Administrator) &&
                !Roles.IsUserInRole(u.UserName, Globals.Role_DataEntry))
                 {
                     cRadMenu.Enabled = false;
                     cRadMenu.Visible = false;
                 }*/ 
            }  
        }  
 
        public void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)  
        {  
           // if (e.CommandName != "Download")  
            //    return;  
 
            RadTreeNode node = this.RadTreeView1.SelectedNode;  
             MembershipUser u = Membership.GetUser(Page.User.Identity.Name);  
              
            if (e.CommandName == RadGrid.InitInsertCommandName)  
            {  
                //Add new" button clicked  
                e.Canceled = true;  
                //Prepare an IDictionary with the predefined values  
                System.Collections.Specialized.ListDictionary newValues = new 
                                        System.Collections.Specialized.ListDictionary();  
 
                newValues["Description"] = string.Empty;
                newValues["ReadOnly"] = false;
                //Insert the item and rebind
                this.rtn = node;
                e.Item.OwnerTableView.InsertItem(newValues);
                
               // RadGrid1.Rebind();
            }
            else 
                if (e.CommandName == "Download")
            {
                string fileName = e.CommandArgument.ToString();
                
               
                string fileLocation = Path.Combine(Globals.uploadDir, fileName);
                if (!File.Exists(fileLocation))
                {
                    throw new Exception("File [" + fileLocation + "] does not exisits");
                }
                FileInfo file = new FileInfo(fileLocation);
                Response.Clear();
                Response.AddHeader("content-disposition", "attachment;filename=" + file.Name);
                Response.AddHeader("Content-Length", file.Length.ToString());
                Response.Buffer = true;
                Response.ContentType = "application/octet-stream";
                Response.WriteFile(file.FullName);
            }
            else if (e.CommandName == "Update")
            {
       /*         if (!Roles.IsUserInRole(u.UserName, Globals.Role_Administrator) &&
           !Roles.IsUserInRole(u.UserName, Globals.Role_DataEntry))
                {
                    return;
                }*/
                //get File
                FileUpload fileUpload = (FileUpload)e.Item.FindControl("docFileUpload");
                //TextBox name = (TextBox)e.Item.FindControl("txtName");
                TextBox description = (TextBox)e.Item.FindControl("txtDescription");
               
                //int radGridClickedRowIndex;
                //radGridClickedRowIndex = Convert.ToInt32(Request.Form["radGridClickedRowIndex"]);
                    
                int docId = (int) RadGrid1.MasterTableView.DataKeyValues[Convert.ToInt32(e.Item.ItemIndex)]["Id"];
                if (docId > 0)
                {
                    Domain.TDMSDocument doc = null;
                    if (LxT.Common.Utilities.StringUtil.GetIntValue(this.hfDocId.Value, -1)
                                == Domain.TDMSDocument.globalDocument)
                        doc = (Domain.TDMSDocument)Persistence.TDMSHelpers.GetDocumentHelper().Select(docId);
                    else
                        doc = (Domain.TDMSDocument)Persistence.TDMSHelpers.GetUploadedDocumentHelper().Select(docId);
                    //doc.Name = name.Text;
                    doc.Description = description.Text;
                    doc.modifiedBy = User.Identity.Name;
                    if (fileUpload.HasFile)
                    {
                        doc.FileSize = fileUpload.PostedFile.ContentLength;
                        string newFileLocation = doc.FileLocation.Replace(doc.Name, 
                            fileUpload.FileName);
                        
                        string _filePath = Path.Combine(Globals.uploadDir,
                        newFileLocation/*fileUpload.FileName*/);
                        
                        doc.Name = fileUpload.FileName;
                        
                        //delete old file
                        File.Delete(Path.Combine(Globals.uploadDir,
                                doc.FileLocation));
                        doc.FileLocation = newFileLocation;
                        //save ew file
                        fileUpload.SaveAs(_filePath);
                     
                    }
                    if (LxT.Common.Utilities.StringUtil.GetIntValue(this.hfDocId.Value, -1)
                                == Domain.TDMSDocument.globalDocument)
                        Persistence.TDMSHelpers.GetDocumentHelper().Update(doc);
                    else
                        Persistence.TDMSHelpers.GetUploadedDocumentHelper().Update(doc);
                }
                LoadGridData(node);
            }
            else if (e.CommandName == "Cancel")
            {
                LoadGridData(node);
            }
            
        }
        private void GenerateTreeView()
        {
            SqlConnection dbCon = new SqlConnection(ConString);
            dbCon.Open();
            SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM DocumentTree ORDER BY TreeOrder", dbCon);
            DataSet ds = new DataSet();
            adapter.Fill(ds);
            ds.Relations.Add("NodeRelation", ds.Tables[0].Columns["TreeId"], ds.Tables[0].Columns["parentId"]);
            foreach (DataRow dbRow in ds.Tables[0].Rows)
            {
                string documentId = null;
                string stage = string.Empty;
                int substage = Globals.nullInt;
                int objectType = Globals.nullInt;
                bool allowAdd = false;
                string folder = string.Empty;
                if (dbRow["DocumentType"] != DBNull.Value)
                    documentId = (string)dbRow["DocumentType"];
                if (dbRow["stage"] != DBNull.Value)
                    stage = (string)dbRow["stage"];
                if (dbRow["substage"] != DBNull.Value)
                    substage = (int)dbRow["substage"];
                if (dbRow["objecttype"] != DBNull.Value)
                    objectType = (int)dbRow["objecttype"];
                if (dbRow["allowAdd"] != DBNull.Value)
                    allowAdd = (bool)dbRow["allowAdd"];
                if (dbRow["folder"] != DBNull.Value)
                    folder = (string)dbRow["folder"];
                string readRoles = string.Empty;
                string editDeleteRoles = string.Empty;
                string  addRoles = string.Empty;
                if (dbRow["ViewList"] != DBNull.Value)
                    readRoles = (string)dbRow["ViewList"];
                if (dbRow["EditDeleteList"] != DBNull.Value)
                    editDeleteRoles = (string)dbRow["EditDeleteList"];
                if (dbRow["AddList"] != DBNull.Value)
                    addRoles = (string)dbRow["AddList"];
                if (dbRow.IsNull("parentId"))
                {
                    RadTreeNode node = CreateNode(dbRow["NodeName"].ToString(), false, dbRow["TreeId"].ToString(), documentId, stage, 
                        substage, objectType, allowAdd, folder, 
                        readRoles, editDeleteRoles, addRoles);
                    RadTreeView1.Nodes.Add(node);
                    RecursivelyPopulate(dbRow, node);
                }
            }
        }
        public void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            System.Drawing.Color c = System.Drawing.Color.FromName("#eeeeee");
            
            if (e.Item.ItemType == Telerik.Web.UI.GridItemType.Item || e.Item.ItemType == Telerik.Web.UI.GridItemType.AlternatingItem)
            {
                // int id = (Int32)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"];
                Domain.TDMSUploadedDocument d = e.Item.DataItem as Domain.TDMSUploadedDocument;
                if (d != null)
                {
                    if (d.StageTypeId == Globals.Stage_NDI_Reinspection)
                    {
                        e.Item.BackColor = c;
                    }
                }
            }
        }
        
    
        private void RecursivelyPopulate(DataRow dbRow, RadTreeNode node)
        {
            foreach (DataRow childRow in dbRow.GetChildRows("NodeRelation"))
            {
                string documentId = null;
                string stage = string.Empty;
                int substage = Globals.nullInt;
                int objectType = Globals.nullInt;
                bool allowAdd = false;
                string folder = string.Empty;
                if (childRow["DocumentType"] != DBNull.Value)
                    documentId = (string)childRow["DocumentType"];
                if (childRow["stage"] != DBNull.Value)
                    stage = (string)childRow["stage"];
                if (childRow["substage"] != DBNull.Value)
                    substage = (int)childRow["substage"];
                if (childRow["objecttype"] != DBNull.Value)
                    objectType = (int)childRow["objecttype"];
                if (childRow["allowAdd"] != DBNull.Value)
                    allowAdd = (bool)childRow["allowAdd"];
                if (childRow["folder"] != DBNull.Value)
                    folder = (string)childRow["folder"];
                
               // childNode.ExpandMode = ExpandMode.ServerSide;
                 string readRoles = string.Empty;
                string editDeleteRoles = string.Empty;
                string  addRoles = string.Empty;
                if (dbRow["ViewList"] != DBNull.Value)
                    readRoles = (string)dbRow["ViewList"];
                if (dbRow["EditDeleteList"] != DBNull.Value)
                    editDeleteRoles = (string)dbRow["EditDeleteList"];
                if (dbRow["AddList"] != DBNull.Value)
                    addRoles = (string)dbRow["AddList"];
                RadTreeNode childNode = CreateNode(childRow["NodeName"].ToString(), false, childRow["TreeId"].ToString(), documentId, 
                    stage, substage, objectType, allowAdd, folder,
                    readRoles, editDeleteRoles, addRoles);
                childNode.PostBack = true;
                node.Nodes.Add(childNode);
                RecursivelyPopulate(childRow, childNode);
            }
        }
        protected void ProcessComponent(RadTreeNode nodeClicked, string docType, string stageId, int subStageId, int objectType)
        {
            nodeClicked.Nodes.Clear();
            /*int objectType = Globals.nullInt;
            if (stageId == Globals.Stage_NDI)
            {
                objectType = (int)Globals.StatusObjects.Part;
            }*/
            //get information from database, and add new nodes
            ArrayList dl = Persistence.TDMSHelpers.GetUploadedDocumentHelper().SelectComponentsByDocumentType(docType, stageId, subStageId, objectType) as ArrayList;
            foreach (LxT.Common.Utilities.Enumerated.EnumeratedSimple es in dl)
            {
                RadTreeNode node = new RadTreeNode(es.Name);
                node.Attributes.Add("ID", es.Id.ToString());
                node.PostBack = true;
                node.ExpandMode = Telerik.Web.UI.TreeNodeExpandMode.ServerSide;
                node.ImageUrl = "../images/folder.gif";
                node.Expanded = false;
                node.Attributes.Add("comp", "yes");
                node.Attributes.Add("doc", docType);
                node.Attributes.Add("stage", stageId);
                node.Attributes.Add("substage", subStageId.ToString());
                node.Attributes.Add("objectType", objectType.ToString());
                node.Attributes.Add("readRoles", nodeClicked.Attributes["readRoles"]);
                node.Attributes.Add("addRoles", nodeClicked.Attributes["addRoles"]);
                node.Attributes.Add("editDeleteRoles", nodeClicked.Attributes["editDeleteRoles"]);
                nodeClicked.Nodes.Add(node);
            }
        }
        private RadTreeNode CreateNode(string text, bool expanded, string id, string documentType, 
            string stage, int subStage, int objectType, bool allowAdd, string folder, 
            string  readRoles, string editDeleteRoles, string addRoles)
        {
            RadTreeNode node = new RadTreeNode(text);
            node.Expanded = expanded;
            node.ImageUrl = "../images/folder.gif";
             node.Attributes.Add("ID",id);
            node.PostBack = true;
            //node.ExpandMode = ExpandMode.ServerSide;
            int Id = LxT.Common.Utilities.StringUtil.ToIntIndex(id);
            node.Attributes.Add("folder", folder);
            node.Attributes.Add("allowAdd", allowAdd.ToString());
            node.Attributes.Add("readRoles", readRoles);
            node.Attributes.Add("addRoles", addRoles);
            node.Attributes.Add("editDeleteRoles", editDeleteRoles);
            if(!string.IsNullOrEmpty(documentType))
            {
                node.PostBack = true;
                node.ExpandMode = TreeNodeExpandMode.ServerSide;
                node.Attributes.Add("doc", documentType);
                if (!string.IsNullOrEmpty(stage))
                {
                    node.Attributes.Add("stage", stage.ToString());
                }
                if (subStage != Globals.nullInt)
                {
                    node.Attributes.Add("subStage", subStage.ToString());
                }
                if (objectType != Globals.nullInt)
                {
                    node.Attributes.Add("objectType", objectType.ToString());
                }
            }
            return node;
        }
        protected void ProcessSection(RadTreeNode nodeClicked)
        {
            nodeClicked.Nodes.Clear();
            int objectType = LxT.Common.Utilities.StringUtil.GetIntValue(nodeClicked.Attributes["objectType"],
                Globals.nullInt);
            string stageId = nodeClicked.Attributes["stage"];
            
            //get information from database, and add new nodes
            ArrayList dl = Persistence.TDMSHelpers.GetUploadedDocumentHelper().SelectSectionsByDocumentType(nodeClicked.Attributes["doc"], 
                LxT.Common.Utilities.StringUtil.GetIntValue(nodeClicked.Attributes["ID"], 0),
                nodeClicked.Attributes["stage"], 
                LxT.Common.Utilities.StringUtil.GetIntValue(nodeClicked.Attributes["substage"], 
                Globals.nullInt ),
                objectType
                ) as ArrayList;
             
            foreach (LxT.Common.Utilities.Enumerated.EnumeratedSimpleTxt es in dl)
            {
                RadTreeNode node = new RadTreeNode(es.IdTxt);
                node.Attributes.Add("ID",es.Name);
                node.PostBack = true;
                if (objectType != (int)Globals.StatusObjects.Section)
                {
                    
                    node.ExpandMode = Telerik.Web.UI.TreeNodeExpandMode.ServerSide;
                }
                node.ImageUrl = "../images/folder.gif";
                node.Expanded = false;
                node.Attributes.Add("type", Globals.StatusObjects.Section.ToString());
                node.Attributes.Add("doc", nodeClicked.Attributes["doc"]);
                node.Attributes.Add("stage", nodeClicked.Attributes["stage"]);
                node.Attributes.Add("substage", nodeClicked.Attributes["substage"]);
                node.Attributes.Add("readRoles", nodeClicked.Attributes["readRoles"]);
                node.Attributes.Add("addRoles", nodeClicked.Attributes["addRoles"]);
                node.Attributes.Add("editDeleteRoles", nodeClicked.Attributes["editDeleteRoles"]);
                nodeClicked.Nodes.Add(node);
            }
        }
        protected void ProcessPart(RadTreeNode nodeClicked)
        {
            nodeClicked.Nodes.Clear();
            //get information from database, and add new nodes
            ArrayList dl = Persistence.TDMSHelpers.GetUploadedDocumentHelper().SelectPartsByDocumentType(
                nodeClicked.Attributes["doc"], nodeClicked.Attributes["ID"],
                
                nodeClicked.Attributes["stage"],
                LxT.Common.Utilities.StringUtil.GetIntValue(nodeClicked.Attributes["substage"], 
                Globals.nullInt)) as ArrayList;
            foreach (LxT.Common.Utilities.Enumerated.EnumeratedSimpleTxt es in dl)
            {
                if (!string.IsNullOrEmpty(es.IdTxt))
                {
                    RadTreeNode node = new RadTreeNode(es.IdTxt);
                     node.Attributes.Add("ID",es.Name);
                    node.PostBack = true;
                    node.PostBack = true;
                    node.ExpandMode = TreeNodeExpandMode.ServerSide;
                    node.ImageUrl = "../images/folder.gif";
                    node.Attributes.Add("type", Globals.StatusObjects.Part.ToString());
                    node.Attributes.Add("doc", nodeClicked.Attributes["doc"]);
                    node.Attributes.Add("partid", es.IdTxt.Substring(4, 3));
                    node.Attributes.Add("section", nodeClicked.Attributes["ID"]);
                    node.Attributes.Add("stage", nodeClicked.Attributes["stage"]);
                    node.Attributes.Add("substage", nodeClicked.Attributes["substage"]);
                    node.Attributes.Add("readRoles", nodeClicked.Attributes["readRoles"]);
                    node.Attributes.Add("addRoles", nodeClicked.Attributes["addRoles"]);
                    node.Attributes.Add("editDeleteRoles", nodeClicked.Attributes["editDeleteRoles"]);
                    nodeClicked.Nodes.Add(node);
                }
            }
        }
        protected void ProcessSubPart(RadTreeNode nodeClicked)
        {
            nodeClicked.Nodes.Clear();
            //get information from database, and add new nodes
            ArrayList dl = Persistence.TDMSHelpers.GetUploadedDocumentHelper().SelectSubPartsByDocumentType(
                nodeClicked.Attributes["doc"], nodeClicked.Attributes["section"],
                  nodeClicked.Attributes["stage"], 
                  
                LxT.Common.Utilities.StringUtil.GetIntValue(nodeClicked.Attributes["substage"], 
                Globals.nullInt),
                nodeClicked.Attributes["partid"] 
                ) as ArrayList;
            foreach (LxT.Common.Utilities.Enumerated.EnumeratedSimpleTxt es in dl)
            {
                if (!string.IsNullOrEmpty(es.IdTxt))
                {
                    RadTreeNode node = new RadTreeNode(es.IdTxt);
                     node.Attributes.Add("ID",es.Name);
                    node.PostBack = true;
                    node.ImageUrl = "../images/folder.gif";
                    node.Attributes.Add("type", Globals.StatusObjects.Part.ToString());
                    node.Attributes.Add("doc", nodeClicked.Attributes["doc"]);
                    node.Attributes.Add("stage", nodeClicked.Attributes["stage"]);
                    node.Attributes.Add("substage", nodeClicked.Attributes["substage"]);
                    node.Attributes.Add("readRoles", nodeClicked.Attributes["readRoles"]);
                    node.Attributes.Add("addRoles", nodeClicked.Attributes["addRoles"]);
                    node.Attributes.Add("editDeleteRoles", nodeClicked.Attributes["editDeleteRoles"]);
                    nodeClicked.Nodes.Add(node);
                }
            }
        }
        protected void RadTreeView1_NodeExpand(object o, RadTreeNodeEventArgs e)
        {
            if (e.Node.Attributes["type"] != null)
            {
                if (e.Node.Attributes["partid"] == null) 
                    ProcessPart( e.Node);
                else
                    ProcessSubPart( e.Node);
            }
            else if (e.Node.Attributes["comp"] != null)
            {
                ProcessSection(e.Node);
            }
            else if  (!string.IsNullOrEmpty(e.Node.Attributes["doc"]))
            {
                //i actually want it to fail here if doc id is not integer
                string doc = e.Node.Attributes["doc"];
                string stage = e.Node.Attributes["stage"];
                int subStage = LxT.Common.Utilities.StringUtil.GetIntValue(e.Node.Attributes["substage"], Globals.nullInt);
                int objectType = LxT.Common.Utilities.StringUtil.GetIntValue(e.Node.Attributes["objecttype"], Globals.nullInt);
                ProcessComponent( e.Node, doc, stage, subStage, objectType);
               
            }
            e.Node.Expanded = true;
        }
        protected void LoadGridData(RadTreeNode node)
        {
            MembershipUser u = Membership.GetUser(Page.User.Identity.Name);
            ArrayList al = null;
            //WebProfile p = new WebProfile(Context.Profile);
            if (node == null)
            {
                RadGrid1.DataSource = new ArrayList();
              
            }
            else
            {
                TDMSF15.Domain.DocumentPermissions dp = new TDMSF15.Domain.DocumentPermissions();
                dp.Read = node.Attributes["readRoles"];
                dp.Add = node.Attributes["addRoles"];
                dp.EditDelete = node.Attributes["editDeleteRoles"];
                if (node.Attributes["type"] != null)
                {
                    if (node.Attributes["type"].CompareTo(Globals.StatusObjects.Section.ToString()) == 0)
                    {
                        al = new ArrayList(Persistence.TDMSHelpers.GetUploadedDocumentHelper().Select(
                          node.Attributes["ID"], null, node.Attributes["doc"],
                          node.Attributes["stage"], node.Attributes["substage"]));
                    }
                    else
                    {
                        al = new ArrayList(Persistence.TDMSHelpers.GetUploadedDocumentHelper().Select(
                            null, node.Attributes["ID"], node.Attributes["doc"],
                            node.Attributes["stage"], node.Attributes["substage"]));
                    }
                    hfDocId.Value = Domain.TDMSDocument.uploadedDocument.ToString();
                }
                else
                {
                    al = new ArrayList(Persistence.TDMSHelpers.GetDocumentHelper().SelectDocumentByTreeId(LxT.Common.Utilities.StringUtil.GetIntValue(node.Attributes["ID"], -1)));
                    hfDocId.Value = Domain.TDMSDocument.globalDocument.ToString();
                }
                string[] roles = dp.readRoles;
                bool read = false;
                foreach (string r in roles)
                {
                    if (!string.IsNullOrEmpty(r))
                    {
                        if (Roles.IsUserInRole(u.UserName, r))
                        {
                            read = true;
                            break;
                        }
                    }
                }
                if (!read)
                {
                    foreach (Domain.TDMSDocument d in al)
                    {
                        d.Disabled = true;
                    }
                }
                RadGrid1.DataSource = al;
        }
            //RadGrid1.DataBind();
            
           /* System.Collections.Specialized.ListDictionary newValues = new
            System.Collections.Specialized.ListDictionary();
            newValues["Description"] = "";  
            //Insert the item and rebind  
            RadGrid1.MasterTableView.InsertItem(newValues);  
            RadGrid1.MasterTableView.IsItemInserted = true;  
 
            if (RadGrid1.MasterTableView.Items.Count == 0)  
            {  
                RadGrid1.MasterTableView.IsItemInserted = true;  
            }*/  
              
        }  
 
        
        protected void RadGrid1_OnNeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)  
        {  
            LoadGridData(rtn);  
        }  
        protected void RadTreeView1_NodeClick(object o, RadTreeNodeEventArgs e)  
        {  
            if (RadGrid1.MasterTableView.IsItemInserted == true) RadGrid1.MasterTableView.IsItemInserted = false;  
 
             MembershipUser u = Membership.GetUser(Page.User.Identity.Name);  
             string[] roles = null;  
             /*if (Roles.IsUserInRole(u.UserName, Globals.Role_DataEntry) || Roles.IsUserInRole(u.UserName, Globals.Role_Administrator))
             {*/ 
 
                 TDMSF15.Domain.DocumentPermissions dp = new TDMSF15.Domain.DocumentPermissions();  
                 dp.Read = e.Node.Attributes["readRoles"];
                 dp.Add = e.Node.Attributes["addRoles"];
                 dp.EditDelete = e.Node.Attributes["editDeleteRoles"];
                 bool add = LxT.Common.Utilities.StringUtil.GetBooleanValue(e.Node.Attributes["allowAdd"], false);
                 if (add)
                 {
                     
                     roles = dp.addRoles;
                     add = false;
                     foreach (string r in roles)
                     {
                         if (!string.IsNullOrEmpty(r))
                         {
                             if (Roles.IsUserInRole(u.UserName, r))
                             {
                                 add = true;
                                 break;
                             }
                         }
                     }
                     if(add)
                        RadGrid1.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
                     else
                        RadGrid1.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
               
                 }
                 else
                 {
                     RadGrid1.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
                 }
                 roles = dp.editDeleteRoles;
                 bool editDelete = false;
                 foreach (string r in roles)
                 {
                     if (!string.IsNullOrEmpty(r))
                     {
                         if (Roles.IsUserInRole(u.UserName, r))
                         {
                             editDelete = true;
                             break;
                         }
                     }
                 }
                 if (editDelete)
                 {
                     cRadMenu.Enabled = true;
                     cRadMenu.Visible = true;
                 }
                 else
                 {
                     cRadMenu.Enabled = false;
                     cRadMenu.Visible = false;
                 }
           /*  }
             else
             {
                 RadGrid1.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None;
                
             }*/
            rtn = e.Node;
            RadGrid1.Rebind();
            //LoadGridData(e.Node);
            
        }  
 
        protected virtual void RadGrid1_InsertCommand(object source,GridCommandEventArgs e)
        {
             //get File
               // MembershipUser u = Membership.GetUser(Page.User.Identity.Name);
               // if (!Roles.IsUserInRole(u.UserName, Globals.Role_Administrator) &&
               //!Roles.IsUserInRole(u.UserName, Globals.Role_DataEntry))
               // {
               //     cRadMenu.Enabled = false;
               //     cRadMenu.Visible = false;
               // }
                FileUpload fileUpload = (FileUpload)e.Item.FindControl("docFileUpload");
                TextBox description = (TextBox)e.Item.FindControl("txtDescription");
                rtn = this.RadTreeView1.SelectedNode;
                bool add = LxT.Common.Utilities.StringUtil.GetBooleanValue(rtn.Attributes["allowAdd"], false);
                if (fileUpload.HasFile && add)
                {
                   int _fileSize = fileUpload.PostedFile.ContentLength;
                    string mds = Globals.Mds.Replace(' ', '-');
                    string homeFolder = Path.Combine(mds, rtn.Attributes["folder"]);
                   //string homeFolder = rtn.Attributes["folder"];
                    string _filePath = Path.Combine(Globals.uploadDir, homeFolder);
                    Persistence.DocumentHelper uph = Persistence.TDMSHelpers.GetDocumentHelper();
                    uph.CreateDirectory(_filePath);
                    _filePath = Path.Combine(_filePath,  fileUpload.FileName);
                    fileUpload.SaveAs(_filePath);
                    _filePath = Path.Combine(homeFolder, fileUpload.FileName);
                    Domain.TDMSDocument doc = new Domain.TDMSUploadedDocument();
                    doc.createdBy = Page.User.Identity.Name;
                    doc.modifiedBy = Page.User.Identity.Name;
                    doc.Description = description.Text;
                    
                    doc.Name = fileUpload.FileName;
                    doc.FileSize = _fileSize;
                    doc.FileLocation = _filePath;
                    doc.TreeId = Int32.Parse(rtn.Attributes["ID"]);
                    uph.Insert(doc);
                RadGrid1.MasterTableView.IsItemInserted = false;
                    
                    RadGrid1.Rebind();
                }
        }
        protected void RadMenu1_ItemClick(object sender, RadMenuEventArgs e)
        {
            int radGridClickedRowIndex;
            
            radGridClickedRowIndex = Convert.ToInt32(Request.Form["radGridClickedRowIndex"]);
            /*RadTreeNode node*/ this.rtn = this.RadTreeView1.SelectedNode;
            switch (e.Item.Text)
            {
                case "Delete":
                    
                
                    int docId = (int) RadGrid1.MasterTableView.DataKeyValues[radGridClickedRowIndex]["Id"];
                    if (docId > 0)
                    {
                        if(LxT.Common.Utilities.StringUtil.GetIntValue(this.hfDocId.Value, -1) 
                            == Domain.TDMSDocument.globalDocument)
                            Persistence.TDMSHelpers.GetDocumentHelper().Delete(docId);
                        else
                            Persistence.TDMSHelpers.GetUploadedDocumentHelper().Delete(docId);
                    }
                    //LoadGridData(node);
                    RadGrid1.Rebind();
                    break;
                case "Edit":  
                    RadGrid1.Items[radGridClickedRowIndex].Edit = true;  
                    RadGrid1.Rebind();  
                    //LoadGridData(node);  
                    break;  
                
               
            }  
        }  
      
 
    }  






Alex
Top achievements
Rank 1
 answered on 30 Dec 2009
4 answers
185 views

I have a radgrid with editformsetting using 2 ascx files. each has its condition to calculate sum of two textboxes when leaving the textboxes. but I keep getting error like the page is not recognizing the javascript.

                //Calculate the original pages * the copies and input the result to copy quantity  
                var ActualIndex;  
                var index;  
                var txtRadOriginalPages = null;  
                var txtRadCopies = null;  
                var txtRadCopyQty1 = null;  
 
                function updateTotals(sender, args) {  
                    var v1 = txtOriginalPages.get_value();  
                    var v2 = txtCopies.get_value();  
                    var finalValue = parseFloat(v1) * parseFloat(v2);  
                    txtRadCopyQty1.set_value(parseFloat(finalValue));  
                }  
                function setIndex(sender, args) {  
                    index = args.get_itemIndexHierarchical();  
                }  
                function setActualIndex() {  
                    ActualIndex = index;  
                }  
                function Load1(sender, args) {  
                    txtOriginalPages = sender;  
                }  
                function Load2(sender, args) {  
                    txtCopies = sender;  
                }  
                function Load3(sender, args) {  
                    txtRadCopyQty1 = sender;  
                } 
                        <tr> 
                            <td align="left">  
                                <asp:Label ID="lblOriginalPages" runat="server" Text="Original Pages:"></asp:Label> 
                            </td> 
                            <td align="left">  
                                <telerik:RadNumericTextBox ID="txtRadOriginalPages" runat="server"   
                                    DbValue='<%# Eval("Orig_Pages" ) %>' Font-Size="11px" Skin="Office2007"   
                                    NumberFormat-DecimalDigits="0" Type="Number" Width="100px" > 
                                    <ClientEvents OnValueChanged="updateTotals" OnFocus="setActualIndex" OnLoad="Load1" /> 
                                    <NumberFormat DecimalDigits="0" /> 
                                </telerik:RadNumericTextBox> 
                            </td> 
                            <td align="left">  
                                <asp:Label ID="lblCopies" runat="server" Text="Copies:"></asp:Label> 
                            </td> 
                            <td align="left">  
                                <telerik:RadNumericTextBox ID="txtRadCopies" runat="server"   
                                    DbValue='<%# Eval("Quantity" ) %>' Font-Size="11px" Skin="Office2007"   
                                    NumberFormat-DecimalDigits="0" Type="Number" Width="100px" > 
                                    <ClientEvents OnValueChanged="updateTotals" OnFocus="setActualIndex" OnLoad="Load2" /> 
                                    <NumberFormat DecimalDigits="0" /> 
                                </telerik:RadNumericTextBox> 
                            </td> 
                         </tr> 
                       <tr> 
                            <td align="left">  
                                <asp:Label ID="lblCopyQty1" runat="server" Text="Copy Quantity 1:"></asp:Label> 
                            </td> 
                            <td align="left">  
                                <telerik:RadNumericTextBox ID="txtRadCopyQty1" runat="server"   
                                    DbValue='<%# Eval("Total") %>' Font-Size="11px" Skin="Office2007" Width="100px"   
                                    NumberFormat-DecimalDigits="0" Type="Number">  
                                    <ClientEvents OnLoad="Load3" /> 
                                    <NumberFormat DecimalDigits="0"></NumberFormat> 
                                </telerik:RadNumericTextBox> 
                            </td> 
                            <td align="left">  
                                <asp:Label ID="lblInkType1" runat="server" Text="Ink Type 1:"></asp:Label> 
                            </td> 
                        </tr> 
anybody can help me? Please...
Thank you.
Dimo
Telerik team
 answered on 30 Dec 2009
3 answers
130 views
Hello,
i'm currently using sitefinity community version which use the old version of telerik controls. I want to create a user control(containing for example the latest combobox and the latest radgrid version) and place it inside a page of sitefinity.
Is that possible? and if yes, how to do that?

thank you
Shinu
Top achievements
Rank 2
 answered on 30 Dec 2009
3 answers
97 views

 

Hi, 
 
I am using the RadComboBox And On ClientSideSelected Index Change I am enabling/disabling the rad Calender.
It works well if I dont enter any value in radDate Time picker on selected index Change of radCombo. But the problem arises of "Object Required" when the RAD DateTime Picker is filled with the value, and then we fire the RADCombo selected index change.

This is all What my code is:

<
telerik:RadComboBox Width="220px" ID="rcmbFileDate" runat="server" Skin="WebBlue"

 

 

OnClientSelectedIndexChanged="FileModifyDateLeftBar">

 

 

<Items>

 

 

<telerik:RadComboBoxItem runat="server" Text="All files, regardless of date" Value="0" />

 

 

<telerik:RadComboBoxItem runat="server" Text="File last modified before __" Value="1" />

 

 

<telerik:RadComboBoxItem runat="server" Text="File last modified after __" Value="2" />

 

 

<telerik:RadComboBoxItem runat="server" Text="File last modified between __ and __"

 

 

Value="3" />

 

 

<telerik:RadComboBoxItem runat="server" Text="File created before __" Value="4" />

 

 

<telerik:RadComboBoxItem runat="server" Text="File created after __" Value="5" />

 

 

<telerik:RadComboBoxItem runat="server" Text="File created between __ and __" Value="6" />

 

 

</Items>

 

 

</telerik:RadComboBox>

 

 


<
telerik:RadDatePicker Enabled="false" Width="90px" ID="rdpFromDate" runat="server"

 

 

 

 

 

DateInput-DateFormat="MM/dd/yyyy">

 

 

 

 

 

</telerik:RadDatePicker>

 

 

 

 

 

&nbsp;and&nbsp;<telerik:RadDatePicker Enabled="false" Width="90px" ID="rdpTodate"

 

 

 

 

 

runat="server">

 

 

 

 

 

</telerik:RadDatePicker>

 

 


Javascript Code Being Executed:

function FileModifyDateLeftBar(sender, eventArgs) {

 

 

var item = eventArgs.get_item();

 

$find(rdpFromDate).clear();

$find(rdpTodate).clear();

 

switch (item.get_value()) {

 

 

case "0":

 

{

$find(rdpFromDate).set_enabled(

false);

 

$find(rdpTodate).set_enabled(

false);

 

 

break;

 

}

 

case "1":

 

{

$find(rdpFromDate).set_enabled(

false);

 

$find(rdpTodate).set_enabled(

true);

 

 

break;

 

}

 

case "4":

 

$find(rdpFromDate).set_enabled(

false);

 

$find(rdpTodate).set_enabled(

true);

 

 

break;

 

 

case "2":

 

{

$find(rdpFromDate).set_enabled(

true);

 

$find(rdpTodate).set_enabled(

false);

 

 

break;

 

}

 

case "5":

 

{

$find(rdpFromDate).set_enabled(

true);

 

$find(rdpTodate).set_enabled(

false);

 

 

break;

 

}

 

case "3":

 

{

$find(rdpFromDate).set_enabled(

true);

 

$find(rdpTodate).set_enabled(

true);

 

}

 

case "6":

 

{

$find(rdpFromDate).set_enabled(

true);

 

$find(rdpTodate).set_enabled(

true);

 

 

break;

 

}

}

}


Please review the code below. And let me know what is causing the issue.

Thanks and Regards,
Yuvika

 

Dimo
Telerik team
 answered on 30 Dec 2009
6 answers
192 views
I'm a newbie og RadGrid.

Default mode of RadGrid in edit mode don't permit insertion of key values.

There is a mode, only for new record (ADD NEW RECORD), to insert key value ?

Thanks, Andrea
Andrea Gorin
Top achievements
Rank 2
 answered on 30 Dec 2009
1 answer
419 views
Hellow Team;

how can i make my rad window alert scrollable!!!
the following my code:

string script;
            script = "<SCRIPT>";
            script += " radalert('scrollbars=1, " + message + "', 400, 100, '" + msgBoxTitle + "');";
            script += "</SCRIPT>";
RegisterStartupScript("message", script);
Svetlina Anati
Telerik team
 answered on 30 Dec 2009
1 answer
142 views
In total I'm utilizing three radWindows.

Two radwindows appear next to each other, upper and lower half of screen.

Then I have a pop-up radwindow that is supposed to appear over both of these windows.  But, when the upper radwindow displays a pdf via Acrobat, the back ground of the window is being hidden.  It's hard to explain, so I attached a screen shot.

Thank you for your help a head of time.

Svetlina Anati
Telerik team
 answered on 30 Dec 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?