Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
368 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
155 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
351 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
135 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
104 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
387 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
1 answer
182 views
Hello!

I have a question regarding programmatically created RadDock controls. I can't figure out how to wire them with server-side Command event. On creating RadDock custom controls are loaded and they do postback on click but they don't fire Command event. The problem is also that on postback custom control disappears so one more thing is how to avoid that behavior.

This is my code:

        private RadDock CreateRadDock()
        {
            int docksCount = CurrentDockStates.Count;
            int idTicket = Convert.ToInt32(rcbTicketi.SelectedValue);

            Ticket ticket = db.Ticket.SingleOrDefault(t => t.idTicket == idTicket);

            RadDock dock = new RadDock();
            dock.DockMode = DockMode.Docked;
            dock.UniqueName = Guid.NewGuid().ToString().Replace("-", "a");
            dock.ID = string.Format("RadDock{0}", dock.UniqueName);
            dock.Title = ticket.idNadredeniTicket + "-" + ticket.RedniBroj + " (" + ticket.Firma.Naziv + ")";
            dock.Text = ticket.Opis;
            dock.Width = Unit.Pixel(500);
            dock.Command += new DockCommandEventHandler(RadDock_Command);

            DockCommand close = new DockCommand();
            close.AutoPostBack = true;
            close.Text = "Zatvori incident";
            close.Name = "Zatvori";

            DockCloseCommand hide = new DockCloseCommand();
            close.AutoPostBack = true;
            close.Text = "Sakrij";

            dock.Commands.Add(hide);
            dock.Commands.Add(new DockExpandCollapseCommand());
            dock.Commands.Add(close);           

            return dock;
        }

        protected void RadDock_Command(object sender, Telerik.Web.UI.DockCommandEventArgs e)
        {
            string naziv = e.Command.Name;

            if (e.Command.Name == "Zatvori")
            {
                Response.Redirect("www.google.hr");
            }
            else if (e.Command.Name == "Close")
            {
                Response.Redirect(Request.RawUrl + "?id=1");
            }
        }


There is also one more thing that bothers me. How could I get the ID of the RadDock on fired event?

Regards,

Hrvoje
Slav
Telerik team
 answered on 14 Mar 2012
5 answers
99 views
2010.3.1109.40

I created a non recurring appointment on March 1 2011 with a start date and time of March 16 2011 at 11am.  After it was created it showed in the scheduler correctly as11am.  However, now that March 16th has come the appointment is shown in the scheduler as starting at noon (1hr ahead of what its suppose to start on).  In the database its stored as "2011-03-15 19:00:00.000", my server time zone is PST (Pacific Standard Time).  I have created my scheduler and data access as outlined here and have a load event as shown below.  Please advise on how to get my events to show properly, its much more than just this event and this is a problem in production right now. 

protected void RadScheduler1_Load(object sender, EventArgs e)
{
    TimeZone localZone = TimeZone.CurrentTimeZone;
    TimeSpan currentOffset = localZone.GetUtcOffset(DateTime.Today);
    this.RadScheduler1.TimeZoneOffset = currentOffset;
}

Peter
Telerik team
 answered on 14 Mar 2012
5 answers
340 views
I am trying to set the attributes of an edit hyperlink in a TreeList. When you click the edit hyperlink it will execute javascript to open a RadWindow. What I would like to do is to pass the "Req #" column value when you click the hyperlink. I thought the best way would be to write that value in the onclick attribute on each hyperlink created. Although I'm having trouble getting the associated "Req #" column value.

To make it easier to understand I have attached an image. Basically I want pass the "Req #" value to the RadWindow when the "view/edit" link is clicked. 

Below is my code:

ASPX

