Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
155 views
Hello,

In my web application, I have a master page with a RadScriptManager control.  I'm getting the following error on page load:

Could not load file or assembly 'System.Windows,Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' orone of its dependencies. The system cannot find the file specified.


Based on the stack trace, the error appears to be thrown from the RadScriptManager constructor:

[FileNotFoundException: Could not load file or assembly 'System.Windows, Version=2.0.5.0, Culture=neutral,
PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified.]
   System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 
   	typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0 
   System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] 
   	typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +180   
   System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] 
	genericMethodArguments) +192   System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord 
	caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, 
	MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[]
	attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean&
	ctorHasParameters, Boolean& isVarArg) +115   
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, 
	Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean 
	isDecoratedTargetSecurityTransparent) +426   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly
	assembly, RuntimeType caType) +103   
   System.Reflection.RuntimeAssembly.GetCustomAttributes(Boolean inherit) +33   
   System.Web.UI.AssemblyCache.GetAjaxFrameworkAssemblyAttribute(Assembly assembly) +76   
   System.Web.UI.ScriptManager.get_DefaultAjaxFrameworkAssembly() +388   
   System.Web.UI.ScriptManager..ctor() +26   
   Telerik.Web.UI.RadScriptManager..ctor() +14
The error only occurs the first time I load a page after a build of the application.  As soon as I refresh the page, the error goes away and the application functions as expect.

The error started occurring as soon as I added a Silverlight 3 application in my web app project.

Why are RadScriptManager and the .NET ScriptManager attempting to load a Silverlight dll?  Obviously, this dll is not in the bin directory of the web app.  Any ideas as to how I can make this error go away?

I'm using VS 2010, .NET 4.0, Silverlight 3, and Telerik RadControls for ASP.NET Ajax version 2010.1.415.40.

Thanks,
Andy
Simon
Telerik team
 answered on 09 Mar 2011
1 answer
169 views
Hello...

I have a main page with a lot of content and a RadTabStrip with 2 tabs... 
I load a local page on my Tab. That page has a javascript variable called "map"

So,  In main page I have a html button. When the user click it I´m supposed to get the Iframe variable "map" (from tab) and play with it...
How can I get that variable ?

Thanks
Dimitar Terziev
Telerik team
 answered on 09 Mar 2011
2 answers
141 views
Hi There,

I have treeview with 2 and 3 level sub node. On click of each node i am loading the iframe on right side. i want disable the clicking of root nodes because on click of root nodes nothing should happen.Is it possible to disable the root node clicking or just disable the root nodes
and also the treeview is fullExpanded state.
Goutham
Top achievements
Rank 1
 answered on 09 Mar 2011
1 answer
197 views

I have inherited an application from a previous developer and I am having problems with the speed of the RadTreeList he has previously implemented.

 


The Treelist is a representation of a dealer hierarchy where the sub branches roll up to a principal dealer within a country.

 


Eg Principal Dealer 11020000

 

Has branches:  11020001, 11020002, 11020003

 


For each row we are displaying name and address information as well as image buttons that allow a dealer to be selected/assigned to a role holder or for all dealers for a principal to be selected at principal level.

 


This is using the NeedDataSource event.

 

 


Now I am caching data from my SQL Server 2008 datasource wherever I can but I am finding that expanding nodes at principal level and performing updates is painfully slow. Even at it’s largest for a single country the treelist only has around 2000 records and the round trips to the server to get data and perform updates look pretty quick.

 


I have been through all of the performance tips on the site but nothing seems to be improving it i.e.  RadCompression etc.

 


Can you suggest anything that might be available to improve performance?


