Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
132 views
hi,
i am using the telerik grid in my project with three hierarchical level i add the 

CommandItemDisplay="Top" CommandItemSettings-AddNewRecordImageUrl="add.png" for all the three level grids but when i expand the all levels i didn't see any add new button at second level it appearing at first and last but missing at middle what can i dot to solve this problem

please see the attached image to see the bug

if you want full code please download from the following link     download the code
Antonio Stoilkov
Telerik team
 answered on 08 Feb 2012
2 answers
365 views
Hi,

I'm using a ListBox for selecting an item.
If a button of the control is clicked, I want to fetch the SelectedValue.
The SelectedItem is not null (since one item is selected) but all properties of the SelectedItem (which shoud be set, like Value, Text, ImageUrl) are empty. In fact, all Items of the ListBox don't have their information anymore.
I add the items only once (when the ListBox is initially created) - I simple create a List of RadListBoxItem and add them to the ListBox.

This is the code I use to create the ListBox:

m_listBox = new RadListBox();
 m_listBox.ID = "ListBox1";
 m_listBox.SelectionMode = ListBoxSelectionMode.Single;
 
 if (!Initialized)
 {
    List<RadListBoxItem> items = LoadItems();
    foreach (RadListBoxItem radListBoxItem in items)
    {
       m_listBox.Items.Add(radListBoxItem);
    }
    m_listBox.SelectedIndex = 0;
    Initialized = true;
 }

The Initialized property is saved in viewstate because my control isn't added when the page loads initially but later in a workflow.

This is how I create an item:
RadListBoxItem item = new RadListBoxItem(text, id.ToString(CultureInfo.InvariantCulture));
item.ImageUrl = "include/img/Objects/"" +imageUr;
items.Add(item);

All values are added correctly but in the PostBack they are empty.

What could cause this behavior?

Thanks!
JP
Top achievements
Rank 1
 answered on 08 Feb 2012
0 answers
97 views
I am using a grid with an popup ascx control for editing/inserting records. The grid displays sets of records (controled by a dropdown list)  When inserting a new record I need to be able to pass to the edit ascx control the ID from the dropdown list so it can be inserted in to the new record.
Mark
Top achievements
Rank 1
 asked on 08 Feb 2012
1 answer
123 views
Hi,

I would like to know, how we can extract the properties of a grid from the javascript radgrid object 
for example i need to know in the client side whether "selecting-allowrowselect" of the grid is being rendered as true or false,

<

clientsettings selecting-allowrowselect="true">.

 

 

//Assigns the Global Grid object on grid created

 

 

 

 

 

 

function OnGridCreated(sender, eventArgs) {

 

 

 

grid = sender;

}

 

so how to access the above property [clientsettings selecting-allowrowselect] in the "grid" object?

Regards,
CSW Support

 

Tsvetoslav
Telerik team
 answered on 08 Feb 2012
1 answer
133 views
Hi all,

I am attempting to create a Rad grid (version 2010.3.1215.40 in Visual Studio 2010 ) which returns a list of contacts. Each contact may have a number of 'profiles' representing how we know a person. For example, We may have a contact called Joe blogs, he could have two profiles, one which links him to Company A and one which links him to Company B (ie a contractor/consultant). A user needs to be able to select the profile id from the list of contacts, however we wish to only display the nested detail table if there is more then 1 profile. If there is only 1 profile then the user should just see that in the main grid.

So far I have the grid set up to display the full list of contacts and then they have the nested grid of profiles, however a user can currently expand a row even if it has 1 or 0 profiles. Any sugestions on how to not display the nested grid where the profile count is less then 2?

Many Thanks

<telerik:RadGrid ID="rgContactSearchResults" runat="server" Height="448px">
    <ClientSettings EnableRowHoverStyle="true" EnablePostBackOnRowClick="true" AllowKeyboardNavigation="true">
        <Selecting AllowRowSelect="True" />
    </ClientSettings>
    <MasterTableView DataKeyNames="ContactID" AutoGenerateColumns="true" TableLayout="Fixed">
        <DetailTables>
            <telerik:GridTableView DataKeyNames="ContactID" AutoGenerateColumns="true" DataMember="ContactID">
                <ParentTableRelation>
                    <telerik:GridRelationFields DetailKeyField="ContactID" MasterKeyField="ContactID" />
                </ParentTableRelation>
            </telerik:GridTableView>
        </DetailTables>
    </MasterTableView>
</telerik:RadGrid>
David
Top achievements
Rank 1
 answered on 08 Feb 2012
1 answer
76 views
Hi,

