Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
461 views
Hello.
Excuse me if my english is not well.
i have a textbox column in radgrid.
<telerik:GridTemplateColumn  SortExpression="score" HeaderText="score" HeaderButtonType="TextButton"
                    DataField="score" UniqueName="score" ReadOnly="true">
                       <ItemTemplate>
                           <telerik:RadTextBox runat="server">
 
                           </telerik:RadTextBox>
                       </ItemTemplate>
                   </telerik:GridTemplateColumn>

and a button . 
how can i get value of each textbox by clicking button ?
for example row with id=1 >> textbox=15
actually i'm looking for bulk data submit.in edit mode i can submit values row by row and it's time consuming.
if there is any other option please tell me.
thank you
shervinrv
Top achievements
Rank 1
 answered on 23 Sep 2014
3 answers
228 views
Hello


I have a RadComboBox that updates two RadGrids, each with a detail table that has a command button which opens a different RadWindow containing another RadGrid, and I'm running into errors when trying to apply RadAjaxManager controls to the page. Everything is working fine until I set the second grid (uxRolesRG)  to update its window (RoleAvailUsers), which causes the page to throw a JScript runtime error whenever a new value is selected in the RadComboBox.



Error:
0x800a139e - Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Collection was modified; enumeration operation may not execute.
 
If there is a handler for this exception, the program may be safely continued.


