Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
152 views
I want to create custom command without creating a custom tool.
I want to create custom command like InsertCleanParagraph which will be executed when user press the Ctrl+Enter.

The rad editor has  NewLineBr="false"

So when I press Ctrl+Enter in RAD editor it should insert
<p style="clear:both"></p>

When I press Shift+Enter it should insert
<br/>   Which is done by default command InsertParagraph

But I don't want any tool button to appear for this new command.

Please tell me how can I do this.
Rumen
Telerik team
 answered on 28 May 2009
1 answer
169 views
I'm using version 2009.1.311.35 of the RadGrid control. I have the grid configured to obtain the datasource from a web service and reorder columns on the client. Upon reordering the columns, the column header and data are reordered. When I go to another page of data, however, the header remains reordered, but the data does not. The data goes back to the original ordering. Is this a bug or somethig to do with my configuration?

Below is a simple example. After reordering, the sample will display the UniqueName and DataField for each column. It appears that the client-side JS code is not properly setting the DataField after reordering.

ASPX
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title></title
 
    <script type="text/javascript"
        function ColumnSwapped(sender, eventArgs) { 
            var cols = $find(RadGrid1_ClientId).get_masterTableView()._columnsInternal; 
            for (var idx = 0; idx < cols.length; idx++) { 
                alert("Column:" + idx + ", UniqueName:" + cols[idx]._data.UniqueName + ", DataField:" + cols[idx]._data.DataField); 
            } 
        } 
    </script> 
 
</head> 
<body> 
    <form id="form1" runat="server"
    <div> 
        <asp:ScriptManager ID="ScriptManager" runat="server" AsyncPostBackTimeout="1000" 
            ScriptMode="Release"
        </asp:ScriptManager> 
        <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True" 
            AllowMultiColumnSorting="False" AutoGenerateColumns="False" Width="100%" AllowMultiRowSelection="True" 
            Height="565px" PageSize="20" ShowStatusBar="True" BorderWidth="1px" GridLines="Vertical"
            <MasterTableView> 
                <Columns> 
                    <telerik:GridBoundColumn DataField="NUMBERS" HeaderText="NUMBERS" UniqueName="NUMBERS"
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="LETTERS" HeaderText="LETTERS" UniqueName="LETTERS"
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="WORDS" HeaderText="WORDS" UniqueName="WORDS"
                    </telerik:GridBoundColumn> 
                </Columns> 
            </MasterTableView> 
            <ClientSettings AllowColumnsReorder="true" ColumnsReorderMethod="Reorder" ReorderColumnsOnClient="true"
                <ClientEvents OnColumnSwapped="ColumnSwapped" /> 
                <Scrolling AllowScroll="True" UseStaticHeaders="True" /> 
                <Resizing AllowColumnResize="true" /> 
                <Selecting AllowRowSelect="true" /> 
                <DataBinding Location="~/TestService.asmx" SelectMethod="GetData"
                </DataBinding> 
            </ClientSettings> 
        </telerik:RadGrid> 
    </div> 
    </form> 
 
    <script type="text/javascript"
        var RadGrid1_ClientId = "<%= RadGrid1.ClientID %>"
    </script> 
 
</body> 
</html> 
 


Web Service (ASMX)
    [WebService(Namespace = "http://tempuri.org/")] 
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] 
    [ScriptService] 
    [System.ComponentModel.ToolboxItem(false)] 
    public class TestService : System.Web.Services.WebService { 
 
        [WebMethod(EnableSession = true)] 
        public Dictionary<stringobject> GetData(int startRowIndex, int maximumRows, List<GridSortExpression> sortExpression, List<GridFilterExpression> filterExpression) { 
            Dictionary<stringobject> data = new Dictionary<stringobject>(); 
            List<object> rows = new List<object>(); 
 
            for (int i = 0; i < 100; i++) { 
                rows.Add(new { 
                    NUMBERS = 1, 
                    LETTERS = "A"
                    WORDS = "One" 
                }); 
                rows.Add(new { 
                    NUMBERS = 2, 
                    LETTERS = "B"
                    WORDS = "Two" 
                }); 
                rows.Add(new { 
                    NUMBERS = 3, 
                    LETTERS = "C"
                    WORDS = "Three" 
                }); 
                rows.Add(new { 
                    NUMBERS = 4, 
                    LETTERS = "D"
                    WORDS = "Four" 
                }); 
                rows.Add(new { 
                    NUMBERS = 5, 
                    LETTERS = "E"
                    WORDS = "Five" 
                }); 
                rows.Add(new { 
                    NUMBERS = 6, 
                    LETTERS = "F"
                    WORDS = "Six" 
                }); 
            } 
 
            data.Add("Count", rows.Count); 
 
            int numElements = maximumRows; 
            if (maximumRows > (rows.Count - startRowIndex)) { 
                maximumRows = rows.Count - startRowIndex; 
            } 
 
            var tmpData = rows.GetRange(startRowIndex, maximumRows); 
 
            data.Add("Data", tmpData); 
 
            return data; 
        } 
    } 

Pavel
Telerik team
 answered on 28 May 2009
3 answers
87 views
As the title, is there a way to add a custom field so it appears to the left of the file selector rather than underneath?

When uploading multiple files which have different ref numbers it looks a lot better when it is

Ref No     Filename
======================
12345     UploadedFile1.doc
54321     UploadedFile2.doc
11133     UploadedFile3.doc

Rather than

FileName UploadedFile1.doc
Ref No     12345
Filename UploadedFile2.doc
Ref No    54321
FileName UploadedFile3.doc
Ref No    11133

Have searched the samples etc but not found anything relating to this.

Thanks
Genady Sergeev
Telerik team
 answered on 28 May 2009