<telerik:RadAjaxLoadingPanel ID="replenishmentLoadingPanel" runat="server" Skin="Simple" />
        <telerik:RadTabStrip ID="replenishmentTabStrip" runat="server" Skin="Simple" MultiPageID="RadMultiPage2"
            SelectedIndex="0">
            <Tabs>
                <telerik:RadTab Text="Req">
                </telerik:RadTab>
                <telerik:RadTab Text="P.O.">
                </telerik:RadTab>
            </Tabs>
        </telerik:RadTabStrip>
        <telerik:RadMultiPage ID="RadMultiPage2" runat="server" SelectedIndex="0" >
            <telerik:RadPageView ID="replenishmentPageView1" runat="server">
                <telerik:RadTreeList ID="requisitionTreeList" runat="server" AutoGenerateColumns="false" AllowSorting="false" AllowPaging="false"
                  OnNeedDataSource="requistions_needdata" OnPreRender="replenishment_PreRender" OnItemCreated="requisitons_ItemCreated"
                  DataKeyNames="ID" ParentDataKeyNames="PID" ShowTreeLines="false" EditMode="PopUp" >
                    <Columns>
                        <telerik:TreeListEditCommandColumn ShowEditButton="false" AddRecordText="Add" HeaderStyle-Width="30px" />
                        <telerik:TreeListBoundColumn DataField="ID" Visible="false" />
                        <telerik:TreeListBoundColumn DataField="PID" Visible="false" />
                        <telerik:TreeListBoundColumn DataField="ReqNum" HeaderText="Req #" UniqueName="ReqNum" />
                        <telerik:TreeListBoundColumn DataField="PONumber" HeaderText="PO #" />
                        <telerik:TreeListBoundColumn DataField="ReqDateTime" HeaderText="Transmit Time" />
                        <telerik:TreeListTemplateColumn UniqueName="TemplateEditColumn">
                            <ItemTemplate>
                                <asp:HyperLink ID="EditLink" runat="server" Text="View/Edit" href="#" onclick="openRadWin();"></asp:HyperLink>
                            </ItemTemplate>
                        </telerik:TreeListTemplateColumn>
                    </Columns>
                </telerik:RadTreeList>
                 
            </telerik:RadPageView>
 
            <telerik:RadPageView ID="repenishmentPageView2" runat="server">
                <telerik:RadTreeList ID="purchaseorderTreeList" runat="server" AutoGenerateColumns="false" AllowSorting="false" AllowPaging="false"
                  OnNeedDataSource="purchaseOrders_needdata" DataKeyNames="ID" ParentDataKeyNames="PID" ShowTreeLines="false" EditMode="PopUp" >
                    <Columns>
                        <telerik:TreeListEditCommandColumn ShowEditButton="false" AddRecordText="Add" HeaderStyle-Width="50px" />
                        <telerik:TreeListBoundColumn DataField="ID" Visible="false" />
                        <telerik:TreeListBoundColumn DataField="PID" Visible="false" />
                        <telerik:TreeListBoundColumn DataField="PONumber" HeaderText="PO #" />
                        <telerik:TreeListBoundColumn DataField="ReqNum" HeaderText="Req #" />
                        <telerik:TreeListBoundColumn DataField="PODateTime" HeaderText="Transmit Time" />
                    </Columns>
                </telerik:RadTreeList>
            </telerik:RadPageView>
        </telerik:RadMultiPage>


C#

protected void requisitons_ItemCreated(object sender, TreeListItemCreatedEventArgs e)
       {
           if (e.Item is TreeListDataItem)
           {     
               HyperLink editLink = (HyperLink)e.Item.FindControl("EditLink");
               editLink.Attributes["href"] = "#";
               //editLink.Attributes["onclick"] = "openRadWin(" + value + ");";
           }
       }


William
Top achievements
Rank 1
 answered on 14 Mar 2012
2 answers
197 views
We are using  Telerik.Web.UI   v. 2009.3.1208.0.

When customErrors are ON all errors come back as "There was an error in the callback.s[]_$$_"

If customErrors are turned OFF all error come back with proper messages (what was thrown from server side)

Steps to reproduce.

1) On the server side handle NodeExpand  event from the Telerik.Web.UI.RadTreeView
2) Within the method that handles the NodeExapend thrown an exception with some text "This is the error"
3) Make sure your web.config had this line  <customErrors mode="On" defaultRedirect="~/Error/ErrorPage.aspx"  redirectMode="ResponseRewrite" />
4) Click on the node and you will get an alert text box with the following text:  "There was an error in the callback.s[]_$$_"


If customErrors are turned off alert text box comes back with the right text: "This is the error.s[]_$$_" 

Please, help!
Plamen
Telerik team
 answered on 14 Mar 2012
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?