Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
108 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
320 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
3 answers
216 views
I have a RadProgressArea on the page to track a specific operation.  I find, however, when the page is posted back for an unrelated operation that it starts polling.  How would you stop it from polling on all postbacks and focus just on the specific operation I want it to?
Hristo Valyavicharski
Telerik team
 answered on 22 Sep 2014
2 answers
114 views
For Custom filtering it is only working for "No filter" option. and for any other option e.g. "EqualTo" it is not even postbacking sometime.

I am attaching my sorted list (which is according to filter options) to grid.But it is still showing  except "No filter".i.e. all over inconsistant behaviour is there. 

I am using "ItemCommand" Event. and binding all data in "needDatasource" event.
Kostadin
Telerik team
 answered on 22 Sep 2014
1 answer
355 views
I have this grid with auto generated columns and Edit/Delete buttons. Both buttons are appearing on the left of the data columns.
How can I get them one on the left and one on the right of the auto generated columns?

Thanks,
Felice

<telerik:RadGrid ID="RadGrid1" runat="server" Culture="it-IT" AllowPaging="True" AllowSorting="True" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True">
                <ExportSettings ExportOnlyData="True">
                    <Pdf PageWidth="">
                    </Pdf>
                </ExportSettings>
                <ClientSettings>
                    <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                </ClientSettings>
                <MasterTableView CommandItemDisplay="Top" DataKeyNames="Code" InsertItemPageIndexAction="ShowItemOnCurrentPage">
                    <CommandItemSettings ShowExportToExcelButton="True" />
                    <Columns>
                        <telerik:GridEditCommandColumn ButtonType="ImageButton">
                            <HeaderStyle Width="30px" />
                        </telerik:GridEditCommandColumn>
                        <telerik:GridButtonColumn ButtonType="ImageButton" Text="Delete" CommandName="Delete" FilterControlAltText="Filter column1 column" ConfirmDialogType="RadWindow" ConfirmText="Do you really want to delete this project and all its content?" UniqueName="Cancel">
                            <HeaderStyle Width="30px" />
                        </telerik:GridButtonColumn>
                    </Columns>


                    <EditFormSettings>
                        <EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn>
                    </EditFormSettings>
                    <PagerStyle AlwaysVisible="True" />
                </MasterTableView>
                <PagerStyle AlwaysVisible="True" />
            </telerik:RadGrid>
Pavlina
Telerik team
 answered on 22 Sep 2014
3 answers
188 views
With respect to the attached image, I would like to adjust toolbar button formatting to match the panel bar.

For each I have applied CSS to adjust the default Metro Touch background colors. The toolbar includes additional borders or effects that I would like to go away, or at least be the same color as the background. Border color is obviously not the correct answer.

.rpExpanded {
    background-color:#3586CE  !important;
}
 
.rpSelected {
    background-color:#3586CE  !important;
}
 
.wwgToolbar {
      background-color:#3586CE  !important;
border-color:#3586CE  !important;
}


Dimitar
Telerik team
 answered on 22 Sep 2014
3 answers
205 views
Hi All,

I have radgrid. I have some columns which have HeaderText is different from that of DataFeild column. When i do ExporttoExcel i need to export the HeaderText Column name as First row in the column.
<telerik:GridTemplateColumn DataField="ErrorText" HeaderButtonType="TextButton" HeaderText="Poster Response"
                                               UniqueName="ErrorText" Visible="true"  SortExpression="ErrorText">
                                               <HeaderStyle HorizontalAlign="left" Width="135px" />
                                               <ItemStyle HorizontalAlign="left" />
                                               <ItemTemplate>
                                                   <asp:Label ID="lblErrorText" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ErrorText")%>'>
                                                   </asp:Label>
                                               </ItemTemplate>
                                           </telerik:GridTemplateColumn>
Even i want to export only Visible Columns. For Example in this column i have ErrorText as DataField , Poster Response as HeaderText when i export to excel i want the Poster Response as Column name in Excel instead of ErrorText. Please let me know the solution.
Kostadin
Telerik team
 answered on 22 Sep 2014
1 answer
114 views
I have what I thought was a relatively simple screen layout.  I have a set of RadButtons within a repeater acting as check boxes.  The list is rather long so I've put the repeater inside an ASP:Panel with a vertical scroll bar.  This works perfectly in Chrome and FireFox.  Unfortunately the display is distorted in Internet Explorer 10.  The display of RadButtons extends far beyond the bounds of the panel.  Actually it looks like the labels are scrolling but not the buttons.  

