Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
97 views
Hi,
       I have an MVC application with a view which has a Telerik TabStrip Control. The TabStrip has 3 tabs: the First tab contains three Telerik Grids, and the other two tabs one grid each.  All The values which are being bound to the grid are being validated in the Model. Each of the grids has Edit button present in each row. After editing the fields in the grid's row when insert/ save is clicked, the model validation is supposed to be fired stopping from executing the code in the controller. The problem is that validation works only for the first grid of the first tab and not for the remaining 4 grids in the View .  Below is the code

VIEW:
 <% Html.Telerik().TabStrip()
           .Name("captabletab")
           .Items(tabstrip =>
           {
               
               tabstrip.Add()
               .Text("Tab1")
                .Content(() =>
                {%>
                    <br />
                    <span class="..."></span>
                    <br />
                    <br />
                    <div>
                        <% Html.Telerik().Grid(Model.Class1)
                        .Name("Name1")

                        .ToolBar(commands => commands.Insert().ButtonType(GridButtonType.ImageAndText).ImageHtmlAttributes(new { style = "margin-left:0" }))
                        .DataKeys(keys => keys.Add(c => c.ID))
                        .DataBinding(binding => binding.Server()
                        .Select("...", "...")
                        .Insert("....", "CapTable", new { mode = GridEditMode.InLine, type = GridButtonType.ImageAndText })
                        .Update(".....", "CapTable", new { mode = GridEditMode.InLine, type = GridButtonType.ImageAndText })
                        .Delete("....", "CapTable", new { mode = GridEditMode.InLine, type = GridButtonType.ImageAndText })
                        )
                        .Columns(columns =>
                         {
                             columns.Bound(p => p.Col1).Width(250);
                             columns.Bound(p => p.Col2).Width(100);
                             columns.Bound(p => p.Col3).Width(100);
                             columns.Command(commands =>
                             {
                                 commands.Edit().ButtonType(GridButtonType.ImageAndText);
                                 commands.Delete().ButtonType(GridButtonType.ImageAndText);
                             }).HtmlAttributes(new { nowrap = "nowrap", style = "white-space:nowrap !important;" }).Width(300).Title("");
                         })
                         .HtmlAttributes(new { style = "overflow-x:auto;overflow-y:hidden" })
                         .Resizable(re => re.Columns(true))
                         .Scrollable()
                         .Editable(editing => editing.Mode(GridEditMode.InLine))
                         .Pageable().Render();
        
                        %>
                        <br />
                    </div>
                    <span class="....">....</span>
                    <br />
                    <br />
                    <div>
                        <% Html.Telerik().Grid(Model.Class2)
                        .Name("....")
                        
                        .DataKeys(keys => keys.Add(c => c.ID))
                        .DataBinding(binding => binding.Server()
                         .Select("...", "....")
                        .Update("...", "....", new { mode = GridEditMode.InLine, type = GridButtonType.ImageAndText })
                        )
                        .Columns(columns =>
                         {
                             columns.Bound(p => p.Col1).Width(250);
                             columns.Bound(p => p.Col2).Width(100);
                             columns.Bound(p => p.Col3).Width(100);
                             columns.Command(commands =>
                             {
                                 commands.Edit().ButtonType(GridButtonType.ImageAndText);
                             }).HtmlAttributes(new { nowrap = "nowrap", style = "width:350px !important;white-space:nowrap !important;" }).Width(300).Title("");
                         })
                         .HtmlAttributes(new { style = "overflow-x:auto;overflow-y:hidden" })
                         .Scrollable()
                         .Resizable(re => re.Columns(true))
                         .Editable(editing => editing.Mode(GridEditMode.InLine))
                        .Pageable()
                        .Render();
                        %>
                        <br />
                    </div>
                    <span class="...">...</span>
                    <br />
                    <br />
                    <div>
                        <% Html.Telerik().Grid(Model.Class3)
                        .Name("...")
                       
                        .DataKeys(keys => keys.Add(c => c.ID))
                        .DataBinding(binding => binding.Server()
                        .Select("..", "...")
                        .Update("....", ".....", new { mode = GridEditMode.InLine, type = GridButtonType.ImageAndText })
                        )
                        .Columns(columns =>
                         {
                             columns.Bound(p => p.Col1).Width(250);
                             columns.Bound(p => p.Col2).Width(100);
                             columns.Command(commands =>
                             {
                                 commands.Edit().ButtonType(GridButtonType.ImageAndText);
                             }).HtmlAttributes(new { nowrap = "nowrap", style = "width:350px !important;white-space:nowrap !important;" }).Width(300).Title("");
                         })
                         .HtmlAttributes(new { style = "overflow-x:auto;overflow-y:hidden" })
                         .Scrollable()
                         .Editable(editing => editing.Mode(GridEditMode.InLine))
                        .Pageable()
                           .Resizable(re => re.Columns(true))
                        .Render();
                        %>
                        <br />
                    </div>
                    <%});
               tabstrip.Add()
               .Text("Tab2")
               .Content(() =>
               {%>
                    <% Html.Telerik().Grid(Model.Class4)
                        .Name("....")
                        
                        .ToolBar(commands => commands.Insert().ButtonType(GridButtonType.ImageAndText).ImageHtmlAttributes(new { style = "margin-left:0"}))
                        .DataKeys(keys => keys.Add(c => c.ID))
                        .DataBinding(binding => binding.Server()
                        .Select("...", "....")
                        .Insert("....", "....", new { mode = GridEditMode.InLine, type = GridButtonType.ImageAndText })
                        .Update("....", ".....", new { mode = GridEditMode.InLine, type = GridButtonType.ImageAndText })
                        .Delete("....", "....", new { mode = GridEditMode.InLine, type = GridButtonType.ImageAndText })
                        )
                        .Columns(columns =>
                        {
                            columns.Bound(p => p.Col1).Width(220);
                             columns.Bound(p => p.Col2).Width(150);
                             columns.Command(commands =>
                             {
                                 commands.Edit().ButtonType(GridButtonType.ImageAndText);
                                 commands.Delete().ButtonType(GridButtonType.ImageAndText);
                             }).HtmlAttributes(new { nowrap = "nowrap", style = "width:350px !important;white-space:nowrap !important;" }).Width(300).Title("");
                        })
                        .Editable(editing => editing.Mode(GridEditMode.InLine))
                        .Pageable()
                        .Scrollable()
                        .Resizable(re => re.Columns(true))
                        .Render();
                    %>
                <%});
                tabstrip.Add()
                .Text("Tab3")
                .Content(() =>
                {%>
                    <% Html.Telerik().Grid(Model.Class5)
                        .Name("...")
                       
                        .ToolBar(commands => commands.Insert().ButtonType(GridButtonType.ImageAndText).ImageHtmlAttributes(new { style = "margin-left:0"}))
                        .DataKeys(keys => keys.Add(c => c.ID))
                        .DataBinding(binding => binding.Server()
                        .Select("...", "...")
                        .Insert("....", "....", new { mode = GridEditMode.InLine, type = GridButtonType.ImageAndText })
                        .Update("....", "....", new { mode = GridEditMode.InLine, type = GridButtonType.ImageAndText })
                        .Delete(".....", "CapTable", new { mode = GridEditMode.InLine, type = GridButtonType.ImageAndText })
                        )
                        .Pageable()
                        .Selectable()
                        .Columns(columns =>
                            {
                                columns.Bound(c => c.Col1).Width(300);
                                columns.Bound(c => c.Col2).Width(100);
                                columns.Bound(c => c.Col3).Width(100);
                                columns.Command(commands =>
                                {
                                    commands.Edit().ButtonType(GridButtonType.ImageAndText);
                                    commands.Delete().ButtonType(GridButtonType.ImageAndText);
                                }).HtmlAttributes(new { nowrap = "nowrap", style = "width:350px !important;white-space:nowrap !important;" }).Width(300).Title("");
                            })
                             .Editable(editing => editing.Mode(GridEditMode.InLine))
                           .Resizable(re => re.Columns(true))
                        .Render();
                    %>
                <%});
           })
           .SelectedIndex(((int)ViewData["SelectedIndex"]))
           .Render();



