Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
142 views
I have a treeview with Add/edit/delete context menu items. My problem is I am not able to make the node expanded and selected when I add a child node to aperent node. After adding/editing I am rebinding the treeview using AjaxManager.
Please note that this will have unlimited nodes.

For example,

Node1

- SubNode1

   - SubNode1.1

- SubNode2

- SubNode3

 If I add new node for SubNode1, named SubNode1.1, the focus should be in SubNode1 and it should be expanded to see the new node added.


Any help is greatly appreciated.

Thanx in advance
ASD

Vesko
Top achievements
Rank 2
 answered on 11 Feb 2010
4 answers
277 views
I have a RadGrid that has it's rows and columns being created programatically, and there is a RadAjaxManager that is set to update another Panel on SelectedIndexChange. The RadGrid also has scrolling enabled and multirowselect disabled. The RadGrid operates as supposed to, but as soon as you scroll it starts collecting selected items. I have set break points and verified through watches that SelectedItems.Count grows greater that 1. This also prevents from selecting previous selected rows after you've scrolled. I have tried clearing the selected items in the page unload event, but when it renders it sometimes shows more than one item selected. I say sometimes because it is not consistent with this issue. Only pattern I have noticed is that scrolling starts the problem.

(Edited)
Disregard about the disappearing headers. Just the multiple selections issue now.

I would appreciate any advice on this. I'll include my code as well. Thanks.

P.S.  The code I've included is set up to create text for the columns and rows, so no actual data is needed. You can easily copy and paste the same code to see what I'm seeing.


<rad:RadAjaxManager ID="AjaxManager" runat="server"> 
 <AjaxSettings> 
  <rad:AjaxSetting AjaxControlID="grdCustomerAssignments"> 
   <UpdatedControls> 
    <rad:AjaxUpdatedControl ControlID="grdCustomerAssignments" /> 
   </UpdatedControls> 
  </rad:AjaxSetting> 
  <rad:AjaxSetting AjaxControlID="grdCustomerAssignments"> 
   <UpdatedControls> 
    <rad:AjaxUpdatedControl ControlID="pnlDetails"  /> 
   </UpdatedControls> 
  </rad:AjaxSetting> 
 </AjaxSettings> 
</rad:RadAjaxManager> 
 
<rad:RadGrid ID="grdCustomerAssignments" runat="server" Skin="WebBlue" AutoGenerateColumns="false" AllowMultiRowSelection="false" OnNeedDataSource="grdCustomerAssignments_NeedDataSource" OnSelectedIndexChanged="grdCustomerAssignments_SelectedIndexChanged"> 
     
 <ClientSettings EnablePostBackOnRowClick="true" > 
  <ClientEvents/> 
  <Scrolling AllowScroll="true" ScrollHeight="350" UseStaticHeaders="true" SaveScrollPosition="true" /> 
  <Selecting AllowRowSelect="true" /> 
  <Resizing AllowColumnResize="true" /> 
 </ClientSettings> 
             
 <MasterTableView DataKeyNames="ID" > 
  <HeaderStyle Wrap="false" HorizontalAlign="Center" VerticalAlign="Middle" Font-Bold="true" /> 
  <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false" /> 
  <AlternatingItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false" /> 
                 
  <NoRecordsTemplate> 
    <div style="font-size:80%; color:Maroon;">No Items Were Found</div> 
  </NoRecordsTemplate> 
 
 </MasterTableView> 
                 
</rad:RadGrid> 
 
<asp:Panel ID="pnlDetails" runat="server"> 
 <rad:RadTabStrip ID="tabStrip" runat="server" Align="Justify" AppendDataBoundItems="false" SelectedIndex="0" MultiPageID="multiPage" Skin="WebBlue"> 
  <Tabs></Tabs> 
 </rad:RadTabStrip> 
 <rad:RadMultiPage ID="multiPage" runat="server"></rad:RadMultiPage> 
</asp:Panel> 



protected
 void Page_Init(object sender, EventArgs e) 
{ 
 GetAssignments(); 
 if (!IsPostBack) 
  AddColumnsToGrid(); 
} 
 
protected void Page_Load(object sender, EventArgs e) 
{ 
 tabStrip.Tabs.Clear(); 
 multiPage.Controls.Clear(); 
} 
 
protected void Page_UnLoad(object sender, EventArgs e) 
{ 
 grdCustomerAssignments.MasterTableView.ClearSelectedItems(); 
} 
 
protected void grdCustomerAssignments_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) 
{ 
 grdCustomerAssignments.DataSource = Assignments; 
} 
 
protected void grdCustomerAssignments_SelectedIndexChanged(object sender, EventArgs e) 
{ 
 try 
 { 
  string id = ((RadGrid)sender).SelectedValue.ToString(); 
                 
  DataRow dataRow = null; 
  foreach (DataRow row in Assignments.Rows) 
  { 
   if (row["ID"].ToString() == id) 
    dataRow = row; 
  } 
 
  PopulateAssignmentDetail(dataRow); 
 
 } 
 catch (Exception ex) 
 { 
 
 } 
} 
 