(I see this was a problem back in IE6 & 7???  Tried variations on solutions mentioned back then but no luck so far.)  

Image attached.

 <asp:Panel runat="server" ScrollBars="Vertical" Height="425px">
                    <asp:Repeater runat="server" ID="rpApps" >
                        <HeaderTemplate>
                            <table style="margin-left: auto; margin-right: auto; width: 80%">
                                <tr>
                                    <td style="width: 50%; text-align: center">
                                        <asp:Label Width="225px" ID="label1" runat="server" Font-Bold="true" Text='Application' Font-Names="Arial" Font-Size="Medium"></asp:Label>
                                    </td>
                                    <td style="width: 50%; text-align: center">
                                        <asp:Label Width="75px" ID="label2" runat="server" Font-Bold="true" Text="Select" Font-Names="Arial" Font-Size="Medium"></asp:Label>
                                    </td>
                                </tr>
                            </table>
                        </HeaderTemplate>

                        <ItemTemplate>
                            <table style="margin-left: auto; margin-right: auto; width: 80%">
                                <tr>
                                    <td style="width: 50%; text-align: left">
                                        <asp:Label Width="225px" ID="lblAppDesc" runat="server" Text='<%# Bind("DetDesc") %>' Font-Names="Arial" Font-Size="Small"></asp:Label>
                                    </td>
                                    <td style="width: 50%; text-align: center">
                                        <telerik:RadButton ID="chkSelectApp" runat="server" ButtonType="ToggleButton" Checked='<%# Bind("IsNew") %>' Text="" ToggleType="CheckBox" Font-Names="Arial" Font-Size="Small" AutoPostBack="false" CausesValidation="false" EnableViewState="true">
                                        </telerik:RadButton>
                                    </td>
                                </tr>
                            </table>

                        </ItemTemplate>
                    </asp:Repeater>
                </asp:Panel>
Boris
Top achievements
Rank 1
 answered on 22 Sep 2014
1 answer
228 views
Dear All Telerik Gurus.  I have about 2 years experience of using the radgrid control usually without too much problem.  Everytime I click a button to update the row the DataKeyValue is always null.  I have either gone mad or I am making a school boy error here.  Please see my font end code and serverside code.  Any help would be appreciated.

<telerik:RadGrid ID="radIssues" runat="server" AllowFilteringByColumn="false" AllowSorting="True" nItemCommand="radIssues_ItemCommand" CellSpacing="0" CssClass="grid-float" DataSourceID="ldsIssueLog" ShowStatusBar="True" Skin="Sitefinity" Width="70%">
<MasterTableView AutoGenerateColumns="false" DataSourceID="ldsIssueLog" GroupLoadMode="Client" DataKeyNames="issueID" ClientDataKeyNames="issueID">
 <Columns>
    <telerik:GridBoundColumn DataField="issueID" HeaderText="" UniqueName="issueID" Visible="true">                            </telerik:GridBoundColumn>
                                                                
<telerik:GridBoundColumn DataField="issueTitle" HeaderText="Title" ReadOnly="True" SortExpression="issueTitle" UniqueName="issueTitle"></telerik:GridBoundColumn>
 
<telerik:GridBoundColumn DataField="issueText" HeaderText="Issue" ReadOnly="True" SortExpression="issueText" UniqueName="issueText"></telerik:GridBoundColumn>
 
<telerik:GridBoundColumn DataField="issueDateCreated" HeaderText="Created Date" ReadOnly="True" SortExpression="issueText" UniqueName="issueDateCreated"></telerik:GridBoundColumn>
 
<telerik:GridBoundColumn DataField="createdBy" HeaderText="Created By" ReadOnly="True" SortExpression="issueText" UniqueName="createdBy"></telerik:GridBoundColumn>
 
<telerik:GridBoundColumn DataField="issueDateAmended" HeaderText="Amended Date" ReadOnly="True" SortExpression="issueText" UniqueName="issueDateAmended"></telerik:GridBoundColumn>
                                                                
 <telerik:GridBoundColumn DataField="amendedBy" HeaderText="Amended By" ReadOnly="True" SortExpression="issueText" UniqueName="amendedBy"></telerik:GridBoundColumn>
 