My MODEL has the classes - Class1, Class2, Class3, Class4, Class5 with properties which have validation using Attributes . Sample below:

public class Class1
    {

        public int ID { get; set; }

        [DisplayName("Column1")]
        [Required(ErrorMessage = "The Column1 field is required")]
        [RegularExpression(@"\b\d+\b", ErrorMessage = "The Column1 field should be a Positive Integral Value.")]
        public int Col1{ get; set; }

        [DisplayName("Column2")]
        [StringLength(20, ErrorMessage = "The length of Column2 should be less than 20 characters.")]
        [Required(ErrorMessage = "The Column2 is Required.")]
        public string Col2{ get; set; }




 
Tsvetina
Telerik team
 answered on 09 Mar 2011
1 answer
101 views

Requirements

RadControls version

.NET version : 3.5

Visual Studio version : 2008

programming language : C#

browser support

all browsers supported by RadControls


PROJECT DESCRIPTION
I get the below error while using RadChart using ObjectDataSource. Duration is a Double field and not sure why its not being identified as numeric. Also tried Int32, Int64 & other options. Also just to test I tried replacing the Property name with some other text (which is not a property) the error change the same except for the change in property name.

note : Im using evaluation copy not sure if the issue is with this version.

03/03/2011 20:48:47 System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> Telerik.Charting.ChartException: The type of column with name Duration is not numeric at Telerik.Charting.DataManager.GetColumnIndex(String column, ColumnType columnType) at Telerik.Charting.DataManager.GetValuesColumn(Int32 groupsColumn, String column, ColumnType columnType, Boolean auto) at Telerik.Charting.DataManager.GetValuesYColumns(String[] valuesYColumns, Boolean auto) at Telerik.Charting.DataManager.DataBindSeries(Int32 rows) at Telerik.Charting.DataManager.DataBind() at Telerik.Web.UI.RadChart.PerformDataBinding(IEnumerable data) at Telerik.Web.UI.RadChart.OnDataSourceViewSelectCallback(IEnumerable retrievedData) at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) at Telerik.Web.UI.RadChart.PerformSelect() at Telerik.Web.UI.RadChart.DataBind() at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() at System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) at Telerik.Web.UI.RadDataBoundControl.OnPreRender(EventArgs e) at Telerik.Web.UI.RadChart.OnPreRender(EventArgs e) at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace --- at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.webforms_dynamictips_aspx.ProcessRequest(HttpContext context) in c:\Users\N.R.Bellamkonda\AppData\Local\Temp\Temporary ASP.NET Files\cfms\1010adf4\94dc6435\App_Web_ezfgr_e8.6.cs:line 0 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