Default.aspx:
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="Applications_Default" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <telerik:RadScriptBlock ID="RSBlock1" runat="server">
        <script type="text/javascript">
            function ShowAddRoleWindow(sender, args) {
                $find("<%=AddUserRoleRW.ClientID%>").show();
            }
 
            function ShowAddUserWindow(sender, args) {
                $find("<%=AddRoleUserRW.ClientID%>").show();
            }
        </script>
    </telerik:RadScriptBlock>
    <telerik:RadAjaxManager ID="uxAjaxManager" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="uxAppSelectCB">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="uxUserRG" />
                    <telerik:AjaxUpdatedControl ControlID="uxRolesRG" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="uxUserRG">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="UserAvailRoles" LoadingPanelID="UserAvailRolesLW" />
                    <telerik:AjaxUpdatedControl ControlID="AddUserRoleUN" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="uxRolesRG">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RoleAvailUsers" LoadingPanelID="RoleAvailUsersLW" />
                    <telerik:AjaxUpdatedControl ControlID="AddRoleUserUN" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <asp:Label ID="AddUserRoleUN" runat="server" Visible="false" />
    <asp:Label ID="AddRoleUserUN" runat="server" Visible="false" />
    <telerik:RadComboBox ID="uxAppSelectCB" AllowCustomText="true" runat="server" DataSourceID="AppListODS" DataValueField="ApplicationId" DataTextField="ApplicationName" MarkFirstMatch="true" AutoPostBack="true" />
    <telerik:RadWindow ID="AddUserRoleRW" runat="server">
        <ContentTemplate>
            <telerik:RadAjaxLoadingPanel ID="UserAvailRolesLW" runat="server" />
            <telerik:RadGrid ID="UserAvailRoles" runat="server" DataSourceID="UserRolesUnassignedODS" AutoGenerateColumns="false" AllowAutomaticUpdates="true" AllowAutomaticInserts="false">
                <MasterTableView EditMode="Batch" DataKeyNames="RoleId" CommandItemDisplay="Top" AllowPaging="true" PageSize="40">
                    <BatchEditingSettings OpenEditingEvent="MouseOver" />
                    <CommandItemSettings ShowAddNewRecordButton="false" ShowRefreshButton="false" />
                    <Columns>
                        <telerik:GridCheckBoxColumn UniqueName="GrantCB" HeaderStyle-Width="30px" DataField="IsSelected" />
                        <telerik:GridBoundColumn DataField="RoleName" HeaderText="Role" ReadOnly="true" />
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
        </ContentTemplate>
    </telerik:RadWindow>
    <telerik:RadWindow ID="AddRoleUserRW" runat="server">
        <ContentTemplate>
            <telerik:RadAjaxLoadingPanel ID="RoleAvailUsersLW" runat="server" />
            <telerik:RadGrid ID="RoleAvailUsers" runat="server" DataSourceID="RoleUsersUnassignedODS" AutoGenerateColumns="false" AllowAutomaticUpdates="true" AllowAutomaticInserts="false">
                <MasterTableView EditMode="Batch" DataKeyNames="UserId" CommandItemDisplay="Top" AllowPaging="true" PageSize="40">
                    <BatchEditingSettings OpenEditingEvent="MouseOver" />
                    <CommandItemSettings ShowAddNewRecordButton="false" ShowRefreshButton="false" />
                    <Columns>
                        <telerik:GridCheckBoxColumn UniqueName="AddCB" HeaderStyle-Width="30px" DataField="IsSelected" />
                        <telerik:GridBoundColumn DataField="FirstName" HeaderText="First Name" ReadOnly="true" />
                        <telerik:GridBoundColumn DataField="LastName" HeaderText="Last Name" ReadOnly="true" />
                        <telerik:GridBoundColumn DataField="UserName" HeaderText="User Name" ReadOnly="true" />
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
        </ContentTemplate>
    </telerik:RadWindow>
    <telerik:RadTabStrip runat="server" ID="uxAdminModeStrip" Orientation="HorizontalTop" SelectedIndex="0" MultiPageID="uxAdminModeMP">
        <Tabs>
            <telerik:RadTab Text="Manage By User" TabIndex="0" />
            <telerik:RadTab Text="Manage By Role" TabIndex="1" />
        </Tabs>
    </telerik:RadTabStrip>
    <telerik:RadMultiPage runat="server" ID="uxAdminModeMP" SelectedIndex="0" Width="100%">
 
        <%--Page: By User--%>
        <telerik:RadPageView runat="server" ID="uxByUserPV" TabIndex="0">
            <telerik:RadGrid ID="uxUserRG" runat="server" DataSourceID="UserListODS" AutoGenerateColumns="false">
                <MasterTableView DataKeyNames="UserId" AllowFilteringByColumn="true" AllowSorting="true">
                    <DetailTables>
                        <telerik:GridTableView DataKeyNames="RoleId" Name="uxUserRolesRG" AutoGenerateColumns="false" runat="server" DataSourceID="UserRolesODS" AllowAutomaticDeletes="true" CommandItemDisplay="Top">
                            <CommandItemTemplate>
                                <telerik:RadButton ID="AddUserRoleRB" runat="server" CommandName="AddRoles" OnClientClicked="ShowAddRoleWindow" AutoPostBack="true" Text="Add Roles" ButtonType="SkinnedButton" />
                            </CommandItemTemplate>
                            <CommandItemSettings ShowAddNewRecordButton="false" />
                            <ParentTableRelation>
                                <telerik:GridRelationFields DetailKeyField="UserId" MasterKeyField="UserId" />
                            </ParentTableRelation>
                            <Columns>
                                <telerik:GridBoundColumn DataField="RoleName" HeaderText="Role Name" ReadOnly="true" />
                                <telerik:GridBoundColumn DataField="Description" HeaderText="Description" ReadOnly="true" />
                                <telerik:GridButtonColumn CommandName="Delete" HeaderText="Remove" ButtonType="PushButton" Text="X" />
                            </Columns>
                        </telerik:GridTableView>
                    </DetailTables>
                    <Columns>
                        <telerik:GridBoundColumn DataField="UserName" HeaderText="User Name" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" />
                        <telerik:GridBoundColumn DataField="FirstName" HeaderText="First Name" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" />
                        <telerik:GridBoundColumn DataField="LastName" HeaderText="Last Name" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" />
                        <telerik:GridCheckBoxColumn DataField="IsLockedOut" HeaderText="Locked" AllowFiltering="false" />
                        <telerik:GridCheckBoxColumn DataField="IsArchive" HeaderText="Archived" AllowFiltering="false" />
                        <telerik:GridDateTimeColumn DataField="LastActivityDate" HeaderText="Last Active" DataFormatString="{0:dd/MM/yyyy}" CurrentFilterFunction="GreaterThanOrEqualTo" AutoPostBackOnFilter="true" />
                    </Columns>
                </MasterTableView>
                <GroupingSettings CaseSensitive="false" />
            </telerik:RadGrid>
        </telerik:RadPageView>
 
        <%--Page: By Role--%>
        <telerik:RadPageView runat="server" ID="uxByRolePV" TabIndex="1">
            <telerik:RadGrid ID="uxRolesRG" runat="server" DataSourceID="RoleListODS" AutoGenerateColumns="false">
                <MasterTableView DataKeyNames="RoleId" AllowFilteringByColumn="true" AllowSorting="true">
                    <DetailTables>
                        <telerik:GridTableView DataKeyNames="UserId" Name="uxRoleUsersRG" AutoGenerateColumns="false" runat="server" DataSourceID="RoleUsersODS" AllowAutomaticDeletes="true" CommandItemDisplay="top">
                            <CommandItemTemplate>
                                <telerik:RadButton ID="AddRoleUserRB" runat="server" CommandName="AddUsers" OnClientClicked="ShowAddUserWindow" AutoPostBack="true" Text="Add Users" ButtonType="SkinnedButton" />
                            </CommandItemTemplate>
                            <CommandItemSettings ShowAddNewRecordButton="false" />
                            <ParentTableRelation>
                                <telerik:GridRelationFields DetailKeyField="RoleId" MasterKeyField="RoleId" />
                            </ParentTableRelation>
                            <Columns>
                                <telerik:GridBoundColumn DataField="UserName" HeaderText="User Name" />
                                <telerik:GridBoundColumn DataField="FirstName" HeaderText="First Name" />
                                <telerik:GridBoundColumn DataField="LastName" HeaderText="Last Name" />
                                <telerik:GridCheckBoxColumn DataField="IsLockedOut" HeaderText="Locked" />
                                <telerik:GridCheckBoxColumn DataField="IsArchive" HeaderText="Archived" />
                                <telerik:GridDateTimeColumn DataField="LastActivityDate" HeaderText="Last Active" DataFormatString="{0:dd/MM/yyyy}" />
                                <telerik:GridButtonColumn CommandName="Delete" HeaderText="Remove" ButtonType="PushButton" Text="X" />
                            </Columns>
                        </telerik:GridTableView>
                    </DetailTables>
                    <Columns>
                        <telerik:GridBoundColumn DataField="RoleName" HeaderText="Role Name" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" />
                        <telerik:GridBoundColumn DataField="Description" HeaderText="Description" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" />
                        <telerik:GridCheckBoxColumn DataField="IsActive" HeaderText="Active" AllowFiltering="false" />
                        <telerik:GridCheckBoxColumn DataField="IsLocked" HeaderText="Locked" AllowFiltering="false" />
                        <telerik:GridDateTimeColumn DataField="CreateDate" HeaderText="Created" DataFormatString="{0:dd/MM/yyyy}" CurrentFilterFunction="GreaterThanOrEqualTo" AutoPostBackOnFilter="true" />
                        <telerik:GridDateTimeColumn DataField="ModifyDate" HeaderText="Modified" DataFormatString="{0:dd/MM/yyyy}" CurrentFilterFunction="GreaterThanOrEqualTo" AutoPostBackOnFilter="true" />
                    </Columns>
                </MasterTableView>
                <GroupingSettings CaseSensitive="false" />
            </telerik:RadGrid>
        </telerik:RadPageView>
    </telerik:RadMultiPage>
 
    <%--ODS For Dropdown--%>
    <asp:ObjectDataSource ID="AppListODS" runat="server" TypeName="Applications" SelectMethod="GetApplicationsWithAccessRights" />
 
    <%--ODS For Base Grids--%>
    <asp:ObjectDataSource ID="UserListODS" runat="server" TypeName="Applications" SelectMethod="GetApplicationUsers">
        <SelectParameters>
            <asp:ControlParameter ControlID="uxAppSelectCB" Name="ApplicationId" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="RoleListODS" runat="server" TypeName="Applications" SelectMethod="GetApplicationRoles">
        <SelectParameters>
            <asp:ControlParameter ControlID="uxAppSelectCB" Name="ApplicationId" />
        </SelectParameters>
    </asp:ObjectDataSource>
 
    <%--ODS For Detail Tables--%>
    <asp:ObjectDataSource ID="UserRolesODS" runat="server" TypeName="Applications" SelectMethod="GetUserApplicationRoles" DeleteMethod="DeleteUserRole">
        <SelectParameters>
            <asp:ControlParameter ControlID="uxAppSelectCB" Name="ApplicationId" />
            <asp:Parameter Name="UserId" />
        </SelectParameters>
        <DeleteParameters>
            <asp:Parameter Name="UserId" />
            <asp:Parameter Name="RoleId" />
        </DeleteParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="RoleUsersODS" runat="server" TypeName="Applications" SelectMethod="GetUsersWithRole" DeleteMethod="DeleteRoleUser">
        <SelectParameters>
            <asp:Parameter Name="RoleId" />
        </SelectParameters>
        <DeleteParameters>
            <asp:Parameter Name="UserId" />
            <asp:Parameter Name="RoleId" />
        </DeleteParameters>
    </asp:ObjectDataSource>
 
    <%--ODS For Add Window--%>
    <asp:ObjectDataSource ID="UserRolesUnassignedODS" runat="server" TypeName="Applications" SelectMethod="GetUserUngrantedRoles" UpdateMethod="BatchInsertUserRole">
        <SelectParameters>
            <asp:ControlParameter ControlID="uxAppSelectCB" Name="ApplicationId" />
            <asp:Parameter Name="UserId" />
        </SelectParameters>
        <UpdateParameters>
            <asp:ControlParameter ControlID="AddUserRoleUN" Name="UserId" />
        </UpdateParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="RoleUsersUnassignedODS" runat="server" TypeName="Applications" SelectMethod="GetRoleUngrantedUsers" UpdateMethod="BatchInsertRoleUser">
        <SelectParameters>
            <asp:Parameter Name="RoleId" />
        </SelectParameters>
        <UpdateParameters>
            <asp:ControlParameter ControlID="AddRoleUserUN" Name="RoleId" />
        </UpdateParameters>
    </asp:ObjectDataSource>