<telerik:GridTemplateColumn AllowFiltering="false" HeaderText="Comment" UniqueName="issueComment">
                                                                    <ItemTemplate>
                                                                        <telerik:RadTextBox ID="txtNote" runat="server" InputType="Text" Rows="2" Text='<%# Eval("issueComment")%>' TextMode="MultiLine">
                                                                        </telerik:RadTextBox>
                                                                    </ItemTemplate>
                                                                </telerik:GridTemplateColumn>
                                                                <telerik:GridTemplateColumn HeaderText="Complete" ItemStyle-Width="100px" UniqueName="chkComplete">
                                                                    <ItemTemplate>
                                                                        <input type="checkbox" id="chkComplete" onclick="checkChangedEvent();" runat="server"
                                                                            checked='<%# Eval("completed")%>' />
                                                                    </ItemTemplate>
                                                                </telerik:GridTemplateColumn>
                                                                <telerik:GridTemplateColumn>
                                                                    <ItemTemplate>
                                                                        <a class="popup-link" href='dlgAddNewIssue.aspx?issueID=<%# Eval("issueID")%>&instructionID=<%=Int32.Parse(Request.QueryString["instructionID"])%>&panelID=<%= Request.QueryString["panelID"]%>&sale=<%= Request.QueryString["sale"]%>' title="Edit Issue">[Edit] </a>
                                                                    </ItemTemplate>
                                                                </telerik:GridTemplateColumn>
                                                                <telerik:GridTemplateColumn>
                                                                    <ItemTemplate>
                                                                        <a class="popup-link" href='dlgRemoveIssue.aspx?issueID=<%# Eval("issueID")%>&instructionID=<%=Int32.Parse(Request.QueryString["instructionID"])%>&panelID=<%= Request.QueryString["panelID"]%>&sale=<%= Request.QueryString["sale"]%>' title="Remove Issue">[Remove] </a>
                                                                    </ItemTemplate>
                                                                </telerik:GridTemplateColumn>
                                                                <telerik:GridButtonColumn ButtonType="PushButton" Text="Completion Note" CommandName="transfer">
                                                                </telerik:GridButtonColumn>
                                                            </Columns>
                                                        </MasterTableView>
                                                    </telerik:RadGrid>
This is the grid above
01.if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item)
02.               {
03.                   GridDataItem item = e.Item as GridDataItem;
04.                   // using DataKey
05.                   string id = item.GetDataKeyValue("IssueID").ToString();
06.                    
07.                   //int issueID;
08. 
09.                   //var issuesIdCheck = item.GetDataKeyValue("issueID").ToString();
10. 
11.                   //if (int.TryParse(item["IssueID"].Text, out issueID))
12.                   //if (int.TryParse(id, out issueID))
13.                   //{
14.                       using (var db = new dataDataContext())
15.                       {
16.                           issue objIssue = db.issues.FirstOrDefault(f => f.issueID == int.Parse(id));
17.                           if (objIssue != null)
18.                           {
19.                               PostCompletionIssue objCompletionNote = new PostCompletionIssue()
20.                               {
21.                                   FK_InstructionID = int.Parse(Request.QueryString["instructionID"]),
22.                                   postCompletionIssueCreatedDate = DateTime.Now,
23.                                   postCompletionText = objIssue.issueText,
24.                                   postCompletionTitle = objIssue.issueTitle
25.                               };
26. 
27.                               db.PostCompletionIssues.InsertOnSubmit(objCompletionNote);
28.                               db.SubmitChanges();
29. 
30.                               RadAjaxPanel5.ResponseScripts.Add(String.Format("$find('{0}').ajaxRequest();",
31.                                   RadAjaxPanel7.ClientID));
32.                               RadAjaxPanel5.Alert("Added to completion notes.");
33. 
34.                           }
35.                       }
36.                   }
This is how I am referencing the datakeyvalue but keeps returning null.
Many thanks

Simon
Radoslav
Telerik team
 answered on 22 Sep 2014
1 answer
125 views
I have a RadEditor control on a page that's working fine and another one in a FancyBox that pops up from that same page. The RadEditor in the FancyBox doesn't work and throws these errors in the console:
'RadEditorCommandList' is undefined
'Telerik' is undefined

This happens only if debug="false" but if debug="true" it works fine, from debugging this behavior I can see that it isn't getting one of the files it needs (ScriptResource.axd) in the first case.

Thanks!
Joana
Telerik team
 answered on 22 Sep 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?