Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
48 views
Hello!

Today I took a "deep" look into the javascript methods, expandos, etc. of the radgrid control. There I found different methods, that are very interesting to me (in grouping and navigation with keys scenario ==> excel-like style), for example

var radGrid = $find(radGridId).get_masterTableView()._getNextDataRow()

I can see, that this methods needs a argument "a" (see attached png-File), but I don't know what type of argument and where I should get it then. Can anyone help me?

Generally: Is there a documentation of all these telerik-javascript-things, where this is all explained (I'm not an javascript expert)? Is there a pattern for the arguments, because as you can see in the picture, there are many methods, which need different arguments (b, f, etc.)?

Please help me.

Bye

Michael
Marin
Telerik team
 answered on 21 Jan 2011
3 answers
87 views
Hi,

Is there a way to invoke the image manager dialog without radeditor on a page?

I have been asked to create a gallery like application and using the image manager (more specifically the editor) would be a good place to start.

Ideally I only need the image editor and it would be even better if I could also lock down the size of the crop box as I have all the upload and thumnailing code in place.

The workflow they would like is.

Type in a title for the image (this is db stored)
Type in a description for the image (this is db stored)
Select image to upload
Ability to crop the image (this is where I would like Image Editor) Image sizes are specific so if possible I would like to lock down the size of the crop box.

I already have thumbnail and dropshadow code in place and db.

Thanks
Dobromir
Telerik team
 answered on 21 Jan 2011
3 answers
87 views
I want to do :
===========================================================================
I make a page , in this sample : Default.aspx 
===========================================================================
function getGData(){
        var that = this;
        //debugger;
         var url = "GetDateTimePicker.aspx";
            // The request size requires a post
         $.post(url, function (html) {
             debugger;
             $('#DateTimeContainer').html(html);
         });
        }
==========================================================================
When click GetDataHTMLButton (Default.aspx), I call getGData() to fetch HTLM return by GetDateTimePicker.aspx 
and fetch result to DateTimeContainer(Default.aspx)
Code for GetDateTimePicker.aspx 
===========================================================================
protected override void OnPreRenderComplete(EventArgs e)
        {
            base.OnPreRenderComplete(e);
            Context.Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));
            Context.Response.Cache.SetCacheability(HttpCacheability.Public);
            string returnString = ConvertControlToHtml(tekDateTimePicker);//GridTest this.gridResults
            Context.Response.Write(returnString);
            Context.Response.End();


        }
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            if (!this.tekDateTimePicker.RegisterWithScriptManager)
            {
                ScriptManager scrip = this.Page.FindControl("ScriptManager") as ScriptManager;
            }


        }
        protected override void Render(HtmlTextWriter writer)
        {
            base.Render(writer);
        }
        public string ConvertControlToHtml(Control selectedControl)
        {
            StringBuilder sb = new StringBuilder();
            using (StringWriter sw = new StringWriter(sb))
            {
                using (HtmlTextWriter textWriter = new HtmlTextWriter(sw))
                {
                    try
                    {
                        selectedControl.RenderControl(textWriter);
                    }
                    catch (Exception e)
                    {
                        System.Console.Write(e);
                    }
                }
            }
             return sb.ToString();
        }