</asp:Content>



Default.aspx.vb
Imports Telerik.Web.UI
 
Partial Class Applications_Default
    Inherits System.Web.UI.Page
 
    Protected Sub Page_Init(sender As Object, e As EventArgs) Handles Me.Init
        If Not Page.IsPostBack Then
            uxAppSelectCB.SelectedIndex = 0
            uxRolesRG.Rebind()
            uxUserRG.Rebind()
        End If
    End Sub
 
    Protected Sub uxUserRG_ItemCommand(sender As Object, e As GridCommandEventArgs) Handles uxUserRG.ItemCommand
        If e.Item.OwnerTableView.DataSourceID.Equals("UserRolesODS") Then
            Dim UserId = e.Item.OwnerTableView.ParentItem.GetDataKeyValue("UserId").ToString()
            If e.CommandName.Equals("Delete") Then
                UserRolesODS.DeleteParameters("UserId").DefaultValue = UserId
            ElseIf e.CommandName.Equals("AddRoles") Then
                UserRolesUnassignedODS.SelectParameters("UserId").DefaultValue = UserId
                AddUserRoleUN.Text = UserId
                UserAvailRoles.Rebind()
            End If
        End If
    End Sub
 
 
    Protected Sub uxRolesRG_ItemCommand(sender As Object, e As GridCommandEventArgs) Handles uxRolesRG.ItemCommand
        If e.Item.OwnerTableView.DataSourceID.Equals("RoleUsersODS") Then
            Dim RoleId = e.Item.OwnerTableView.ParentItem.GetDataKeyValue("RoleId").ToString()
            If e.CommandName.Equals("Delete") Then
                RoleUsersODS.DeleteParameters("RoleId").DefaultValue = RoleId
            ElseIf e.CommandName.Equals("AddUsers") Then
                RoleUsersUnassignedODS.SelectParameters("RoleId").DefaultValue = RoleId
                AddRoleUserUN.Text = RoleId
                RoleAvailUsers.Rebind()
            End If
        End If
    End Sub
