Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
149 views
hi,

im using telerik grid, when i want to add a record it displays cancel link in commanditemtemplate column.

i don't want to display that cancel link when adding a record.

how can i get the id of that linkbutton id to visible false.
Daniel
Telerik team
 answered on 20 Aug 2008
3 answers
146 views
Hi,
i am starting a project with two trees on one page, with both drag and drop enabled. It should be possible to drag and drop from one tree to the other one and copy or move the subtrees. Multiselect should be enabled too and no postbacks are allowed.
The trees will have an nodecount up to 6000 nodes.
The tree will be loaded from xml out of an database. There will be an save-button to persist the changes in the tree to the xml / database.
Can someone give me an hint ho to realize this?

Is it possible to use loadondemand with serverclientcallback and draganddrop?
Should i user serverside loadondemand and put the two trees inside updatepanels?
Or should i use clientside dragDrop?
What combination of drag and drop, load on demand and updatepanels is the best for this scenario?

Thank you very much
Christian
Veselin Vasilev
Telerik team
 answered on 20 Aug 2008
1 answer
165 views
Hi,
i am using something like this..
<telerik:RadSplitter ID="RadSplitter1" runat="server">
    <telerik:RadPane ID="RadPane1" runat="server">
        <telerik:RadToolBar ID="RadToolBar1" runat="server" Skin="WebBlue"
        Width="100%" OnButtonClick="ToolbarButtonCommand">
            <Items>
                <telerik:RadToolBarButton runat="server"
                    NavigateUrl="~/Membership/NewUser.aspx" Text="New">
                </telerik:RadToolBarButton>
            </Items>
        </telerik:RadToolBar>
        </div>       
        <telerik:RadGrid ID="UsersGrid" runat="server" DataSourceID="dsUsers"
            Skin="Outlook" AutoGenerateColumns="False" AllowPaging="True"
.........................................
my problem is in firefox or radpane that is dynamicly managed by javascript (sized). Now, internal toolbar is causing problems, and resizes only to width of RadPane, that is only initial and not real because of datagrid that goes into overflow area.

Is there any workaround for this? and what do u suggest?