protected void PopulateAssignmentDetail(DataRow dataRow) 
{ 
 // just some code to add details to each tab. 
} 
 
protected void AddColumnsToGrid() 
{ 
 grdCustomerAssignments.MasterTableView.Columns.Clear(); 
 
 for (int i = 1; i < 7; i++) 
 { 
  DataColumn column = Assignments.Columns[i]; 
  if (column.DataType == typeof(Int32)) 
  { 
   GridNumericColumn numericColumn = new GridNumericColumn(); 
   numericColumn.HeaderText = column.ColumnName; 
   numericColumn.DataField = column.ColumnName; 
   grdCustomerAssignments.MasterTableView.Columns.Add(numericColumn); 
  } 
  else if (column.DataType == typeof(DateTime)) 
  { 
   GridDateTimeColumn dateColumn = new GridDateTimeColumn(); 
   dateColumn.HeaderText = column.Caption; 
   dateColumn.DataField = column.ColumnName; 
   dateColumn.DataFormatString = @"{0:MMM dd yyyy}"; 
   grdCustomerAssignments.MasterTableView.Columns.Add(dateColumn); 
  } 
  else 
  { 
   GridBoundColumn boundColumn = new GridBoundColumn(); 
   boundColumn.HeaderText = column.Caption; 
   boundColumn.DataField = column.ColumnName; 
   grdCustomerAssignments.MasterTableView.Columns.Add(boundColumn); 
  } 
 } 
} 
 
private void GetAssignments() 
{ 
 if (Assignments == null) 
  Assignments = new DataTable(); 
 if (TabTitles == null) 
  TabTitles = new Dictionary<string, IList<int>>(); 
 
 try 
 { 
  Assignments.Columns.Add(new DataColumn("ID")); 
  for (int i = 0; i < 50; i++) 
  { 
   Assignments.Columns.Add(new DataColumn("Column" + i.ToString())); 
  } 
   
  int columnIndex = 0; 
  int tabIndex = 0; 
  foreach (DataColumn column in Assignments.Columns) 
  { 
   if (columnIndex > 5) 
   { 
    string fieldCategory = "tab" + tabIndex.ToString(); 
    if (tabIndex == 4) 
     tabIndex = 0; 
    else 
     tabIndex++; 
 
    if (!TabTitles.ContainsKey(fieldCategory)) 
    { 
     IList<int> tmp = new List<int>(); 
     tmp.Add(columnIndex); 
     TabTitles.Add(fieldCategory, tmp); 
    } 
    else 
     TabTitles[fieldCategory].Add(columnIndex); 
   } 
   columnIndex++; 
  } 
 
  for (int j = 0; j < 50; j++) 
  { 
   DataRow row = Assignments.NewRow(); 
   foreach (DataColumn column in Assignments.Columns) 
   { 
    row[column.ColumnName] = column.ColumnName + "Row" + j.ToString(); 
   } 
   Assignments.Rows.Add(row); 
  } 
 
  Assignments.AcceptChanges(); 
 } 
 catch (Exception ex) 
 { 
 
 } 
} 
 
Josh Horton
Top achievements
Rank 1
 answered on 11 Feb 2010
7 answers
191 views
I am using an AdvancedEditTemplate. When the user clicks on the 'Update' button, RadScheduler1_AppointmentCommand gets called. Here I am validating the fields. The screen will go back to the origianl calendar grid view, no matter what. I really need to keep the user on the edit for view, if the validation fails and show them a message. This way the appointment doe not get save, but the user doesn't know what's happening. Any way of doing this?

Thanks a lot

Kati

 

robertw102
Top achievements
Rank 1
 answered on 11 Feb 2010
1 answer
102 views
Hello Telerik Team,

I used RadUpload to upload 5 documents , also added a custom "textbox" called "Title" to each file.
Now, before hitting "Upload" button, I want to make sure that "Tilte" has been entered for each file.

So, I wrote a script function for "OnClientFileselected" , and trying to clear the input when a file is selected 
without entering "Title".
Now, I used the upload.clearFileInputAt method. However, its not working if I give any conditions to clear 
files at specified index like in the below code.

 function clear_file(index) {
            var upload = $find("<%= RadUpload1.ClientID %>");
            var fileInputs = upload.getFileInputs();
            for (var i = 1; i < fileInputs.length; i++) {
                if (i != index) {                    
                }
                else {
                    upload.clearFileInputAt(i);
                }
            }            
        }

I got completely lost, why the condition is not working. If i remove the "if- else" then its working and clearing up all inputs.

Please help me at your earliest convenience.

Thank you,
Bharathi
Vesko
Top achievements
Rank 2
 answered on 11 Feb 2010
11 answers
1.0K+ views
I am trying to create a web service using the demo "Boosting Performance with WebServices". When I try to implement the web service, I keep getting this error.

The type Telerik.Web.UI.RadComboBoxContext is not supported because it implements IDictionary.

Does anyone know how I can get around this or what I am doing wrong from the demo?

Thanks.