<telerik:RadAjaxPanel ID="RadAjaxPanel3" LoadingPanelID="RadAjaxLoadingPanel2" runat="server">
    <telerik:RadTreeList AutoGenerateColumns="false" runat="server" ID="RadTreeList3"  
        ShowTreeLines="false" AllowMultiItemSelection="true" DataKeyNames="DLR_CD" ParentDataKeyNames="DLR_PRNCPL_ACC_CD"
        OnNeedDataSource="RadTreeList3_NeedDataSource" OnDataBound="RadTreeList3_DataBound"
        AllowPaging="true" PageSize="10" OnItemDataBound="RadTreeList3_ItemDataBound"
        OnItemCreated="RadTreeList3_ItemCreated">
        <Columns>
            <telerik:TreeListTemplateColumn HeaderText="Dealer" DataField="DLR_CD" UniqueName="DLR_CD">
                <ItemTemplate>
                    <asp:Label ID="lblDlrCd" runat="server" Text='<%# Eval("DLR_CD") %>' />
                    <asp:Label ID="Label1" Width="20px" runat="server" />
                    <asp:ImageButton ID="btnSelectAll" ToolTip="Click to assign all dealers for Principal"
                        Visible="false" OnClick="btnSelectAll_OnClick" runat="server" ImageUrl="~/Images/ok_16.png" />
                    <asp:ImageButton ID="btnUnSelectAll" ToolTip="Click to un-assign all dealers for Principal"
                        Visible="false" OnClick="btnUnSelectAll_OnClick" runat="server" ImageUrl="~/Images/remove_16.png" />
                    <asp:HiddenField ID="hdDlrPrin" runat="server" Value='<%# Eval("DLR_PRNCPL_ACC_CD") %>' />
                    <asp:HiddenField ID="hdUser" runat="server" Value='<%# Eval("USR_BUSN_ROLE_ID") %>' />
                    <asp:HiddenField ID="hdDlrUsr" runat="server" Value='<%# Eval("DLR_USR_MAP_ID") %>' />
                </ItemTemplate>
            </telerik:TreeListTemplateColumn>
            <telerik:TreeListTemplateColumn HeaderText="Assign?">
                <ItemTemplate>
                    <asp:ImageButton ID="btnSelect" ToolTip="Click to assign this dealer" Visible="false"
                        OnClick="btnSelect_OnClick" runat="server" ImageUrl="~/Images/ok_16.png" />
                    <asp:ImageButton ID="btnUnSelect" ToolTip="Click to un-assign this dealer" Visible="false"
                        OnClick="btnUnSelect_OnClick" runat="server" ImageUrl="~/Images/remove_16.png" />
                </ItemTemplate>
            </telerik:TreeListTemplateColumn>
            <telerik:TreeListTemplateColumn HeaderText="Dealer Assigned">
                <ItemTemplate>
                    <asp:Panel ID="pnlTick" runat="server">
                        <asp:Label ID="lblTick" runat="server" Text="Y" Style="font-weight: bold;"></asp:Label>
                    </asp:Panel>
                </ItemTemplate>
            </telerik:TreeListTemplateColumn>
            <telerik:TreeListBoundColumn DataField="DLR_NM" UniqueName="DLR_NM" HeaderText="Name" />
            <telerik:TreeListBoundColumn DataField="DLR_ADDR1" UniqueName="DLR_ADDR1" HeaderText="Address 1" />
            <telerik:TreeListBoundColumn DataField="DLR_POST_CD" UniqueName="DLR_POST_CD" HeaderText="Post Code" />
            <telerik:TreeListBoundColumn DataField="DLR_CITY" UniqueName="DLR_CITY" HeaderText="City" />
            <telerik:TreeListBoundColumn DataField="DLR_VISN_REGN_NM" UniqueName="DLR_VISN_REGN_NM"
                HeaderText="Region" />
        </Columns>
    </telerik:RadTreeList>


protected void RadTreeList3_NeedDataSource(object sender, TreeListNeedDataSourceEventArgs e)
    {
        try
        {
            if (Dlr_Cd != null && Dlr_Cd != string.Empty)
            {
                txFind.Text = Dlr_Cd;
                Dlr_Cd = string.Empty;
            }  
  
            GetData(Cntry_Cd, (txFind.Text.Trim() != string.Empty ? txFind.Text.Trim() : string.Empty),Brand_ID);
            RadTreeList3.DataSource = cache_Data;
        }
        catch (Exception ex)
        {
            string s = ex.Message;
        }
    }
  
  
  
 protected void GetData(string cntry, string dlr_nm,string brand_id)
    {
        if (cache_Data == null || cache_Data.Tables.Count == 0)
        {
            CDMAI cDMAI = new CDMAI();
            cDMAI.DLR_MyDealer_List_All(cntry, dlr_nm,brand_id );
            cache_Data = cDMAI.RetDataSet;
        }
    }