End Class



Maria Ilieva
Telerik team
 answered on 23 Sep 2014
3 answers
172 views
Hi,

I need to be able to show / hide (toggle) all columns in a grid view where the columns name begins with (A).  I've search and found this script:

function HideColumn(index)
           {
               var columnCount = RadGrid1.get_masterTableView().get_columns().length - 1;
               if (index < 0 || index > columnCount)
               {
                   alert("Invalid index! The valid range is: " + 0 + "-" + columnCount);
               }
               else
               {
                   RadGrid1.get_masterTableView().hideColumn(index);
               }
           }


Does anybody have any suggestions how it could be tailored to accomplish my goals?
Angel Petrov
Telerik team
 answered on 23 Sep 2014
4 answers
82 views
Hello!

I have a user control that searches recursively for an radajaxmanger in its page hierarchy. Then the control adds its components that should be ajaxified like that:

ajaxManager.AjaxSettings.AddAjaxSetting(btnEditValues, gridPanel, radLoadingPanel);

the page hierarchy looks like that

Page (with the Ajax Manager)
-Control
--gridPanel
---btnEditValues

Now every control in the gridPanel makes an ajaxpostback as well.
When I try to exclude the control from the AjaxRequest with a javascript (OnRequestStart for example) the Clientside event "OnRequestStart" is not even called. But still an ajax postback is made.