using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Web;  
using System.Web.Services;  
using Telerik.Web.UI;  
using System.Collections;  
using System.Runtime.Serialization;  
using System.Runtime.Serialization.Formatters.Soap;  
 
 
namespace testCombo  
{  
    /// <summary>  
    /// Summary description for TestWebService  
    /// </summary>  
    [WebService(Namespace = "http://tempuri.org/")]  
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]  
    [System.ComponentModel.ToolboxItem(false)]  
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.   
    //[System.Web.Script.Services.ScriptService]  
    public class TestWebService : System.Web.Services.WebService  
    {  
          
        [WebMethod]  
        public IEnumerable GetItems(RadComboBoxContext context)  
        {  
            int numberOfItems = 1000;  
            List<ComboBoxItemData> items = new List<ComboBoxItemData>();  
            for (int i = 0; i < numberOfItems; i++)  
            {  
                ComboBoxItemData itemData = new ComboBoxItemData();  
                itemData.Text = "Item " + i;  
                items.Add(itemData);  
            }  
 
            return items;  
        }  
 
 
        class ComboBoxItemData  
        {  
            private string text;  
 
            public string Text  
            {  
                get { return text; }  
                set { text = value; }  
            }  
        }  
 
 
    }  
} 


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="testCombo._Default" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server">  
    <title></title>  
</head> 
<body> 
    <form id="form1" runat="server">  
    <div> 
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
        </telerik:RadScriptManager> 
        <telerik:RadComboBox ID="RadComboBox1" runat="server"   
         EnableLoadOnDemand="true">  
        <ExpandAnimation Type="none" /> 
                    <CollapseAnimation Type="none" /> 
                    <WebServiceSettings Path="TestWebService.asmx" Method="GetItems" /> 
        </telerik:RadComboBox> 
    </div> 
    </form> 
</body> 
</html> 
Rick
Top achievements
Rank 2
 answered on 11 Feb 2010
2 answers
207 views
I can format the items using the following code:
 protected void RadGrid1_ExcelExportCellFormatting(object source, ExcelExportCellFormattingEventArgs e)  
    {  
        GridDataItem item = e.Cell.Parent as GridDataItem;  
 
        item.Style["background-color"] = "#ffffff";  
        item.Style["font-size"] = "11px";  
        item.Style["font-family"] = "Verdana";  
} 

How do I format the footer and my grouped headers?
Mike
Top achievements
Rank 1
 answered on 11 Feb 2010
1 answer
98 views
Hello
I have a problem with the grid.
I want to give the user can decide how the results have on the page.
I want always the height of the grid will be fixed, and will change following the results page.
If the user chooses, for example 50 per page. Added scroll record.

How do you do? Please!
Dimo
Telerik team
 answered on 11 Feb 2010
3 answers
116 views
Howdy,

I am trying to create my TreeView's context menu after the TreeView has been bound and do so on the server.  I am running into an issue however.  The code below results in an empty Items collection on the contextMenu object.  If I break in the code, after the DataBind(), I can see that the DataSource on the contextMenu has a collection of objects, but nothing is in the Items collection.  Therefor, there is no context menu once the page renders.

    protected void tabTreeView_OnDataBound(object sender, EventArgs e) 
    { 
        RadTreeViewContextMenu contextMenu = new RadTreeViewContextMenu(); 
 
        contextMenu.DataFieldID = "MenuItemId"; 
        contextMenu.DataFieldParentID = "ParentId"; 
        contextMenu.DataTextField = "DisplayText"; 
        contextMenu.DataValueField = "DisplayText"; 
        contextMenu.DataSource = this.GetUnusedMenuItems(); 
        contextMenu.DataBind(); 
 
        tabTreeView.ContextMenus.Add(contextMenu); 
    } 

Why is the Items collection not being populated when I call DataBind?  I can load the items in manually with a foreach loop (tested it and it works fine), but I didn't want to have to figure out the underlying hierarchy (the menu items I am using can be nested).

Thanks for any help,
Seth
Veselin Vasilev
Telerik team
 answered on 11 Feb 2010
1 answer
198 views
Hi

When using the JAWS screen reading software drop down menus are not read. Is there any way to make JAWS read each menu item when the drop down button is pressed? I know that javascript is used to display the div that contains the menu items, I have a feeling this is the problem.

Thanks

Antony
T. Tsonev
Telerik team
 answered on 11 Feb 2010
1 answer
116 views
Hello, I have a custom dropdown column editor that implements the GridDropDownColumnEditor using a RadComboBox.  Also, I am using an autogenerated popup edit form where that custom editor is working perfectly.  However the OnComboBind and DataBind subs of my custom dropdown editor are empty but, nevertheless, as I said, the dropdown is working perfectly... How come?? Where does the RadGrid binds it?? Is there any special setting I have missed that does this without the need of defining the OnComboBind and DataBind subs?? For what is the OnComboBind() for?? I have done a lot of research trying to find what does this procedure do but haven't found anything about it yet.

Thank you for your help.
Manuel
Radoslav
Telerik team
 answered on 11 Feb 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?