Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
166 views
Hi,

    I am now integrating RadEditor into my collaborative appliaction. I found the feature "commenting in RadEditor" interesting as users are able to make comments on the contents. However, I just wonder how to change the RadEditorUser/Author attribute because everytime a user makes a comment, Radeditor would set the author as "RadEditorUser". This causes confusion as users cannot distingish their comments with those made by others.

Thanks
Nelson
Rumen
Telerik team
 answered on 14 Mar 2012
1 answer
98 views
I am trying to automatically expand to detail level the newly inserted master record (which works)
and then auto put the child into insert mode which I cant seem to get working.

It throws the 'index out of bounds' error on the :

  Dim tableView As GridTableView = DirectCast(item.ChildItem.NestedTableViews(0), GridTableView)
  tableView.IsItemInserted = True


Any advice appreciated.
Thanks in advance.

Snippet of code I am using below

<telerik:RadGrid ID="RadGrid1" OnPreRender="RadGrid1_PreRender" DataSourceID="SqlDataSource1" OnItemInserted="RadGrid1_ItemInserted"
            runat="server" AutoGenerateColumns="False" AllowSorting="True" AllowMultiRowSelection="False"
            AllowPaging="True" PageSize="10" GridLines="None" AllowAutomaticInserts="True"
            allowautomaticdeletes="true" AllowAutomaticUpdates="true">
            <PagerStyle Mode="NumericPages"></PagerStyle>
            <MasterTableView DataSourceID="SqlDataSource1" CommandItemDisplay="Top" DataKeyNames="custID" AllowMultiColumnSorting="True"
                            GroupLoadMode="Server">
                <NestedViewTemplate>
                    <asp:Panel runat="server" ID="InnerContainer" CssClass="viewWrap" Visible="true">
                        <telerik:RadTabStrip runat="server" ID="TabStip1" MultiPageID="Multipage1"
                            SelectedIndex="0">
                            <Tabs>
                                <telerik:RadTab runat="server" Text="Job Details" PageViewID="PageView1">
                                </telerik:RadTab>
                                <telerik:RadTab runat="server" Text="Scheduling" PageViewID="PageView2">
                                </telerik:RadTab>
 
                            </Tabs>
                        </telerik:RadTabStrip>
                        <telerik:RadMultiPage runat="server" ID="Multipage1" SelectedIndex="0" RenderSelectedPageOnly="false">
                            <telerik:RadPageView runat="server" ID="PageView1">
                                <asp:Label ID="Label1" Font-Bold="true" Font-Italic="true" Text='<%# Eval("custID") %>'
                                    Visible="false" runat="server" />
                                <telerik:RadGrid runat="server" ID="OrdersGrid" DataSourceID="SqlDataSource2"
                                    ShowFooter="true" AllowSorting="true" EnableLinqExpressions="false">
                                    <MasterTableView ShowHeader="true" AutoGenerateColumns="False" AllowPaging="true" EditMode="InPlace"
                                        DataKeyNames="OrderID" PageSize="7" HierarchyLoadMode="ServerOnDemand" CommandItemDisplay="Top">
                                        <Columns>
                                            <telerik:GridNumericColumn SortExpression="Description" HeaderText="Description" HeaderButtonType="TextButton"
                                                DataField="Description" UniqueName="Description">
                                            </telerik:GridNumericColumn>
                                            <telerik:GridBoundColumn SortExpression="Price" HeaderText="Price" HeaderButtonType="TextButton"
                                                DataField="Price" UniqueName="Price">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridDateTimeColumn SortExpression="PayOnline" HeaderText="PayOnline" HeaderButtonType="TextButton"
                                                DataField="PayOnline" UniqueName="Payonline">
                                            </telerik:GridDateTimeColumn>
                                            <telerik:GridBoundColumn UniqueName="Frequency" DataField="FrequencyNum"
                                                HeaderText="Frequency">
                                            </telerik:GridBoundColumn>
                                        </Columns>
                                    </MasterTableView>
                                </telerik:RadGrid>
                                <asp:SqlDataSource ID="SqlDataSource2" ConnectionString="<%$ ConnectionStrings:MainConnectionString %>"
                                    ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM CustJobs Where custID = @custID "
                                    runat="server">
                                    <SelectParameters>
                                        <asp:ControlParameter ControlID="Label1" PropertyName="Text" Type="String" Name="custID" />
                                    </SelectParameters>
                                </asp:SqlDataSource>
 
                            </telerik:RadPageView>
                            <telerik:RadPageView runat="server" ID="PageView2" Width="600px">
                                <asp:Label ID="Label2" Font-Bold="true" Font-Italic="true" Text='<%# Eval("custID") %>'
                                    Visible="false" runat="server" />
                                <telerik:RadGrid runat="server" ID="RadGrid2" DataSourceID="SqlDataSource2"
                                    ShowFooter="true" AllowSorting="true" EnableLinqExpressions="false">
                                    <MasterTableView ShowHeader="true" AutoGenerateColumns="False" AllowPaging="true" EditMode="InPlace"
                                        DataKeyNames="OrderID" PageSize="7" HierarchyLoadMode="ServerOnDemand">
                                        <Columns>
                                            <telerik:GridNumericColumn SortExpression="FrequencyNum" HeaderText="Frequency" HeaderButtonType="TextButton"
                                                DataField="FrequencyNum" UniqueName="FrequencyNum">
                                            </telerik:GridNumericColumn>
                                            <telerik:GridBoundColumn SortExpression="FrequencyTerm" HeaderText=".." HeaderButtonType="TextButton"
                                                DataField="FrequencyTerm" UniqueName="FrequencyTerm">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridDateTimeColumn SortExpression="FirstClean" HeaderText="FirstClean" HeaderButtonType="TextButton"
                                                DataField="FirstClean" UniqueName="FirstClean">
                                            </telerik:GridDateTimeColumn>
                                            <telerik:GridBoundColumn UniqueName="NextDue" HeaderText="Next Due" HeaderButtonType="TextButton"
                                                DataField="NextDue">
                                            </telerik:GridBoundColumn>
                                        </Columns>
                                    </MasterTableView>
                                </telerik:RadGrid>
                                <asp:SqlDataSource ID="SqlDataSource3" ConnectionString="<%$ ConnectionStrings:MainConnectionString %>"
                                    ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM CustJobs Where custID = @custID "
                                    runat="server">
                                    <SelectParameters>
                                        <asp:ControlParameter ControlID="Label1" PropertyName="Text" Type="String" Name="custID" />
                                    </SelectParameters>
                                </asp:SqlDataSource>
 
                            </telerik:RadPageView>
 
                        </telerik:RadMultiPage>
                    </asp:Panel>
                </NestedViewTemplate>
                <Columns>
                    <telerik:GridBoundColumn DataField="custID" SortExpression="custID" HeaderText="custID" Visible="false" >
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="Name" HeaderText="Name" HeaderButtonType="TextButton" ItemStyle-Font-Size="Smaller"
                        DataField="Name" UniqueName="Name" ItemStyle-Width="5" HeaderStyle-Width="5" FilterControlWidth="5">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="Addr1" HeaderText="Address" HeaderButtonType="TextButton" ItemStyle-Font-Size="Smaller"
                        DataField="Addr1" UniqueName="Addr1">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="Addr2" HeaderText="" HeaderButtonType="TextButton" ItemStyle-Font-Size="Smaller"
                        DataField="Addr2" UniqueName="Addr2">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="Town" HeaderText="Town" HeaderButtonType="TextButton" ItemStyle-Font-Size="Smaller"
                        DataField="Town" UniqueName="Town">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="County" HeaderText="County" HeaderButtonType="TextButton" ItemStyle-Font-Size="Smaller"
                        DataField="County" UniqueName="County">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="PostCode" HeaderText="PostCode" HeaderButtonType="TextButton" MaxLength="8" ItemStyle-Font-Size="Smaller"
                        DataField="PostCode" UniqueName="PostCode">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="Tel" HeaderText="Tel" HeaderButtonType="TextButton" MaxLength="11" ItemStyle-Font-Size="Smaller"
                        DataField="Tel" UniqueName="Tel">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="Mobile" HeaderText="Mobile" HeaderButtonType="TextButton" MaxLength="11" ItemStyle-Font-Size="Smaller"
                        DataField="Mobile" UniqueName="Mobile">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="Email" HeaderText="Email" HeaderButtonType="TextButton" ItemStyle-Font-Size="Smaller"
                        DataField="Email" UniqueName="Email">
                    </telerik:GridBoundColumn>                   
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                        <ItemStyle CssClass="MyImageButton" />
                    </telerik:GridEditCommandColumn>
                </Columns>
            </MasterTableView>
            <ClientSettings AllowDragToGroup="true" />
        </telerik:RadGrid>
 
 
 
 
 
 
 
 
 Protected Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As EventArgs) Handles RadGrid1.PreRender
 
    'REPLACE with oleDB method b4 go live
    '----------
        Dim strGUID2Find As String
        strGUID2Find = Session("CustGUID")
    '-------------
    'use session var for debugging.. switch to OLEDB method before go live.
 
        ' Do nothing if RadGrid is in insert mode or no new item is inserted recently.
        If RadGrid1.MasterTableView.IsItemInserted OrElse strGUID2Find = "" Then
            Return
        End If
 
 
        Dim currentPageIndex As Integer = RadGrid1.CurrentPageIndex
 
        ' loop thru grid to find latest rec inserted..
        For i As Integer = 0 To RadGrid1.PageCount - 1
            ' Compare CustID of each item in the RadGrid with the newly inserted item custID
            For Each item As GridDataItem In RadGrid1.Items
                If strGUID2Find.Equals(item("CustID").Text) Then
                    ' Select the last inserted row
                    item.Selected = True
                    item.Expanded = True
 
                      Dim tableView As GridTableView = DirectCast(item.ChildItem.NestedTableViews(0), GridTableView)
                      tableView.IsItemInserted = True
 
                    currentPageIndex = -1
                    ' flag exit
                    Exit For
                End If
            Next
 
            ' If item is found then exit RadGrid page loop
            If currentPageIndex.Equals(-1) Then
                Exit For
            End If
 
            ' Go to next RadGrid page
            currentPageIndex += 1
            If currentPageIndex >= RadGrid1.PageCount Then
                currentPageIndex = 0
            End If
            RadGrid1.CurrentPageIndex = currentPageIndex
            RadGrid1.Rebind()
        Next
    End Sub