I successfully excluded other controls from the postback, like "btnEditValues".

Is it possible that control that are the updated ones a somehow implicitly the updating ones as well ??

I'm really stuck here...

thx in advance for your help,

kind regards,
 M
Steven
Top achievements
Rank 1
 answered on 23 Sep 2014
0 answers
72 views
I am trying to write a javascript code.  This is code I have right now.

<script type='text/javascript'>
function onCheckBoxClickctl00_Content_ddc1_CB1(){
var combo=$find('ctl00_Content_ddc1_CB1');
 var CountChecked=0;
var text='This is the text message';
var max ='4';
var items = combo.get_items();
for(var i=0;i<items.get_count();i++){
var item=items.getItem(i);
var chk1=$get(combo.get_id()+'_i'+i+'_chk1');
if(chk1.checked){
CountChecked ++;
if(max < CountChecked) {
chk1.checked = false;
}
text+=item.get_text()+',';
 if(CountChecked > 3)
{ text = 'You have ' + CountChecked  + ' items selected :';}
}
}
 text=removeLastDelimiter(text);
if(text.length>0){combo.set_text(text);}else{combo.set_text('');}}
</script>

if(text.length>0){combo.set_text(text);}else{combo.set_text('');}}

I would like to write the text in the first line of the drop down.  Something like items._array[0].set_text(text).  But when I did this I get an error.  Can you please tell me how to do this.

Thank you
Kalyani
Top achievements
Rank 1
 asked on 22 Sep 2014
2 answers
107 views
Does anybody know how to hide all grid items in MastertableView and DetailTableVies after clicking on "Add new item" button?
I wont to Display only the insert form and hide all ofter GridView elements:


​
protected void GrdTicketsItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == RadGrid.InitInsertCommandName)
    {
        // show insert form works fine
        e.Item.OwnerTableView.EditFormSettings.UserControlName = "BackendControls/AddBillingAndTicket.ascx";
        e.Item.OwnerTableView.EditFormSettings.EditFormType = GridEditFormType.WebUserControl;
        e.Item.OwnerTableView.InsertItem();
 
        // How to hide all items in MasterTableView and all DetailsTables?
        // this doesn't work:
        foreach (GridDataItem item in GrdTickets.Items)
            item.Visible = false;
    }
}


Thank you for your help.
Christopher
kzimny
Top achievements
Rank 1
 answered on 22 Sep 2014
1 answer
88 views
I am working on a project that requires complex conditional validation and I want to be able to access the controls in the edit template on the server validate event. I have looked through the object model and I am not seeing anything I can use to access the page values. Any clues?

During an edit I can use the RadGrid1.EditItems but insert there are none there.
Jayesh Goyani
Top achievements
Rank 2
 answered on 22 Sep 2014
1 answer
92 views
Hi,