Yavor
Telerik team
 answered on 09 Mar 2011
0 answers
62 views
how can i change the event of telerik shcedular from double click to mouse down,mouse drag and mouse leave to load the rad dock.
vivak
Top achievements
Rank 1
 asked on 09 Mar 2011
1 answer
796 views
Hi,
I need to redirect to another aspx page when the user clicks the Telerik Grid Add button.  How is the best way to do this?  I can't seem to find an Add button click event to trap and do a redirect.
I'm using RadControls for ASP.Net AJAX Q2010 SP2.

Below is the code from my applicationUC.aspx page.

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ApplicationsUC.ascx.cs" Inherits="SunSmart.Web.Common.UserControls.ApplicationsUC" %>



<%@ Import Namespace="SunSmart.BusinessEntities.Enums" %>

<style type="text/css">
    .RadGrid .rgCommandTable
    {
        border:0;
    }
    
    .RadGrid .rgRow td , .RadGrid .rgAltRow td, .RadGrid .rgHeader
    {
        border:0;/*-right: solid 1px #DEEBF7; */
        border-right: solid 1px #000000;
    }
 
    .RadGrid .rgHeader
    {
        border-bottom: solid 1px #000000;
    }
</style>

<telerik:RadGrid ID="applicationsGrid" runat="server" AutoGenerateColumns="false" Skin="Office2007"
    OnInsertCommand="applicationsGrid_InsertCommand"
    OnItemDataBound="applicationsGrid_OnItemDataBound" AllowPaging="true" PageSize="5">

    <PagerStyle Mode="NextPrevAndNumeric" />

    <MasterTableView ShowHeadersWhenNoRecords="true" EnableNoRecordsTemplate="true" AllowSorting="true"
        AutoGenerateColumns="false" CommandItemDisplay="Top"
        AllowAutomaticInserts="false" AllowAutomaticDeletes="false" AllowAutomaticUpdates="false"
        CommandItemSettings-AddNewRecordText="Create New Sunsmart Application" DataKeyNames="SunsmartApplicationId">

        <NoRecordsTemplate>
            No sunsmart applications found.
        </NoRecordsTemplate>

        <Columns>
            <telerik:GridBoundColumn HeaderText="Address Id" DataField="SunsmartApplicationId" ReadOnly="true"
                UniqueName="SunsmartApplicationId" SortExpression="SunsmartApplicationId" Visible="false" />

            <telerik:GridHyperLinkColumn HeaderText="Program" DataTextField="Program.ProgramDesc" NavigateUrl="#"
                Visible="true" UniqueName="Program" SortExpression="Program.ProgramDesc" />

            <telerik:GridBoundColumn HeaderText="Status" DataField="SunsmartApplicationStatu.SunsmartApplicationStatusDesc" UniqueName="SunsmartApplicationStatusDesc"
                SortExpression="SunsmartApplicationStatu.SunsmartApplicationStatusDesc" Visible="true" />

            <telerik:GridBoundColumn HeaderText="Appl Date" DataField="ApplicationDate" UniqueName="ApplicationDate"
                SortExpression="ApplicationDate" Visible="true" />

           <telerik:GridBoundColumn HeaderText="Application Form Status" DataField="ApplicationFormStatu.ApplicationFormStatusDesc "
               UniqueName="ApplicationFormStatusDesc" SortExpression="ApplicationFormStatu.ApplicationFormStatusDesc " />

           <telerik:GridBoundColumn HeaderText="Agreement Status" DataField="AgreementStatu.AgreementStatusDesc"
               UniqueName="AgreementStatusDesc" SortExpression="AgreementStatu.AgreementStatusDesc" />


        </Columns>
        
    </MasterTableView>