I am experienced with frontend coding and i would like to know, do u in future plan to move to full tableless CSS design because i saw that many of controls (almost most of them) use tables! (this is really bad and doesn't render anywhere correctly).
Yana
Telerik team
 answered on 20 Aug 2008
2 answers
315 views
I have a page where I don't need a visual grid, but just want to programmatically create a RadGrid so I can use its export to ExcelML function.  I am getting "RadGrid must be databound before exporting."  I am calling DataBind(), so I really must be missing something simple here.  Any suggestions?


        protected void btnExport_Click(object sender, ImageClickEventArgs e) 
        { 
            DataTable dtExport = ExecTools.General.GetResCodeTreeExport(Application["ExecData"].ToString()); 
            Telerik.Web.UI.RadGrid ExportGrid = new RadGrid(); 
            ExportGrid.AutoGenerateColumns = true; 
            ExportGrid.DataSource = dtExport; 
            ExportGrid.DataBind(); 
            ExportGrid.ExportSettings.Excel.FileExtension = "xls"; 
            ExportGrid.ExportSettings.FileName = "ResCodes"; 
            ExportGrid.ExportSettings.ExportOnlyData = true; 
            ExportGrid.ExportSettings.IgnorePaging = false; 
            ExportGrid.ExportSettings.OpenInNewWindow = true; 
            ExportGrid.ExportSettings.Excel.Format = GridExcelExportFormat.ExcelML; 
            ExportGrid.MasterTableView.ExportToExcel(); 
        } 
 

Michael
Top achievements
Rank 1
 answered on 20 Aug 2008
1 answer
53 views

one a use the code 

RadToolTipManager1.TargetControls.Add(lblLink.ClientID, IDPessoa,

true);

the  HyperLink that surround the target object becomes unclicable.

other problem that  have is that when i positon the tolltip to be in the topleft of the element it comes out in the wrong position

Princy
Top achievements
Rank 2
 answered on 20 Aug 2008
4 answers
172 views
I am grouping vertically in the TimelineView so that I have a List of employees on the left hand side. Some of the Employee names are too long for the default column width. How do I add nowrap to this column and make sure all of the Timeslot columns line up?

cheers,

Steve
Steve
Top achievements
Rank 1
 answered on 20 Aug 2008
2 answers
147 views
How can I set the focus onto the texteditor of the editor. The old Editor from Q2 2007 had an autofocus option which worked perfectly but cannot be adapted to the latest version of the Radeditor.
Radeditor1.Focus() in the preRender didnt work.

in Javascript

var

focussedEditor = $find("<%=Radeditor1.ClientID %>");

focussedEditor.setFocus();

Kind of worked but it sets the entire editor into focus and not exclusively the textfield.

What I would like to achieve is that when the editor is loaded the cursor would be in the textfield and the user can start typing instantly.
sohrab
Top achievements
Rank 1
 answered on 20 Aug 2008
4 answers
121 views
I have implemented the RadEditorProvider in a dotnetnuke 4.8.4 installation.
I though everything went perfectly until I tested the editing of profiles.
When trying to edit my profile I get the following error(Since I have implemented the RadEditorProvider):
The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.

Here is a link to someone who posted the same problem in the dotnetnuke forum but hasn't got a solution yet.
http://www.dotnetnuke.com/Community/Forums/tabid/795/forumid/108/postid/248730/scope/posts/Default.aspx


Can you help me out with this?

Steven
Top achievements
Rank 2
 answered on 20 Aug 2008
1 answer
121 views

Property  RadDockableObjectCommand is not present in Q2 2008. Is there any equivalent for the same.
To add more details I have the following line of code

RadDockableObjectCommand dockCommand = new RadDockableObjectCommand("Delete", "Delete", "DeleteBtn.gif", true);

Obi-Wan Kenobi
Top achievements
Rank 1
 answered on 20 Aug 2008
3 answers
291 views
   public partial class _Default : System.Web.UI.Page 
    { 
        protected void Page_Load(object sender, EventArgs e) 
        { 
            if (!Page.IsPostBack) 
            { 
                Calendar.SelectedDate = DateTime.Now; 
              
            } 
 
 
        } 
 
        private void GetDays() 
        { 
             
        } 
 
        private void CreateSelectedCollection(Telerik.Web.UI.Calendar.Collections.DateTimeCollection coll, bool rebindgrid) 
        { 
 
            Dictionary<DateTime, Entry> dict = new Dictionary<DateTime, Entry>(); 
 
            StringBuilder b = new StringBuilder(); 
            for (int i = 0; i < coll.Count; i++) 
            { 
                dict.Add(coll[i].Date, new Entry(coll[i].Date, true, -1)); 
 
                b.Append("'"); 
                b.Append(coll[i].Date.ToString("yyyy-MM-dd")); 
                b.Append("'"); 
                if (i != coll.Count - 1) 
                    b.Append(","); 
            } 
            checkdates(b.ToString(), dict, rebindgrid); 
        } 
 
        private void checkdates(string p, Dictionary<DateTime, Entry> dict, bool rebindgrid) 
        { 
            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["TimesheetConnectionString"].ConnectionString)) 
            { 
                conn.Open(); 
                SqlCommand comm = new SqlCommand("SELECT * FROM tblEntries WHERE Date IN( " + p + " )", conn); 
                SqlDataReader reader = comm.ExecuteReader(); 
 
                while (reader.Read()) 
                { 
                    if (dict.ContainsKey((DateTime)reader["Date"])) 
                    { 
                        dict[(DateTime)reader["Date"]].From = (DateTime)reader["From_"]; 
                        dict[(DateTime)reader["Date"]].To = (DateTime)reader["To_"]; 
                        dict[(DateTime)reader["Date"]].IsNewRecord = false; 
                        dict[(DateTime)reader["Date"]].ID = int.Parse(reader["ID"].ToString()); 
                    } 
 
                } 
            } 
            grid.DataSource = dict.Values; 
 
            if (rebindgrid) 
                grid.Rebind(); 
        } 
 
        protected void update(object source, Telerik.Web.UI.GridCommandEventArgs e) 
        {  
            Hashtable t = new Hashtable(); 
 
            GridEditableItem editedItem = e.Item as GridEditableItem; 
 
            e.Item.OwnerTableView.ExtractValuesFromItem(t, editedItem); 
 
 
        } 
 
 
        protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) 
        { 
            if (e.CommandName == "UpdateAll") 
            { 
                foreach (GridEditableItem editedItem in grid.EditItems) 
                { 
                    Hashtable newValues = new Hashtable(); 
 
                    e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem); 
 
                    updateorinsert((string)newValues["To"], (string)newValues["From"], (bool)newValues["IsNewRecord"], (string)newValues["Date"], (string)newValues["ID"]); 
 
                    editedItem.Edit = false; 
                } 
            } 
            grid.Rebind(); 
        } 
 
        private void updateorinsert(string to, string from, bool isnew, string date, string id) 
        { 
 
            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["TimesheetConnectionString"].ConnectionString)) 
            { 
 
                conn.Open(); 
 
 
                if ((isnew)) 
                { 
                    SqlCommand comm = new SqlCommand("INSERT INTO tblEntries (Date, To_, From_) VALUES (@Date, @To, @From)", conn); 
                    comm.Parameters.AddWithValue("@Date", DateTime.Parse(date).ToString("yyyy-MM-dd")); 
                    comm.Parameters.AddWithValue("@To", DateTime.Parse(to).ToString("yyyy-MM-dd HH:mm")); 
                    comm.Parameters.AddWithValue("@From", DateTime.Parse(from).ToString("yyyy-MM-dd HH:mm")); 
                    int result = comm.ExecuteNonQuery(); 
 
                } 
                else 
                { 
 
                    SqlCommand comm = new SqlCommand("UPDATE tblEntries SET Date = @Date, To_ = @To, From_ = @From WHERE ID = @Id", conn); 
 
                    comm.Parameters.AddWithValue("@Date", DateTime.Parse(date).ToString("yyyy-MM-dd")); 
                    comm.Parameters.AddWithValue("@To", DateTime.Parse(to).ToString("yyyy-MM-dd HH:mm")); 
                    comm.Parameters.AddWithValue("@From", DateTime.Parse(from).ToString("yyyy-MM-dd HH:mm")); 
                    comm.Parameters.AddWithValue("@Id", int.Parse(id)); 
 
                    int result = comm.ExecuteNonQuery(); 
 
                } 
 
                conn.Close(); 
            } 
        } 
 
 
        TimeSpan a; 
        protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
        { 
 
            if (e.Item is GridDataItem) 
            { 
 
 
                GridDataItem dataItem = e.Item as GridDataItem; 
                TimeSpan tmp; 
                if (TimeSpan.TryParse(dataItem["Span"].Text, out tmp)) 
                    a += (tmp); 
            } 
            if (e.Item is GridFooterItem) 
            { 
                GridFooterItem footerItem = e.Item as GridFooterItem; 
                footerItem["Span"].Text = "total: " + a.Hours + " h" + a.Minutes + " m"; 
            } 
        } 
 
        protected void RadGrid1_PreRender(object sender, System.EventArgs e) 
        { 
            // Force all rows to be in edit mode (rebind is called)  
 
            foreach (GridItem item in grid.MasterTableView.Items) 
                { 
                    if (item is GridEditableItem) 
                    { 
                        GridEditableItem editableItem = item as GridDataItem; 
                        editableItem.Edit = true; 
                    } 
                } 
                grid.Rebind(); 
             
        } 
 
 
        /// <summary> 
        /// Needdatasource event handler 
        /// </summary> 
        /// <param name="source"></param> 
        /// <param name="e"></param> 
         
        protected void need(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) 
        { 
             
 
             CreateSelectedCollection(Calendar.SelectedDates, false); 
 
             
        } 
 
     
        /// <summary> 
        /// Dateselected event handler 
        /// </summary> 
        /// <param name="sender"></param> 
        /// <param name="e"></param> 
        protected void fire(object sender, SelectedDatesEventArgs e) 
        { 
             
            
             CreateSelectedCollection(e.SelectedDates, true); 
        } 
 
 
        //protected void save() 
        //{ 
        
 
        //} 
 
 
 
 
 
    } 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AJAXEnabledWebApplication1._Default" %> 