Tsvetina
Telerik team
 answered on 14 Mar 2012
1 answer
106 views
Hello,
I Need this example  "Filtering By ListTextField for GridDropDownColumn"
http://www.telerik.com/help/aspnet-ajax/grid-filtering-by-listtextfield-for-griddropdowncolumn.html
but I use the HeaderContextMenu.
My e.Item is a GridHeaderItem  insteadOf GridFilteringItem  Thanks in advance
Richard
Top achievements
Rank 1
 answered on 14 Mar 2012
1 answer
118 views
Hi everyone,

I have a question about if I can to create my sql query with some telerik controls;

Could I with radtreeview or radfilter create my sql query and then fill my  grid?
What happens is that I don´t want to get all the records at once but only those who will need.


Regards,
Tsvetina
Telerik team
 answered on 14 Mar 2012
1 answer
418 views
Hi,

I have a rad window and for that I need to set the default button.Currently, when I hit the Enter key the button inside rad window is working only when my focus is inside the rad window. I need to set the focus to rad window when I open it in server side.

Can anyone help me out on this?

Thanks
Marin Bratanov
Telerik team
 answered on 14 Mar 2012
3 answers
199 views
HI,

This is with reference to the below thread

http://www.telerik.com/community/forums/aspnet/input/change-max-value-of-radnumerictextbox.aspx