</telerik:RadGrid>
Princy
Top achievements
Rank 2
 answered on 09 Mar 2011
3 answers
165 views
Hi all,
           In radgrid i have a column called Employee names in this i will get the value as Employee1|Employee2|Employee3. I need the color change for the value Employee1 should be red color and Employee2 should be Green color and Employee3 should be Blue in color. Please Help me out.

Can you help me figure out what I have to do in radgrid?

Thank you,
Kingsleen Solomon Doss.J
Shinu
Top achievements
Rank 2
 answered on 09 Mar 2011
2 answers
103 views

I have a RadScheduler  with a RadSchedulerContextMenu that shows when the user right clicks an appointment. Inside that RadSchedulerContextMenu, I have several RadMenuItems, some of which are disabled. One of the RadMenuItems is Text="Edit" Value="CommandEdit" Enabled="False", however, it is NOT disabled. The other items are disabled when I set Enabled="false", but not the Edit item.

<telerik:RadSchedulerContextMenu runat="server" ID="ContextMenuNone" Skin="Vista" >  
<Items>    
<telerik:RadMenuItem Text="Edit" Value="CommandEdit" ImageUrl="~/edit.png" Enabled="false" />    
...
</Items>
</telerik:RadSchedulerContextMenu>

 
How can I disable the CommandEdit RadMenuItem?

Robert Helm
Top achievements
Rank 1
 answered on 08 Mar 2011
2 answers
127 views
I have the calendar set to allow multiple selection. Each selected day is going to be stored in the db. The issue I am having is determining what date was unselected from e.SelectedDates. I have found no other function/property to detemine this value.

My goal is simular to this. but even this does not allow me to know what the unselected date was.
http://www.telerik.com/community/forums/aspnet-ajax/calendar/toggle-function.aspx

I am using VS2005 telerik version 2008.1.619.20. I cannot upgrade.

Thanks
Dan
Top achievements
Rank 1
 answered on 08 Mar 2011
6 answers
453 views
Hi,

Am I missing something? The $find is not working for a RadPanelBar, here is the code:

... 
<body topmargin="0" leftmargin="0"
    <form id="form1" runat="server"
    <div> 
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
        </telerik:RadScriptManager> 
        <telerik:RadPanelBar ID="rpbNavigation" runat="server" style="width:100%" Skin="Outlook" EnableViewState="false"
        </telerik:RadPanelBar> 
    </div> 
    </form> 
    <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server"
        <script type="text/javascript"
            checkMain(); 
            function checkMain() { 
                var panelBar = $find("<%= rpbNavigation.ClientID %>"); 
 
                var item = panelBar.findItemByText(Main.selectedModule); 
            } 
        </script> 
    </telerik:RadCodeBlock> 