Veli
Telerik team
 answered on 09 Mar 2011
9 answers
327 views
Hi,

I'm using Telerik RadControls Q1 2008. I have a Rad Menu on the masterpage of my application and i'm trying to bind it to a linq datacontext.

The binding works fine but my problem is That Child Items are always displayed as root items.

I have checked that ParentId of all roots items is NULL and of all the child items is that of the assigned parent. 

Below is the code :

Private Sub LoadMenuItems()
 
      Dim MenuDC As New MenuItemDataContext
 
      RadMenu1.DataSource = MenuDC.usp_TABLE_MENU_ITEM_Select().ToList()
      RadMenu1.DataBind()
   End Sub
<telerik:RadMenu ID="RadMenu1" runat="server" Skin="Office2007" DataFieldID="MENU_ITEM_ID"
                 DataFieldParentID="PARENT_ID" DataNavigateUrlField="PAGE_URL" DataTextField="MENU_ITEM_NAME"
                  DataValueField="MENU_ITEM_ID">
                <DefaultGroupSettings ExpandDirection="Down" />
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                 
                </telerik:RadMenu>

I do not know what i'm missing here.

Yana
Telerik team
 answered on 09 Mar 2011
5 answers
528 views
Hi,

I have a simple rad tree view to which I am dynamically adding the nodes.
But the nodeclick event is not getting fired.
I have even tried setting "PostBack" fot the nodes to "true" but it didn't solve my problem.
Below is my code(.ascx)-

<

 

telerik:RadAjaxLoadingPanel ID="radajaxloadingpanelAssociateEntities" runat="server" Transparency="50">

 

 

<div id="divLoadingPnl" runat="server" style="position: absolute; left: 400px; top: 250px">

 

 

<asp:Image ID="imgLoading" runat="server" AlternateText="Loading..." ImageUrl="~/wpresources/PIMS/Images/progress.gif"/>

 

 

</div>

 

 

</telerik:RadAjaxLoadingPanel>

 

 

<telerik:RadAjaxPanel ID="radajaxpanelAssociateEntities" LoadingPanelID="radajaxloadingpanelAssociateEntities"

 

 

runat="server" Height="650px" Width="948px">

 

 

<table border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 100%">

 

 

<tr style="width: 100%; height: 50%">

 

 

<td style="width: 278px">

 

 

<telerik:RadTreeView runat="server" ID="radtvFolderStructure"

 

 

OnLoad="radtvFolderStructure_Load" style="position: relative"

 

 

OnNodeClick="radtvFolderStructure_NodeClick" >

 

 

</telerik:RadTreeView>

 

 

</td><td>

 

 

<telerik:RadGrid ID="rdgDocuments" runat="server" Height="325" Width="670" Skin="Hay">

 

 

</telerik:RadGrid>

 

 

</td></tr><tr><td></td><td>

 

 

<telerik:RadGrid ID="rdgComments" runat="server" Height="325" Width="670" Skin="Hay">

 

 

</telerik:RadGrid>

 

 

</td></tr>

 

 

</table>

 

 

</telerik:RadAjaxPanel>

 


Can anyone please help me out with this?

PS-I am using radControls for asp .net ajax version Q2 2008.

Thanks iN Advance,
Abhishek
Yana
Telerik team
 answered on 09 Mar 2011
1 answer
122 views
Hi,

I've had this problem for a while and have not found a solution. When using a Shared Calender with the RadAjaxManager, the pop-up only works the 1st time. Here is the simplest implementation of the example.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
    <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
  
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <%--Needed for JavaScript IntelliSense in VS2010--%>
            <%--For VS2008 replace RadScriptManager with ScriptManager--%>
            <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"></telerik:RadAjaxManager>
    <div id="divContent" runat="server">
        <telerik:RadCalendar ID="RadCalendar1" Runat="server"></telerik:RadCalendar>
    </div>
    </form>