I know that RadNumericTextbox has a limitation of 2^46 but is it possible to turn-off the automatic rounding to the maximum value allowed. I don't want the user to automatically be rounded to the maxvalue if the entered value is larger. Instead, I want to signal the user about the error, and ask him/her to retype the value.

can anyone please help me in this
Richard
Top achievements
Rank 1
 answered on 14 Mar 2012
0 answers
426 views

I ran into this error and I wanted to post my work around to it.  I was trying to add a popup warning to an existing edit button that kicked off an edit for a grid.  The error I got is below.

Specified argument was out of the range of valid values.
Parameter name: ItemHierarchicalIndex
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
 
Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: ItemHierarchicalIndex
 
Source Error:
 
 
 
 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
 
 
Stack Trace:
 
 
 
 
 
[ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: ItemHierarchicalIndex]
   Telerik.Web.UI.GridDataItemCollection.get_Item(String hierarchicalIndex) +113
   Telerik.Web.UI.RadGrid.RaisePostBackEvent(String eventArgument) +3642
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981

 

What caused this error was the javascript I added to fire the grid_ItemCommand after the popup.  It was firing off code inside the RadGrid Control before it ever got to my codebehind and this code was having the error.

Bad Code

<Telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
    <script language="javascript" type="text/javascript">
 
        function confirmEdit() {
            // This function prompts the user if they want to edit (Y/N).
            <% If ShowPopup Then %>
                radconfirm("The date selected is a prior period date, are you sure you want to edit the data for the date shown?", confirmCallBackFnEdit, 330, 100, null, 'Edit Receipt Noms (Y/N)');
            <% Else %>
                var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
                masterTable.fireCommand("Edit", "");
            <% End If %>          
        }
 
        function confirmCallBackFnEdit(arg) {
            if (arg) {
                var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
                masterTable.fireCommand("Edit", "");
            }
        }
         
    </script>