===========================================================================
But the result not include CSS and Script with event for the buttons.
Please download this file  MyTestSolution  (Sorry I can't attact my File)

I'm using "Telerik.Web.UI" vesion "2009.3.1103.35"

Thanks
ThangLuu - Bamboo





Luu
Top achievements
Rank 1
 answered on 21 Jan 2011
1 answer
98 views
how do i change the skin of radGrid through javascript..
Please help
Veli
Telerik team
 answered on 21 Jan 2011
1 answer
44 views
Hi,

On Linux OS and Chrome browser, Select files button is not appearing. When we click on the button place, it works fine. Please check attached screen shot.

Thanks & Regards
Sanjivani
Sanjivani
Top achievements
Rank 1
 answered on 21 Jan 2011
1 answer
67 views
Hi Community,

I have to say, that I love the amount of functionality of the RAD Editor and the documentation, but I've got a huge problem and I hope to get help here.
I wanted to deploy the RAD Editor for MOSS 2007. I made several changes in several files. Nothing special and all documented by the documentation of Telerik. I made some changes in the ToolsFile.xml. New Buttons, restricted Colors... Everythings works fine. The main changes that cause the failure are documented here:

ConfigFile.xml
<configuration>
    <property name="ToolbarMode">ShowOnFocus</property>
    <property name="ToolsWidth">520px</property>
    <property name="OnClientLoad">OnClientLoad</property>
</configuration>

MOSSEditorTools
function OnClientLoad(editor, args)
{
    var style = editor.get_contentArea().style;
    style.fontFamily = "Verdana";
    style.fontSize = "0.7em";
}
 
Telerik.Web.UI.Editor.CommandList["LineDistance1"] = function(commandName, editor, args)
{
    var sel = editor.getSelectionHtml();
    editor.pasteHtml('<span style="line-height:1em;">' + sel + '</span>');
}
 
Telerik.Web.UI.Editor.CommandList["LineDistance15"] = function(commandName, editor, args)
{
    var sel = editor.getSelectionHtml();
    editor.pasteHtml('<span style="line-height:1.5em;">' + sel + '</span>');
}
 
Telerik.Web.UI.Editor.CommandList["LineDistance2"] = function(commandName, editor, args)
{
    var sel = editor.getSelectionHtml();
    editor.pasteHtml('<span style="line-height:2em;">' + sel + '</span>');
}


ToolsFile.xml
<tools>
    <tool name="Bold" shortcut="CTRL+B"/>
    <tool name="Italic" shortcut="CTRL+I"/>
    <tool name="Underline" shortcut="CTRL+U"/>
    <tool name="StrikeThrough" />
    <tool separator="true"/>
    <tool name="JustifyLeft" />
    <tool name="JustifyCenter" />
    <tool name="JustifyRight" />
    <tool name="JustifyFull" />
    <tool name="JustifyNone" />
    <tool separator="true"/>
    <tool name="LineDistance1" />
    <tool name="LineDistance15" />
    <tool name="LineDistance2" />
    <tool separator="true"/>
    <tool name="Indent" />
    <tool name="Outdent" />
    <tool separator="true"/>
    <tool name="InsertOrderedList" />
    <tool name="InsertUnorderedList" />
    <tool name="ToggleTableBorder" />
    <tool separator="true"/>
    <tool name="SelectAll" shortcut="CTRL+A"/>
  </tools>


This works fine in my image but when I deploy it on my test system nothing works. You can't even save your changes. The RAD Editor doesn't work anymore. And furthermore if I remove the lines from the MOSSEditorTools.js it works fine.
Can anybody help?
Stanimir
Telerik team
 answered on 21 Jan 2011
3 answers
93 views
Hi,

I am using the Inline insert and update feature of RadGrid, I have to validate the values entered if its blank i have to set the old value. Pls help me how to go about it.

regards
Jidesh
Veli
Telerik team
 answered on 21 Jan 2011
1 answer
72 views

I am using RarGrid on Sharepoint 2010 webparts. I am geeitng below error message during sorting/paging/filtering/conext menu.

I am using asp:scriptmanager and grid mapped with asp:scriptmanager.

 

I am getting The Controls collection cannot be modified because the control contains code blocks <% %>

Thanks,

Pavlina
Telerik team
 answered on 21 Jan 2011
3 answers
80 views
Hi

I am attempting to register the RadUpload control to an image button event.

Currently, I have the image button in place and I have created a separate page with the RadUpload control registered and I will be using an iframe to render in the background without being shown to the user.

I want the image button to open the actual file selection (browse button) from the image press, allow the user to select a file and pass this back to the originating page.

Is there a JavaScript method I can access that will allow me to do this?

Currently I have (Ignore the implicit drill down to the control, I am going to create a loop to find the "ruButton ruBrowse" class) :
$find('cRadUpload').get_element().getElementsByTagName('ul')[0].getElementsByTagName('li')[0].getElementsByTagName('input')[0].click();

But the image button does nothing when clicked...

Regards,
Jonathan
Dimitar Terziev
Telerik team
 answered on 21 Jan 2011
1 answer
138 views
Hello!

I want to use the radgrid control in excel-style like it is explained under http://www.telerik.com/community/code-library/aspnet-ajax/grid/excel-like-radgrid.aspx. I use the sample version 193898_excellikegrid.zip. I tested it with the actual version of the control/suite and it works fine.

It goes in the right the direction, but I want one further step: I want to achieve an excel-syle grid with grouping (one group level). Here is my code:

Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="RadGridTest._Default" Trace="true" TraceMode="SortByTime" Debug="true" %>
  
<%@ 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">
  
<head runat="server">
    <title>RadGridTest</title>
    <script src="scripts.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
        <%--<asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>--%>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
            </Scripts>
        </telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <div>
            <telerik:RadGrid ID="RadGrid1" runat="server" Skin="Simple" Width="100%"
                OnPreRender="RadGrid1_PreRender" OnDataBinding="RadGrid1_DataBinding" 
                OnNeedDataSource="RadGrid1_NeedDataSource">
                <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
                <MasterTableView GridLines="Both" ShowHeader="true" TableLayout="Fixed" AutoGenerateColumns="true" Width="3000px"
                    EditMode="InPlace" >  
                  
                    <GroupByExpressions>
                        <telerik:GridGroupByExpression>
                            <SelectFields>
                                <telerik:GridGroupByField HeaderText="Department" FieldName="department"></telerik:GridGroupByField>
                            </SelectFields>
                            <GroupByFields>
                                <telerik:GridGroupByField FieldName="department" SortOrder="Ascending"></telerik:GridGroupByField>
                            </GroupByFields>
                        </telerik:GridGroupByExpression>
                    </GroupByExpressions>
                  
                    <Columns>
                        <telerik:GridBoundColumn HeaderText="id" DataField="id" UniqueName="id">
                            <HeaderStyle Width="30px" BackColor="DarkGray"/>
                            <ItemStyle Width="30px" BackColor="DarkGray"/>
                        </telerik:GridBoundColumn>
                          
                        <telerik:GridBoundColumn HeaderText="Department" DataField="department" UniqueName="department" Visible="false">
                            <HeaderStyle Width="150px" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>
                          
                        <telerik:GridBoundColumn HeaderText="Firstname" DataField="firstname" UniqueName="firstname">
                            <HeaderStyle Width="150px" BackColor="DarkGray"/>
                            <ItemStyle Width="150px" BackColor="DarkGray"/>
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Lastname" DataField="lastname" UniqueName="lastname">
                            <HeaderStyle width="150px" BackColor="DarkGray"/>
                            <ItemStyle Width="150px" BackColor="DarkGray"/>
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Street" DataField="street" UniqueName="street">
                            <HeaderStyle width="250px" />
                            <ItemStyle Width="250px" />
                        </telerik:GridBoundColumn>         
                        <telerik:GridBoundColumn HeaderText="Number" DataField="number" UniqueName="number">
                            <HeaderStyle width="150px" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>   
                        <telerik:GridBoundColumn HeaderText="Zip" DataField="zip" UniqueName="zip">
                            <HeaderStyle width="150px" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>            
                        <telerik:GridBoundColumn HeaderText="City" DataField="city" UniqueName="city">
                            <HeaderStyle width="150px" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Phone" DataField="phone" UniqueName="phone">
                            <HeaderStyle width="150px" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Fax" DataField="fax" UniqueName="fax">
                            <HeaderStyle width="150px" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Mobile" DataField="mobile" UniqueName="mobile">
                            <HeaderStyle width="150px" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="E-Mail" DataField="email" UniqueName="email">
                            <HeaderStyle width="250px" />
                            <ItemStyle Width="250px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Hired" DataField="hired" UniqueName="hired">
                            <HeaderStyle width="150px" />
                            <ItemStyle Width="150px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn HeaderText="Comment" DataField="comment" UniqueName="comment">
                            <HeaderStyle Wrap="false" />
                            <ItemStyle Wrap="false" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="dummy">
                            <HeaderStyle Width="1px" />
                            <ItemStyle Width="1px" />
                        </telerik:GridBoundColumn>
                    </Columns>
                </MasterTableView>
                <ClientSettings>
                    <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True" ScrollHeight="150px" FrozenColumnsCount="4">
                    </Scrolling>
                </ClientSettings>
                <FilterMenu EnableImageSprites="False"></FilterMenu>
            </telerik:RadGrid>
        </div>
    </form>
</body>
</html>

Default.aspx.cs
using System;
using System.Text;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Telerik.Web.UI;
  
  
namespace RadGridTest
{
    public partial class _Default : System.Web.UI.Page
    {
  
        private readonly string GRID_SOURCE_SESSION_KEY = "GRID_SOURCE_SESSION_KEY";
          
        private DataTable GridSource
        {
            get
            {
  
                Object obj = Session[GRID_SOURCE_SESSION_KEY];
                if (obj != null)
                {
                    return (DataTable)obj;
                }
                else
                {
  
                    DataTable dt = new DataTable();
                    dt.Columns.Add("id");
                    dt.Columns.Add("department");
                    dt.Columns.Add("firstname");
                    dt.Columns.Add("lastname");
                    dt.Columns.Add("street");
                    dt.Columns.Add("number");
                    dt.Columns.Add("zip");
                    dt.Columns.Add("city");
                    dt.Columns.Add("phone");
                    dt.Columns.Add("fax");
                    dt.Columns.Add("mobile");
                    dt.Columns.Add("email");
                    dt.Columns.Add("birthday");
                    dt.Columns.Add("hired");
                    dt.Columns.Add("comment");
  
                    DataRow dr1 = dt.NewRow();
                    dr1["id"] = 1;
                    dr1["department"] = "IT";
                    dr1["firstname"] = "Test";
                    dr1["lastname"] = "Test";
                    dr1["comment"] = "This is a test.";
                    dt.Rows.Add(dr1);
  
                    DataRow dr2 = dt.NewRow();
                    dr2["id"] = 2;
                    dr2["department"] = "IT";
                    dr2["firstname"] = "Test";
                    dr2["lastname"] = "Collins";
                    dr2["comment"] = "Test";
                    dt.Rows.Add(dr2);
  
                    DataRow dr3 = dt.NewRow();
                    dr3["id"] = 3;
                    dr3["department"] = "Controlling";
                    dr3["firstname"] = "Test";
                    dr3["lastname"] = "Test";
                    dr3["comment"] = "...";
                    dt.Rows.Add(dr3);
  
                    DataRow dr4 = dt.NewRow();
                    dr4["id"] = 4;
                    dr4["department"] = "Sales";
                    dr4["firstname"] = "Steve";
                    dr4["lastname"] = "Test";
                    dr4["comment"] = "";
                    dt.Rows.Add(dr4);
  
                    DataRow dr5 = dt.NewRow();
                    dr5["id"] = 5;
                    dr5["department"] = "Purchasing Dep.";
                    dr5["firstname"] = "Michael";
                    dr5["lastname"] = "Smith";
                    dr5["comment"] = "Blablabla";
                    dt.Rows.Add(dr5);
  
                    DataRow dr6 = dt.NewRow();
                    dr6["id"] = 6;
                    dr6["department"] = "Purchasing Dep.";
                    dr6["firstname"] = "Tom";
                    dr6["lastname"] = "Jerry";
                    dr6["comment"] = "Alles wird gut!!";
                    dt.Rows.Add(dr6);
  
                    Session[GRID_SOURCE_SESSION_KEY] = dt;
  
                    return dt;
                }
            }
        }
  
        protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            RadGrid1.DataSource = GridSource;
        }
  
        protected void RadGrid1_DataBinding(object sender, EventArgs e)
        {
            for (int i = 0; i < GridSource.Rows.Count; i++)
            {
                RadGrid1.EditIndexes.Add(i);
            }
        }
  
        protected void RadGrid1_PreRender(object sender, EventArgs e)
        {
            RadGrid1.Attributes.Add("onkeydown", "onKeyDown(this,event);");
            int itemsCount = 0;
            int columnsCount = 0;
            StringBuilder builder = new StringBuilder();
            // Attach the event handlers to the client side events of the TextBoxes. 
            foreach (GridDataItem item in RadGrid1.MasterTableView.Items)
            {
                if (item is GridDataItem)
                {
                    columnsCount = 0;
                    for (int i = 3; i < RadGrid1.MasterTableView.RenderColumns.Length; i++)
                    {
                        GridColumn column = RadGrid1.MasterTableView.RenderColumns[i];
                        TextBox textBox = (item[column.UniqueName].Controls[0]) as TextBox;
                        if (textBox != null)
                        {
                            textBox.Attributes.Add("ondblclick", "cellDoubleClickFunction('" + textBox.ClientID + "');");
                            textBox.Attributes.Add("onclick", "cellClick('" + textBox.ClientID + "');");
                        }
                        if (i == 2)
                        {
                            textBox.ReadOnly = true;
                            textBox.Attributes.Add("class", "readOnly");
                        }
                        columnsCount++;
                    }
                    itemsCount++;
                }
            }
            RadScriptManager.RegisterStartupScript(Page, Page.GetType(), "init", "colls = " + columnsCount + ";rows=" + itemsCount + ";", true);
        }
  
    }
}

My problem is, that I get an error after the method "RadGrid1_DataBinding" is done: System.ArgumentoutOfRangeException.

[ *** I think, that the grouping thing is the key like putting the items of a hierarchy RadGrid in edit mode (http://www.telerik.com/community/forums/aspnet-ajax/grid/how-to-put-the-grid-items-of-a-hierarchy-model-radgrid-in-edit-mode.aspx). ***]

==> it is not: the problem is, that I don't use AutoGeneratedColumns and I can'/don't want to use them. When I change my code, the page loads.

How must I change the code, that it will work with AutoGeneratedColumns = false???

And then it goes on:
With the excel-like RadGrid sample, the user can - for example - use the arrow keys and the tab key for navigation. When there are group rows and group footers, is there a way to recognize this, so that this rows can be skipped?

With my code, the javascript does not work as expected!?!?

Kind regards

Michael
Radoslav
Telerik team
 answered on 21 Jan 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?