</body>
</html>
using System;
using System.Drawing;
using Telerik.Web.UI;
  
public partial class Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        LoadDatesShared();
    }
  
    void LoadDatesShared()
    {
        for (int i = 0; i < 10;i++ )
        {
            RadDatePicker rdp = new RadDatePicker();
            rdp.SharedCalendar = RadCalendar1;
            rdp.AutoPostBack = true;
            rdp.ID = "rdp" + i.ToString();
            rdp.SelectedDateChanged += new Telerik.Web.UI.Calendar.SelectedDateChangedEventHandler(rdp_SelectedDateChanged);
            divContent.Controls.Add(rdp);
            RadAjaxManager1.AjaxSettings.AddAjaxSetting(rdp, rdp);
        }
    }
  
    void rdp_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e)
    {
        ((RadDatePicker)sender).BackColor = Color.LightGreen;
    }
  
}

Thanks !
Tsvetina
Telerik team
 answered on 09 Mar 2011
3 answers
396 views
Hi,

I am trying to change the border and background DateInput control. I would like to change the border to red with yellow background, and the triangle with ! in middle if possible or something to that affect. I tried a Custom Validator but with no luck. I would settle for a red border around the Data Input text box.

I have tried every which way; but to no success..Can this be done? If so, any suggestions?

Thanks in advance,
Gary
telerik:RadDatePicker ID="datepicker" runat="server"  ClientEvents-OnDateSelected="DateValidator"
        MaxDate="2100-12-31" MinDate="1900-01-01"
        Culture="English (United States)" SelectedDate="2011-03-01" >
 
    <Calendar runat="server" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x" FastNavigationStep="12" ></Calendar>
    <DatePopupButton ImageUrl="" HoverImageUrl="" CssClass=""></DatePopupButton>
 
    <DateInput ID="DI" runat="server" CausesValidation="true" DisplayDateFormat="M/d/yyyy" DateFormat="M/d/yyyy"
        LabelCssClass="" Width="" SelectedDate="2011-03-01"  
        <ClientEvents OnValueChanged="ValueChanged"/>
     </DateInput>
 
  </telerik:RadDatePicker>
</form>
</body>
</html>
 
<telerik:RadScriptBlock  ID="SOSRadScriptBlock" runat="server">
    <script type='text/javascript'>
 
        function ValueChanged(sender, args) {
  
            var dtv = $find(sender.controltovalidate).get_dateInput();
            var temp = args.Value.trim();
            if (temp != " " && !!temp) {
                args.IsValid = true;             
            } else {
                //date input value is either null or has a space
                dtv._invalid = true;
                  
                 //Below is the last approach I tried to change the style
                dtv.get_styles().InvalidStyle[0] += "background-color: lemonchiffon;";
                dtv.updateCssClass();
                args.IsValid = false;
 
            }
    </script>
</telerik:RadScriptBlock>
Maria Ilieva
Telerik team
 answered on 09 Mar 2011
1 answer
167 views

Hi,

1) I want a header in which there will be one main heading and under it there can be sub headings, the main header will span across its multiple sub headings, user can sort the grid by clicking on the sub headings. Please refer to the "UI.jpg"

2) The requirement is like i will be needing the Radgrid as usercontrol, which we will bind on Page. when we run the page, the screen looks fine except for the Merged Columns where in we need the headings and the Subheadeing, refer "Screenshot1.JPG"

The second issue which we I am facing is, The rad grd will have horizontal scroll and first 3 columns would be frozed.
But when we try to freeze the columns we face the following issues:

a) When we scroll, the complete alignment of the grid gets messed up, and one Grid line remains there and shows up in the middle of all scrolling columns. Refer "Screenshot2.JPG" .

b) After we scroll, the horizontal scroll itself disappears. Refer "Screenshot3.JPG" .

c) If we change the page size in pagination, the pagination also disappears. Refer "Screenshot4.JPG" .

Please refer to the code as well, We have created a user control "uclFleet.ascx" which we register in our page "Test_Fleet.aspx".

Please reply on an urgent basis.

Thanks.