</Telerik:RadScriptBlock>

To fix this error I renamed the CommandName I was looking for in the code behind Grid_ItemCommand from Edit to EditAll, changed the commandname on the button in HTML to EditAll and I changed the javascript to call EditAll. This bypassed the code inside the RadGrid control causing the error.

Good Code

<Telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
    <script language="javascript" type="text/javascript">
 
        function confirmEdit() {
            // This function prompts the user if they want to edit (Y/N).
            <% If ShowPopup Then %>
                radconfirm("The date selected is a prior period date, are you sure you want to edit the data for the date shown?", confirmCallBackFnEdit, 330, 100, null, 'Edit Receipt Noms (Y/N)');
            <% Else %>
                var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
                masterTable.fireCommand("EditAll", "");
            <% End If %>          
        }
 
        function confirmCallBackFnEdit(arg) {
            if (arg) {
                var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
                masterTable.fireCommand("EditAll", "");
            }
        }
         
    </script>
</Telerik:RadScriptBlock>

It looks like a button CommandName of Edit should be treated like a reserved word until Telerik fixes this issue. 

 

 

Steve
Top achievements
Rank 1
 asked on 14 Mar 2012
2 answers
160 views
Hello,

some days before I faced a strange behavior. I tried to show a radAlert window, from a modal radWindow, on top of all windows, so I set its z-index clientside like this:

_radalert.get_popupElement().style.zIndex = 100000;

The problem was that the radAlert was shown on top, but the gray-color panel was placed behind the radWindow, so the radWindow remained active, not disabled.

Finally I found a solution, setting this property, too:

_radalert.get_popupElement().style.zIndex = 100001;
_radalert._modalExtender._backgroundElement.style.zIndex = 100000;


What I would like to know is if there is a public property or a 'get' method to access the private object "_modalExtender"

Thanks in advance.
Marin Bratanov
Telerik team
 answered on 14 Mar 2012