<%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" %>  
<!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>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server"> 
        <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
    <div> 
     
      <asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true"> 
    
            <ContentTemplate> 
             
    <telerik:RadCalendar MultiViewColumns="6"  AutoPostBack="true" runat="server" ID="Calendar" UseColumnHeadersAsSelectors="false" UseRowHeadersAsSelectors="true" OnSelectionChanged="fire"    ShowRowHeaders="true" EnableMultiSelect="true"   /> 
     
    </ContentTemplate> 
    </asp:UpdatePanel> 
     
     
     
      
    
 
        <asp:UpdatePanel runat="server" ChildrenAsTriggers="true"> 
   
            <ContentTemplate> 
                <telerik:RadGrid  Skin="Vista" OnItemDataBound="RadGrid1_ItemDataBound" ShowFooter="true" AllowSorting="true" 
                    OnItemCommand="RadGrid1_ItemCommand" OnPreRender="RadGrid1_PreRender" OnNeedDataSource="need" 
                      OnUpdateCommand="update" AutoGenerateColumns="false" runat="server" ID="grid" 
                    AllowMultiRowEdit="true"> 
                     
                     
                    <ExportSettings> 
                        <Excel FileExtension="xls" Format="ExcelML" /> 
                        <Csv FileExtension="txt" RowDelimiter="NewLine" ColumnDelimiter="semicolon" /> 
                        <Pdf Title="Timerapport" Producer="TimeSys" PaperSize="a4" PageTitle="TimeRapport" 
                            AllowPrinting="true" AllowCopy="true" AllowAdd="true" FontType="Embed" /> 
                    </ExportSettings> 
                    <MasterTableView EditMode="inplace" CommandItemDisplay="topAndBottom"> 
                        <Columns> 
                            
                            <telerik:GridDateTimeColumn DataField="Date" HeaderText="Dato" ReadOnly="false"> 
                            </telerik:GridDateTimeColumn> 
                            <telerik:GridDateTimeColumn DataField="From" HeaderText="Fra" PickerType="TimePicker"> 
                            </telerik:GridDateTimeColumn> 
                            <telerik:GridDateTimeColumn  DataField="To" HeaderText="Til" PickerType="TimePicker"> 
                            </telerik:GridDateTimeColumn> 
                            <telerik:GridCheckBoxColumn ReadOnly="false" DataField="IsNewRecord" Visible="false" /> 
                            <telerik:GridBoundColumn ReadOnly="false" DataField="ID" Visible="false" /> 
                            <telerik:GridBoundColumn ReadOnly="true" DataField="Span" UniqueName="Span"  Visible="true" HeaderText="Antall timer" /> 
                            <telerik:GridTemplateColumn DataField="TimeSp"> 
                                <ItemTemplate> 
                                    <asp:Literal Text='<%# Eval("TimeSp") %>' runat="server" /> 
                                </ItemTemplate> 
                                <FooterTemplate> 
                                </FooterTemplate> 
                            </telerik:GridTemplateColumn> 
                        </Columns> 
                        <CommandItemTemplate> 
                            <asp:Button runat="server" ID="UpdateAll" Text="Update 
All" CommandName="UpdateAll" />                 
                      
                        </CommandItemTemplate> 
                    </MasterTableView> 
     
    </telerik:RadGrid> 
    </ContentTemplate> 
     
    </asp:UpdatePanel> 
     
     
     
    </div> 
    </form> 
</body> 
</html> 
 

Hello, I'm creating a small timesheet application, it has a custom total row which sums up the rows in the grid. The problem is that even though the itemdatabound event is fired, the .Text property is empty so i end up getting the wrong totals.

Missing User
 answered on 20 Aug 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?