<!--User control .ascx file-->
    
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="uclFleet.ascx.cs" Inherits="UserControls_uclFleet" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    
    
<telerik:RadScriptManager runat="server" ID="RadScriptManager1" /> 
<script type="text/javascript"
    function fnGridCreated(sender, args) { 
           
        var scrollArea = sender.GridDataDiv; 
        var dataHeight = sender.get_masterTableView().get_element().clientHeight; 
        if (dataHeight < 350) { 
            scrollArea.style.height = dataHeight + 10 + "px"; 
        
    
</script> 
       
                <telerik:RadGrid ID="tlrkDgrFleet" runat="server" EnableViewState="true" CellPadding="0"
                    CellSpacing="0" GridLines="Both" Width="750px"
                    Skin="Office2007" HeaderStyle-Font-Size="8pt" 
                    HeaderStyle-Font-Bold="true" AllowPaging="true" ShowHeader="true" OnNeedDataSource="tlrkDgrFleet_NeedDataSource" OnItemDataBound="tlrkDgrFleet_OnItemDataBound"
                        
                    <MasterTableView CellPadding="0" CellSpacing="0" Width="99%" TableLayout="Fixed" ShowHeader="true" AutoGenerateColumns="false"
                        AllowPaging="true" ShowFooter="false"
                            
                        <Columns
                            <telerik:GridTemplateColumn HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="50px"
                                UniqueName="SerialNo" ItemStyle-HorizontalAlign="Right"
                                <HeaderTemplate
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%"
                                        <tr
                                            <td style="border: 0" rowspan="2"
                                                Serial 
                                                <br /> 
                                                No. 
                                            </td
                                        </tr
                                    </table
                                </HeaderTemplate
                                   
                                <ItemTemplate
                                    <asp:Label ID="lblSerialNo" runat="server"><%# Eval("A") %></asp:Label
                                </ItemTemplate
                            </telerik:GridTemplateColumn
                            <telerik:GridTemplateColumn HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="100px"
                                UniqueName="ColHeader" ItemStyle-HorizontalAlign="left"
                               <HeaderTemplate
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%"
                                        <tr
                                            <td style="width:100%" colspan="2"
                                                Column header 
                                                <br /><hr /> 
                                            </td
                                        </tr
                                        <tr
                                            <td
                                                Sub Col A 
                                            </td
                                            <td
                                                Sub Col B 
                                            </td
                                        </tr>                                         
                                    </table
                                </HeaderTemplate
                                <ItemTemplate
                                 <table border="0" cellpadding="0" cellspacing="0"
                                            
                                        <tr
                                            <td
                                                <asp:Label ID="lblA" runat="server" ><%# Eval("B") %></asp:Label
                                            </td
                                            <td
                                                <asp:Label ID="lblE" runat="server"><%# Eval("C") %></asp:Label
                                            </td
                                        </tr>                                         
                                    </table
                                        
                                    
                                    
                                       
                                </ItemTemplate
                            </telerik:GridTemplateColumn
                           <telerik:GridTemplateColumn HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="100px"
                                UniqueName="Delivery" ItemStyle-HorizontalAlign="left"
                               <HeaderTemplate
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%"
                                        <tr
                                            <td style="border: 1" colspan="2"
                                                Delivery<br /><hr /> 
                                            </td
                                        </tr
                                        <tr
                                            <td
                                                Owner 
                                            </td
                                            <td
                                                Operator 
                                            </td
                                        </tr>                                         
                                    </table
                                </HeaderTemplate
                                <ItemTemplate
                                    <asp:Label ID="lblOwn" runat="server"><%# Eval("D") %></asp:Label
                                </ItemTemplate
                                <ItemTemplate
                                    <asp:Label ID="lblOper" runat="server"><%# Eval("E") %></asp:Label
                                </ItemTemplate
                            </telerik:GridTemplateColumn
                                
                            <telerik:GridTemplateColumn HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="150px"
                                UniqueName="Current" ItemStyle-HorizontalAlign="left"
                               <HeaderTemplate
                                    <table border="0" cellpadding="0" cellspacing="0"
                                        <tr
                                            <td style="border:0" colspan="3"
                                                Current<br /><hr /> 
                                            </td
                                        </tr
                                        <tr
                                            <td
                                                Own 
                                            </td
                                            <td
                                                LEAST 
                                            </td
                                            <td
                                                SLE123 
                                            </td
                                        </tr>                                         
                                    </table
                                </HeaderTemplate
                                <ItemTemplate
                                   <table border="0" cellpadding="0" cellspacing="0"
                                           
                                        <tr
                                            <td
                                                <asp:Label ID="lblCurrOwn" runat="server"><%# Eval("F") %></asp:Label
                                            </td
                                            <td
                                                <asp:Label ID="lblCurrLE" runat="server"><%# Eval("G")%></asp:Label
                                            </td
                                            <td
                                                <asp:Label ID="lblCurrSLE" runat="server"><%# Eval("H") %></asp:Label
                                            </td
                                        </tr>                                         
                                    </table
                                        
                                </ItemTemplate>                                 
                                    
                            </telerik:GridTemplateColumn
                             <telerik:GridTemplateColumn HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="50px"
                                UniqueName="Future" ItemStyle-HorizontalAlign="left"
                                <HeaderTemplate
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%"
                                        <tr
                                            <td style="border: 0" rowspan="2"
                                                Future 
                                                <br /> 
                                                Owner 
                                            </td
                                        </tr
                                    </table
                                </HeaderTemplate
                                <ItemTemplate
                                    <asp:Label ID="lblr" runat="server"><%# Eval("I") %></asp:Label
                                </ItemTemplate
                            </telerik:GridTemplateColumn
                            <telerik:GridTemplateColumn  HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="50px"
                                UniqueName="Bus" ItemStyle-HorizontalAlign="left"
                                <HeaderTemplate
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%"
                                        <tr
                                            <td style="border: 0" rowspan="2"
                                                Bus 
                                                <br /> 
                                                Contract 
                                            </td
                                        </tr
                                    </table
                                </HeaderTemplate
                                <ItemTemplate
                                    <asp:Label ID="lblBusCon" runat="server"><%# Eval("J") %></asp:Label
                                </ItemTemplate
                            </telerik:GridTemplateColumn
                            <telerik:GridTemplateColumn  HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="50px"
                                UniqueName="Number" ItemStyle-HorizontalAlign="left"
                                <HeaderTemplate
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%"
                                        <tr
                                            <td style="border: 0" rowspan="2"
                                                House 
                                                <br /> 
                                                Number 
                                            </td
                                        </tr
                                    </table
                                </HeaderTemplate
                                <ItemTemplate
                                    <asp:Label ID="lblNo" runat="server"><%# Eval("K") %></asp:Label
                                </ItemTemplate
                            </telerik:GridTemplateColumn
                            <telerik:GridTemplateColumn  HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="50px"
                                UniqueName="CurrentSet" ItemStyle-HorizontalAlign="left"
                                <HeaderTemplate
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%"
                                        <tr
                                            <td style="border: 0" rowspan="2"
                                                Current 
                                                <br /> 
                                                Set. 
                                            </td
                                        </tr
                                    </table
                                </HeaderTemplate
                                <ItemTemplate
                                    <asp:Label ID="lblCurrentSet" runat="server"><%# Eval("L") %></asp:Label
                                </ItemTemplate
                            </telerik:GridTemplateColumn
                            <telerik:GridTemplateColumn  HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="50px"
                                UniqueName="LaneNo" ItemStyle-HorizontalAlign="left"
                                <HeaderTemplate
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%"
                                        <tr
                                            <td style="border: 0" rowspan="2"
                                                Lane 
                                                <br /> 
                                                No. 
                                            </td
                                        </tr
                                    </table
                                </HeaderTemplate
                                <ItemTemplate
                                    <asp:Label ID="lblLaneNo" runat="server"><%# Eval("M") %></asp:Label
                                </ItemTemplate
                            </telerik:GridTemplateColumn
                            <telerik:GridTemplateColumn  HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="50px"
                                UniqueName="PurDate" ItemStyle-HorizontalAlign="center"
                                <HeaderTemplate
                                    <table border="0" cellpadding="0" cellspacing="0" width="100%"
                                        <tr
                                            <td style="border: 0" rowspan="2"
                                                Purchase 
                                                <br /> 
                                                Date 
                                            </td
                                        </tr
                                    </table
                                </HeaderTemplate
                                <ItemTemplate
                                    <asp:Label ID="lblDeliveryDate" runat="server"><%# Eval("N") %></asp:Label
                                </ItemTemplate
                            </telerik:GridTemplateColumn
                                
                        </Columns
                    </MasterTableView
                   <ClientSettings>   
        <Scrolling AllowScroll="true" FrozenColumnsCount= "3" UseStaticHeaders="true" SaveScrollPosition="true" />   
  <ClientEvents OnGridCreated="fnGridCreated" /> 
    </ClientSettings
    
                </telerik:RadGrid>
//User Control uclFleet.ascx.cs file 
    
using System; 
using System.Data; 
using System.Configuration; 
using System.Collections; 
using System.Web; 
using System.Web.Security; 
using System.Web.UI; 
using Telerik.Web.UI; 
using System.Text; 
    
public partial class UserControls_uclFleet : System.Web.UI.UserControl 
        
    protected void tlrkDgrFleet_NeedDataSource(object source, 
         Telerik.Web.UI.GridNeedDataSourceEventArgs e) 
    
        DataTable dt = new DataTable(); 
        dt.Columns.Add("A"); 
        dt.Columns.Add("B");      
        dt.Columns.Add("C"); 
        dt.Columns.Add("D"); 
        dt.Columns.Add("E"); 
        dt.Columns.Add("F"); 
        dt.Columns.Add("G"); 
        dt.Columns.Add("H"); 
        dt.Columns.Add("I"); 
        dt.Columns.Add("J"); 
        dt.Columns.Add("K"); 
        dt.Columns.Add("L"); 
        dt.Columns.Add("M"); 
        dt.Columns.Add("N"); 
        for (int i = 0; i < 10; i++) 
        
            DataRow dr; 
            dr = dt.NewRow(); 
            dr["A"] = "1234"; 
            dr["B"] = "ABCD - hjkl"; 
            dr["C"] = "123-90"; 
            dr["D"] = "13434"; 
            dr["E"] = "1545"; 
            dr["F"] = "1656"; 
            dr["G"] = "1453"; 
            dr["H"] = "15435"; 
            dr["I"] = "5341"; 
            dr["J"] = "1345"; 
            dr["K"] = "135"; 
            dr["L"] = "135"; 
            dr["M"] = "1345"; 
            dr["N"] = "11/07/2010"; 
    
            dt.Rows.Add(dr); 
            DataRow dr1; 
            dr1 = dt.NewRow(); 
            dr1["A"] = "1234"; 
            dr1["B"] = "AWER - POUT"; 
            dr1["C"] = "123-90"; 
            dr1["D"] = "13434"; 
            dr1["E"] = "1545"; 
            dr1["F"] = "1656"; 
            dr1["G"] = "ASD"; 
            dr1["H"] = "15435"; 
            dr1["I"] = "DSFSF"; 
            dr1["J"] = "1345"; 
            dr1["K"] = "135"; 
            dr1["L"] = "EWEWR"; 
            dr1["M"] = "1345"; 
            dr1["N"] = "11/07/2010"; 
    
            dt.Rows.Add(dr1); 
        
        tlrkDgrFleet.DataSource = dt; 
    
    
    protected void tlrkDgrFleet_OnItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    
           
    
}
<!-- Test_Fleet.aspx-->
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test_Fleet.aspx.cs" Inherits="Test_Fleet" %> 
<%@ Register Src="~/UserControls/uclFleet.ascx" TagName="uclFleet" TagPrefix="uc2" %> 
<%@ 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></title
</head
<body
    <form id="form1" runat="server"
      
<table style="table-layout:fixed" width="100%"><tr><td
    <uc2:uclFleet ID="uclFleet" runat="server" />  </td></tr
   </table
     
       
    </form
</body
</html>
Pavlina
Telerik team
 answered on 09 Mar 2011
1 answer
89 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?