</body> 
... 

I tried to put the script block on the header tag and in the body tag. If I replace by $get, it works, but then I can't access the findItemByText function. The funny thing is that I use a very similar code on other page and it works, the difference is that I use a RadMenu instead a RadPanelBar.

On, the call to checkMain() would be on the onload event of the body, I tried to move around to see if there was something to do with the timing of this call, but no luck.

Any help is appreciated.

Thanks,
Eduardo
Lorenzo
Top achievements
Rank 1
 answered on 08 Mar 2011
0 answers
165 views
If you change your example page to have the following code-up front code.  When you expand the hierarchical item "About us" the child group height setting goes out the window (see attached img).  Is there anyway around this?

<telerik:RadPanelBar runat="server" ID="RadPanelBar1" >
    <Items>
        <telerik:RadPanelItem Expanded="True" Text="Corporate" ChildGroupHeight="50">
            <Items>
                <telerik:RadPanelItem Text="About us">
                    <Items>
                        <telerik:RadPanelItem Text="News"></telerik:RadPanelItem>
                        <telerik:RadPanelItem Text="Team"></telerik:RadPanelItem>
                    </Items>
                </telerik:RadPanelItem>
                <telerik:RadPanelItem Text="Careers"></telerik:RadPanelItem>
                <telerik:RadPanelItem Text="Careers1"></telerik:RadPanelItem>
                <telerik:RadPanelItem Text="Careers2"></telerik:RadPanelItem>
                <telerik:RadPanelItem Text="Careers3"></telerik:RadPanelItem>
                <telerik:RadPanelItem Text="Careers4"></telerik:RadPanelItem>
                <telerik:RadPanelItem Text="Careers5"></telerik:RadPanelItem>
            </Items>
        </telerik:RadPanelItem>
        <telerik:RadPanelItem Text="Services" ChildGroupHeight="50">
            <Items>
                <telerik:RadPanelItem Text="Products"></telerik:RadPanelItem>
                <telerik:RadPanelItem Text="Solutions"></telerik:RadPanelItem>
                <telerik:RadPanelItem Text="Certifications"></telerik:RadPanelItem>
            </Items>
        </telerik:RadPanelItem>
        <telerik:RadPanelItem Text="Work" ChildGroupHeight="50" >
            <Items>
                <telerik:RadPanelItem Text="Clients"></telerik:RadPanelItem>
                <telerik:RadPanelItem Text="Testimonials"></telerik:RadPanelItem>
                <telerik:RadPanelItem Text="FAQ"></telerik:RadPanelItem>
            </Items>
        </telerik:RadPanelItem>
    </Items>
    <ExpandAnimation Type="None"></ExpandAnimation>
</telerik:RadPanelBar>
Rob
Top achievements
Rank 1
 asked on 08 Mar 2011
3 answers
141 views
Hello Telerik Team,

I have a grid that I bind on the client side.

I want to create a custom filtering column for my grid.  I have successfully derived from GridBoundColumn to create GridFilteringBoundColumn.  I override the SetupFilterControls method and all is well.

However, I also have a GridButtonColumn that I would like to be able to filter on.  If I derive from GridButtonColumn in the same exact way as above, the cells do not get rendered as hyperlinks and clicking on the text in the cell does nothing (I expect it to do a fireCommand with my command name that I assigned.

I have verified with a debugger that the CommandName property is set correctly but I can't figure out why the cells do not render properly. In the browser, when I use the Telerik GridButtonColumn, the cells all contain text of this form:

<a onclick="if(!$find('ctl00_WebPartManager_WorkAreaWebPart_MainControl_WorkAreaGrid_ctl00').fireCommand('DisplayDetails','0')) return false;" href="javascript:__doPostBack('ctl00$WebPartManager$WorkAreaWebPart$MainControl$WorkAreaGrid$ctl00$ctl04$ctl01','')">J1542A</a><br>

but with my derived Column, all I get is simpletext after the grid binds on the client side.

What am I missing?

Thanks
Bob

Marin
Telerik team
 answered on 08 Mar 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?