2 answers
149 views
Hi All,
I am using ragdrid with 7 columns,in this grid for name column, i am using filter option(ShowFilterIcon="True"),for this column,if i click on filter option,i am getting 17 filter options.But my requirement is, i want to show only 4 options.
Is it possible or not ?

Thanks in advance

Regards,
Sekhar.
Purnasekhar
Top achievements
Rank 1
 answered on 14 Mar 2012
1 answer
452 views
Hello,

I use RadGrid and have javascript function that calls fireCommand for adding new rows. It works only when I the grid is not empty. When the gird havs 0 rows, it still fires Page_Load, but not the event handler for ItemCommand event. It used to work before the last 2 updates.

See the example below:

Main.aspx:
<%@ Page EnableViewState="true" Language="C#" AutoEventWireup="true" CodeBehind="Main.aspx.cs"
    Inherits="Pages.MainPage" MasterPageFile="~/Main.master" %>
 
<asp:Content ContentPlaceHolderID="Head" runat="server">
    <script type="text/javascript">
        function AddNewRow(idGrid) {
            var masterTable = $find(idGrid).get_masterTableView();
            masterTable.fireCommand("NewRow");
        }
    </script>
</asp:Content>
<asp:Content ContentPlaceHolderID="Content" runat="server">
    <telerik:RadGrid runat="server" ID="grid" OnNeedDataSource="grid_NeedDatasource"
        OnItemCommand="grid_ItemCommand" AutoGenerateColumns="false" Width="300">
        <MasterTableView ShowFooter="true" EnableViewState="true" DataKeyNames="Value">
            <Columns>
                <telerik:GridTemplateColumn>
                    <ItemTemplate>
                        <%# Eval( "Value" ) %>
                    </ItemTemplate>
                    <FooterTemplate>
                        <telerik:RadNumericTextBox runat="server" ID="tbValue" Value="0" />
                    </FooterTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn UniqueName="ColumnOperation">                      
                    <FooterTemplate>
                        <a href="javascript:void(0)">
                            <img src='<%# Telerik.Web.SkinRegistrar.GetWebResourceUrl(Page,typeof(RadGrid), "Telerik.Web.UI.Skins.WebBlue.Grid.AddRecord.gif") %>'
                                onclick="AddNewRow('<%# Container.OwnerTableView.Parent.ClientID %>');"
                                alt="Add" /></a>
                    </FooterTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridButtonColumn UniqueName="ColumnDelete" CommandName="Delete" ButtonType="ImageButton" />
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
</asp:Content>

Main.aspx.cs:
using System;
using System.Web.UI;
using System.Collections.Generic;
using System.Linq;
using Telerik.Web.UI;
 
namespace Pages
{
    public partial class MainPage : Page
    {      
        public void Page_Load( object sender, EventArgs e )
        {
            if ( !IsPostBack )
            {
                m_values = new List<Double>() { 1, 2, 3 };
            }
        }
 
 
        protected void grid_NeedDatasource( Object sender, GridNeedDataSourceEventArgs e )
        {
            grid.DataSource = m_values.Select( x => new { Value = x } );
        }
 
 
        protected void grid_ItemCommand( object sender, GridCommandEventArgs e )
        {
            switch ( e.CommandName )
            {
                case "NewRow":
                    var item = grid.MasterTableView.GetItems( GridItemType.Footer )[ 0 ];
                    var tbValue = item.FindControl( "tbValue" ) as RadNumericTextBox;
 
                    m_values.Add( tbValue.Value.Value );
 
                    grid.Rebind();
                    break;
 
                case "Delete":
                    var value = (Double)( e.Item as GridDataItem ).GetDataKeyValue( "Value" );
                    m_values.Remove( value );
                     
                    grid.Rebind();
                    break;
            }
        }
 
 
        private List<Double> m_values
        {
            get
            {
                return ViewState[ "values" ] as List<Double>;
            }
            set
            {
                ViewState[ "values" ] = value;
            }
        }
    }
}
Richard
Top achievements
Rank 1
 answered on 14 Mar 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?