I have a simple hierarchical grid with a master table and a single detail table.  The desired behavior is when the user expands the master table row and clicks on a row in the detail table a js function is called etc.  All of this works fine except for the rowIndex is off by one.  The javascript I have is below...please note it is not the most efficient right now, I have it to this trying to figure out what is wrong.   In the 4th row of the script I originally had var row = DetailTable.get_dataItems()[dataItem.rowIndex]; but for the first row it was returning 1, second 2, etc. like it was 1 based.  I added a -1 to pull back the previous row and this works but not sure if that is the best approach.  Any thoughts on how I could better extract the 'UserID value from the detail table row the user double clicked on?

Thanks in advance,

K


function RowSelected(sender, eventArgs) {
 
     if (eventArgs.get_tableView().get_name() == "UserDetail") {
         var dataItem = $get(eventArgs.get_id());
         var DetailTable = eventArgs.get_tableView();
         var row = DetailTable.get_dataItems()[dataItem.rowIndex-1];  //I had to add -1 in order to return the correct row
         var cell = DetailTable.getCellByColumnUniqueName(row, "UserID");
         var IDu = cell.innerHTML
         $find("<%=RadAjaxPanel.ClientID%>").ajaxRequest("GoToDetails|" + IDu);
               return false;
     }
 }
Tsvetoslav
Telerik team
 answered on 08 Feb 2012
1 answer
62 views
Hello,

I have updated in Visual Studio the Telerik Libraries. After them i can't start my Websites. I get an Error in this File at compile time:
Telerik.Web.UI.WebResource_2.axd?_TSM_HiddenField...
in this line:
},_buildNode:function(i,h){var g=this._getEntityByName(i.Name),j=this,k={name:i.Name,type:i.EntityType,entity:g,child:h.apply(j,[g.NavigationProperty])};

I get a runtime error in Microsoft JScript: For the property "Name" can not be retrieved value: The object is null or undefined.

What can I do?

Best regards
Reiner
Plamen
Telerik team
 answered on 08 Feb 2012
1 answer
209 views
Is it possible to add and remove radtreeview to the radpanelbaritem dynamically from client side using javascript. I wanted to have a radpanel to which when the user expands a radpanelbaritem, a treeview is dynamically added to that from client side using javascript. Simillarly the panelbaritem which is being collapsed can go and remove all its children from client side using javascript. 
In short i was looking at a solution to add/remove item templates dynamically from client side using javascript.
Kate
Telerik team
 answered on 08 Feb 2012
1 answer
140 views
Hi,

I have an application, which have only one page and master page and all the screens are ascx controls and gets loaded dynamically with the use of LoadUserControl method.

The issues are :
1) Javascript does not works at all even that lies there in the master page. (The URL is : http://localhost:portnumber/abc/object) (As I have used the routing here)
2) Rad Window does not calls back the Javasccript button on one of its control. (Search control gets opened up in the Rad window and javascript exists there, does not get fired. However the inline alert works fine on the get button)
3) On the Tree list when I calls up the database program to bind the data, the data comes up properly but does not get bind properly some time. Like if the data return the count as 50 it will not display all 50 records sometimes, reason I understand could be that when ever the child of the existing records want to bind itself to the tree, the tree  get refreshed or rebind itself and thats why AJAX stops it to how all the records.

Main problems behind all these issues seems to be either the CSS and Themes or the AJAX update panel.
Please find the attached code for further clarrification.

Please help as it is very urgent and also suggest if I have missed something in Loading Control lifecycle at my own.

Thanks in advance!

Looking forward to buy more products from telerik, once we got succeedded in this project.
Tsvetina
Telerik team
 answered on 08 Feb 2012
3 answers
174 views
According to
http://demos.telerik.com/aspnet-ajax/treeview/examples/programming/loadondemandmodes/defaultcs.aspx
I'm using Page Method

But I have a problem, for somes node I need set AllowEdit = False.

I try use this solution
http://www.telerik.com/community/forums/aspnet-ajax/treeview/allowedit-ignored-in-radtreeview.aspx

but this does not load ParentNodes..

How I can set this??

regards,

this is my code (i do all by code)