I have a  radgrid and the the radgrid is set to autogenerated columns =  true. Once the radcombo box is changed the grid should have null data and the columns are added based on listbox source to destination selection. Though i Make the Datasource = null i still see the column names. Do i have the ability to make the total grid empty and with no columns and rows . 

Thanks in advance,

Vamsi
Jayesh Goyani
Top achievements
Rank 2
 answered on 22 Sep 2014
1 answer
90 views
Hi,

I have a radgrid control that has 3 nested gridtableview within it. I'd like to
have button on the client side that expands a particular gridtableview when
clicked. I would expect it to expand all the gridtableview (i.e. 1 per row of
parent grid).

Any suggestions as to how I can set this up?
Pavlina
Telerik team
 answered on 22 Sep 2014
2 answers
273 views

Hi,

Plesae let us know how to achieve the following.

1. Avoid loading the user control in nested view template when outer grid/page loads.
2. Allow loading of user control ONLY for the expanded row of the outer grid.

Find below the source code to work on. Any prompt help on this is really appreciated.
Note: The source code really doesn't have any parent and child relation in the data that it displays because it just a sample.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="NVT._Default" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Src="PlayerDetails.ascx" TagName="PlayerDetails" TagPrefix="Player" %>
  
<!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">
    <div>
        <telerik:RadScriptManager ID="scriptManager" runat="server"></telerik:RadScriptManager>
        <telerik:RadGrid ID="grdPlayers" runat="server" OnNeedDataSource="GetPlayers" AutoGenerateColumns="true"
         OnItemCommand="grdPlayers_ItemCommand" OnItemCreated="grdPlayers_ItemCreated" >
            <MasterTableView>
                <NestedViewTemplate>
                    <asp:Panel runat="server" ID="InnerContainer" Visible="false">
                        <Player:PlayerDetails id="ucPlayerDetails" runat="server"></Player:PlayerDetails>
                    </asp:Panel>
                </NestedViewTemplate>
            </MasterTableView>
        </telerik:RadGrid>
    </div>
    </form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Data;
  
namespace NVT
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
  
        }
  
        protected void GetPlayers(object source, GridNeedDataSourceEventArgs e)
        {
            DataSet dsPlayers = new DataSet();
            DataTable tblPlayers = new DataTable();
            tblPlayers.Columns.Add("Name");
            tblPlayers.Columns.Add("Age");
  
            tblPlayers.Rows.Add("Sachin", "36");
            tblPlayers.Rows.Add("Virender", "30");
  
            dsPlayers.Tables.Add(tblPlayers);
  
            grdPlayers.DataSource = dsPlayers;
        }
  
        protected void grdPlayers_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName == RadGrid.ExpandCollapseCommandName && e.Item is GridDataItem)
            {
                ((GridDataItem)e.Item).ChildItem.FindControl("InnerContainer").Visible =
                    !e.Item.Expanded;
            }
        }
  
        protected void grdPlayers_ItemCreated(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridNestedViewItem)
            {
                e.Item.FindControl("InnerContainer").Visible = ((GridNestedViewItem)e.Item).ParentItem.Expanded;
            }
        }
    }
}
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PlayerDetails.ascx.cs" Inherits="NVT.PlayerDetails" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
  
<telerik:RadGrid ID="grdPlayerDetails" runat="server" AutoGenerateColumns="true">
</telerik:RadGrid>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Telerik.Web.UI;
  
namespace NVT
{
    public partial class PlayerDetails : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            GetPlayerDetails();
            grdPlayerDetails.DataBind();
        }
  
        protected void GetPlayerDetails()
        {
            DataSet dsPlayerDetails = new DataSet();
            DataTable tblPlayerDetails = new DataTable();
            tblPlayerDetails.Columns.Add("Name");
            tblPlayerDetails.Columns.Add("Age");
  
            tblPlayerDetails.Rows.Add("Sachin", "36");
            tblPlayerDetails.Rows.Add("Virender", "30");
  
            dsPlayerDetails.Tables.Add(tblPlayerDetails);
  
            grdPlayerDetails.DataSource = dsPlayerDetails;
        }
    }
}

Thanks,
Kishore

Ángel
Top achievements
Rank 1
 answered on 22 Sep 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?