5 answers
141 views


I have a simple form with a radcombobox and textbox.When I selectan item from the combobox the textbox should be updated with selected combobox item.I have placed a ajax loading panel in my form and configured the ajax manager as below.

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadComboBox1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTextBox1"
                            LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="Button1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="Panel1"
                            LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
But when I select the combo Item the textbox become invisible.Is there any problem in my ajax configuration.The whole  code below
Please  suggest a solution.


<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
        </telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadComboBox1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTextBox1"
                            LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="Button1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="Panel1"
                            LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <asp:Panel ID="Panel1" runat="server">
       
        <table style="width: 100%;">
            <tr>
                <td>
                    &nbsp;
                    <telerik:RadComboBox ID="RadComboBox1" Runat="server" AutoPostBack="True"
                        CausesValidation="False"
                        onselectedindexchanged="RadComboBox1_SelectedIndexChanged">
                        <Items>
                            <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1"
                                Value="RadComboBoxItem1" />
                            <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2"
                                Value="RadComboBoxItem2" />
                        </Items>
                    </telerik:RadComboBox>
                </td>
                <td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td>
                    <telerik:RadTextBox ID="RadTextBox1" Runat="server">
                    </telerik:RadTextBox>
                </td>
                <td>
                    &nbsp;
                    </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
                </td>
                <td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
        </table>
         </asp:Panel>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px"
            Width="75px" Skin="Vista">
            <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
                style="border: 0px;" />
        </telerik:RadAjaxLoadingPanel>
    </div>
    </form>
</body>
</html>
Pavlina
Telerik team
 answered on 28 May 2009
1 answer
98 views
Hi,

I found some post of RadAjax & UserControl but I think that is not exactelly want I would like.

I have a UserControl VERY simple : 
public partial class Marge : System.Web.UI.UserControl
    {
        public string titre { get; set; }
        public string marge { get; set; }
        public string heures { get; set; }
        public string achats { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            TabRoundHaut1.titre = titre;
            LabelMarge.Text = marge;
            LabelHeures.Text = heures;
            LabelAchats.Text = achats;
        }
    }
So, there is just 4 label...

I put this UserControl on a page.
When I update the RadGrid1 I want to refresh my simple UserControl.

So I have this : 
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel"/>
                    <telerik:AjaxUpdatedControl ControlID="UserControl1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
     </AjaxSettings>
</telerik:RadAjaxManager>

And : 
protected void RadGridAchatsManuel_ItemCreated(object sender, GridItemEventArgs e)
{
UserControl1. titre = "Toto";
}

protected void Page_Load(object sender, EventArgs e)
{
UserControl1. titre = "Tata";
}


So when I load my page the user control  display Tata in the 'titre' it is great.
But, when I create an item in the grid... the UserControl.titre display nothing !

Thank you for your help
Pavlina
Telerik team
 answered on 28 May 2009
2 answers
115 views

I am in the process of upgrading an older application that used the previous RADControls to use the ASP.NET AJAX Controls. I have a grid with 4 columns (many rows) and each column is a link button. When a link button is clicked i want to filter that column by whatever text the link button has. (many rows will have the same values). here is my old code for the ASP.NET controls and it worked fine:

here is one of my snippets from the RadGrid1_ItemCommand event (Fields/Columns changed for easy read):

if (e.CommandName = "FilterCol1")
{
GridDataItem 
item = (GridDataItem)e.Item;  
 
LinkButton lb = (LinkButton)item["Col1"].FindControl("btnCol1");  
string strFilter = lb.Text;  
 
rgBOM.MasterTableView.FilterExpression = "([COL1_DATAFIELD] LIKE \'" + strFilter + "%\') ";  
 
GridColumn column = RadGrid1.MasterTableView.GetColumnSafe("Col1");  
column.CurrentFilterFunction = GridKnownFunction.Contains;  
RadGrid1.Rebind(); 
}

i get an error on the rebind : Expression Expected
Pavlina
Telerik team
 answered on 28 May 2009
1 answer
65 views
Hi,

I am getting a line under and on side of the drop down box. Please help!


Thanks,
Dhananjay
Pavlina
Telerik team
 answered on 28 May 2009
9 answers
396 views
I have a RadGrid where I am grouping by expression and I'm aggregating some values in the group header.  The aggregates in the group header work fine and total all the values in the group as expected until I set the Aggregate property of the GridBoundColumn field to Sum of the field I'm trying to aggregate in the group header.  instead of having a total of the group in the group header for that field, just the last value of the group is being placed in the group header.  I need to have group totals in the group header and then overall totals in the grid footer.  Is there a way to do this? 
Rosen
Telerik team
 answered on 28 May 2009
1 answer
157 views
Hi,
Can you tell me how to get the total number of rows in the grid? If I have enabled paging and each page displays 10 rows and if I have 4 pages I should get a count of over 30.
How can I obtain this? Could you please let me know.

Actually what I want is to get a list of DataKey values in all rows. Is there a way to itterate thru the list and get the DataKey values of all the rows, not just only the 10 rows displayed in the current page?

thanks
jay
Princy
Top achievements
Rank 2
 answered on 28 May 2009
5 answers
281 views
This is my first time using the new radrotator and I can't seem to find any attribute that will allow me to turn off the arrows, any suggestions? I'm really stuck here

<telerik:RadRotator ID="dlNewsList" runat="server" ScrollDirection="Up" Height="207px" Width="228px" FrameDuration="0" EnableViewState="False"
ScrollDuration="5000"
        ItemHeight="90px" ItemWidth="220px" RotatorType="AutomaticAdvance"  >
Martin
Telerik team
 answered on 28 May 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
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
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?