public UpdatePanel CreateTreeViewObject(Page pg)
        {

            UpdatePanel updatePanel = new UpdatePanel {ID = "upTreeView", UpdateMode = UpdatePanelUpdateMode.Always};          
          

            HtmlGenericControl workspaceDiv = new HtmlGenericControl("DIV") { ID = "WSWorkspace" };
            
            HtmlGenericControl wsTreeview = new HtmlGenericControl("DIV") { ID = "WsTreeView" };

            RadTreeView radTreeView = new RadTreeView { ID = "tvWorkspace" };
            

            RadTreeNode parentNode =
                new RadTreeNode(_resources.GetString("Workspace", new CultureInfo(_culture)))
                {
                    Expanded = true,
                    AllowEdit = false,
                    AllowDrag = false,
                    AllowDrop = false,
                    ContextMenuID = "MainContextMenu",
                    Value = "0"
                };

            radTreeView.Nodes.Add(parentNode);

            LoadRootNodes(parentNode, TreeNodeExpandMode.WebService);
         
            System.Web.HttpContext.Current.Session["tvWorkspace"] = radTreeView;
            radTreeView.AllowNodeEditing = true;
            radTreeView.MultipleSelect = false;
            radTreeView.CheckBoxes = true;
            
            
            radTreeView.EnableDragAndDrop = true;
            radTreeView.EnableDragAndDropBetweenNodes = true;

            radTreeView.ContextMenuItemClick += RadTree_Contextmenutitem;
            radTreeView.NodeDrop += RadTreeView1_NodeDrop;
            radTreeView.NodeCheck += RadTreeView_NodeCheck;
            radTreeView.NodeEdit += RadTreeView1_NodeEdit;

            //radTreeView.OnClientNodeDataBound = "OnClientNodeDataBoundHandler";

            //radTreeView.NodeTemplate = new MyTemplateNode();
            
            radTreeView.ContextMenus.Add(new TreeViewContextMenus().CreateWsContextMenu());
            radTreeView.ContextMenus.Add(new TreeViewContextMenus().CreateFolderContextMenu());
            radTreeView.ContextMenus.Add(new TreeViewContextMenus().CreateDocumentContextMenu());
            radTreeView.ContextMenus.Add(new TreeViewContextMenus().CommonActionMenu());


            radTreeView.WebServiceSettings.Path = pg.ID;
            radTreeView.WebServiceSettings.Method = "GetNodes";
           

            wsTreeview.Controls.Add(radTreeView);
            workspaceDiv.Controls.Add(wsTreeview);

            updatePanel.ContentTemplateContainer.Controls.Add(workspaceDiv);

            return updatePanel;

        }



        private static void LoadRootNodes(RadTreeNode parentNode, TreeNodeExpandMode expandMode)
        {
            
            List<smFolder> folderLst = new smOrganization().GetParentNodes(App.CurrentUserId());

            foreach (smFolder folder in folderLst)
            {
                RadTreeNode node = new RadTreeNode
                                       {
                                           Text = folder.FolderName,
                                           Value = folder.FolderId.ToString(),
                                           ImageUrl = "~/UI/Images/folder.png",
                                           ExpandMode = expandMode
                                       };
                node.Attributes["Type"] = "F";

                parentNode.Nodes.Add(node);
            }
        }


        [WebMethod]
        public static RadTreeNodeData[] GetNodes(RadTreeNodeData node)
        {
           
            List<smWorkspace> childList = new smOrganization().GetChildNodes(Convert.ToInt32(node.Value));

            List<RadTreeNodeData> result = new List<RadTreeNodeData>();

            foreach (smWorkspace nodeChild in childList)
            {

                RadTreeNodeData childNode = new RadTreeNodeData();

                if (nodeChild.File != null)
                {
                    childNode.Text = nodeChild.File.FileName;
                    childNode.Value = nodeChild.File.FileId.ToString();
                    childNode.ImageUrl = "~/UI/Images/folder.png";
                    childNode.ContextMenuID = "DocumentContextMenu";
                    childNode.Attributes["Type"] = "D";
                    childNode.Attributes["path"] = nodeChild.File.FileFullPath;
                    childNode.Attributes["documnetStatus"] = nodeChild.File.DocumentStatusId.ToString();
                    childNode.Attributes["securityLevel"] = nodeChild.File.SecurityLevelId.ToString();
                    childNode.Attributes["AllowEdit"] = false;

                    string extension = Components.CommonFunctions.GetExtensionFile(nodeChild.File.FileFullPath);
                    childNode.ImageUrl = CommonFunctions.GetDocumentIcon(extension);
                    
                }
                else if (nodeChild.Folder != null)
                {
                    childNode.Text = nodeChild.Folder.FolderName;
                    childNode.Value = nodeChild.Folder.FolderId.ToString();
                    childNode.ImageUrl = "~/UI/Images/folder.png";
                    childNode.ContextMenuID = "FolderContextMenu";
                    childNode.Attributes["Type"] = "F";
                    
                }

                childNode.ExpandMode = TreeNodeExpandMode.WebService;
                result.Add(childNode);
            }

            return result.ToArray();
        }


Julyhttp://www.telerik.com/community/forums/aspnet-ajax/treeview/allowedit-ignored-in-radtreeview.aspx
Plamen
Telerik team
 answered on 08 Feb 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?