Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
148 views
Hi,

I would like to know if I can have a column in the master grid that it's a sum of child column?

For example, I have a master "invoices" grid with the "invoice lines" child grid. In the "invoices" grid I want a column with the total price of invoice, calculated from the sum of price column in "invoice lines" grid.

It's possible?
Regards
Jose
Jose
Top achievements
Rank 2
 answered on 24 Mar 2011
1 answer
337 views
Hi.
I have the following scenario:
I'm presenting grouped data in a RadGrid and on the group headers I would like to include an edit button for editing the group concept. The group concept in this case is units.
The sub data under units should also have an edit button, but this i can achieve.

I currently have two problems:
Whenever I try to add a control according to any of the examples i find in the forums, the control appears underneath/behind the minimize icon. I can't figure out how to put the control at the rightmost position in the header row.

My second problem is that i don't really understand how I'm suppose to pass the required value of my concept id (unitId) to the GroupHeaderItem in the ItemCreated event.

I have tried to subtract the code from my project and attached it below.

Best regards
Richard Furberg

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;
  
public partial class test : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
  
    }
    public class ExtendedRadGrid : RadGrid
    {
        public Int32 Year { get; set; }
    }
  
    protected void Page_Init(Object sender, EventArgs e)
    {
        RadScriptManager radScriptManager = new RadScriptManager();
        this.form1.Controls.Add(radScriptManager);
        RadAjaxLoadingPanel radAjaxLoadingPanel = new RadAjaxLoadingPanel() { ID = "radAjaxLoadingPanel", Skin = "Default" };
        RadAjaxPanel radAjaxPanel = new RadAjaxPanel() { LoadingPanelID = "radAjaxLoadingPanel" };
        RadTabStrip radTabStrip = new RadTabStrip() { Skin = "Default", AutoPostBack = true, MultiPageID = "radMultiPage", SelectedIndex = 0 };
        RadMultiPage radMultiPage = new RadMultiPage() { RenderSelectedPageOnly = true, ID = "radMultiPage", SelectedIndex = 0 };
  
        int[] years = new int[] { 2010, 2011 };
  
        foreach (int year in years)
        {
            radTabStrip.Tabs.Add(new RadTab(year.ToString(), "RadTabID" + year.ToString()) { PageViewID = "PageViewID" + year.ToString() });
  
            ExtendedRadGrid radGrid = new ExtendedRadGrid();
  
            radGrid.PageSize = 20;
            radGrid.Skin = "Windows7";
            radGrid.Width = Unit.Percentage(100);
            radGrid.PagerStyle.Mode = GridPagerMode.Slider;
            radGrid.MasterTableView.TableLayout = GridTableLayout.Fixed;
            radGrid.Year = year;
            radGrid.NeedDataSource += new GridNeedDataSourceEventHandler(radGrid_NeedDataSource);
            radGrid.FilterMenu.ExpandAnimation.Type = AnimationType.None;
            radGrid.FilterMenu.CollapseAnimation.Type = AnimationType.None;
            radGrid.AllowSorting = true;
            radGrid.AllowPaging = true;
            radGrid.ShowStatusBar = true;
            radGrid.ShowFooter = true;
            radGrid.AllowFilteringByColumn = true;
            radGrid.FilterMenu.EnableShadows = true;
            radGrid.FilterMenu.EnableRoundedCorners = true;
            radGrid.ClientSettings.AllowDragToGroup = false;
            radGrid.AutoGenerateColumns = false;
            radGrid.ShowGroupPanel = false;
            radGrid.GroupingEnabled = true;
            radGrid.GroupingSettings.GroupByFieldsSeparator = "    -    ";
            radGrid.GroupHeaderItemStyle.CssClass = "HeaderItem";
            radGrid.ItemCreated += RadGrid1_ItemCreated;
            radGrid.MasterTableView.DataKeyNames = new string[] { "RoleCompensationID", "UnitCompensationID" };
            //----------------------------------------------------------------------------------
            //Bound columns
  
            GridBoundColumn gridBoundColumn;
  
            gridBoundColumn = new GridBoundColumn();
            gridBoundColumn.DataField = "Title";
            gridBoundColumn.HeaderText = "Title";
            gridBoundColumn.FooterText = "Title";
            radGrid.MasterTableView.Columns.Add(gridBoundColumn);
  
            GridTemplateColumn gridTemplateColumn = new GridTemplateColumn();
            radGrid.MasterTableView.Columns.Add(gridTemplateColumn);
  
            //----------------------------------------------------------------------------------
            //GroupByExpressions
  
            GridGroupByExpression expression = new GridGroupByExpression();
            GridGroupByField gridGroupByField;
  
            //SelectFields
            gridGroupByField = new GridGroupByField();
            gridGroupByField.FieldName = "UnitName";
            gridGroupByField.HeaderText = " ";
            gridGroupByField.HeaderValueSeparator = " ";
            expression.SelectFields.Add(gridGroupByField);
  
            gridGroupByField = new GridGroupByField();
            gridGroupByField.FieldName = "UnitCompensationID";
            gridGroupByField.HeaderText = " ";
            gridGroupByField.HeaderValueSeparator = " ";
            gridGroupByField.FormatString = " ";
            expression.SelectFields.Add(gridGroupByField);
  
            //GroupByField
            gridGroupByField = new GridGroupByField();
            gridGroupByField.FieldName = "UnitName";
            gridGroupByField.HeaderText = " ";
            gridGroupByField.HeaderValueSeparator = " ";
            expression.GroupByFields.Add(gridGroupByField);
  
            radGrid.MasterTableView.GroupByExpressions.Add(expression);
            //----------------------------------------------------------------------------------
  
            RadPageView radPageView = new RadPageView() { ID = "PageViewID" + year };
            radPageView.Controls.Add(radGrid);
            radMultiPage.PageViews.Add(radPageView);
        }
  
        radAjaxPanel.Controls.Add(new LiteralControl("<div style='margin-bottom:-1px;'>"));
        radAjaxPanel.Controls.Add(radTabStrip);
        radAjaxPanel.Controls.Add(new LiteralControl("</div>"));
  
        radAjaxPanel.Controls.Add(radMultiPage);
        this.form1.Controls.Add(radAjaxLoadingPanel);
        this.form1.Controls.Add(radAjaxPanel);
  
    }
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem dataItem = e.Item as GridDataItem;
            dataItem.Attributes.Add("onClick", "alert('" + dataItem.GetDataKeyValue("RoleCompensationID") + "')"); // No problem getting the required id value.
        }
        else if (e.Item is GridGroupHeaderItem)
        {
            GridGroupHeaderItem gridGroupHeaderItem = e.Item as GridGroupHeaderItem;
            DataRowView groupDataRow = (DataRowView)gridGroupHeaderItem.DataItem;
            Button objButton = new Button();
            objButton.CommandName = "Add";
            objButton.ID = "Button_Add";
            objButton.Text = groupDataRow["UnitCompensationID"].ToString(); // Here i created an extra gridGroupByField in selectFields with an empty FormatString for passing ID value. I'm sure there must be a better way...
            ((GridTableCell)gridGroupHeaderItem.Controls[0]).Controls.Add(objButton); 
        }
    }
  
    void radGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        //Here I'm retrieving and setting a DataTable as DataSource
    }
}
Shinu
Top achievements
Rank 2
 answered on 24 Mar 2011
1 answer
75 views
Hello. 
I have noticed that when I pass:
<pre>
&#60;a&#62;test&#60;/a&#62;
</pre>

or

<pre>
&lt;a&&gt;test&lt;/a&gt;
</pre>

into the editor it automatically converts it to the following when I look in the HTML view:

<pre>
<a>test</a>
</pre>

Is there a way that I can configure the editor to not automatically decode my < and > symbols?

I am currently using the 2010.2.929.35 release.

thanks.
Rumen
Telerik team
 answered on 24 Mar 2011
1 answer
264 views
Hi,

For my reporting purpose I am using telerik grid, however, I am blocked in one area.

My requirement is:

Suppose I have grid for Employee list with individual details like, Name, designation, joining date which contains single value. Now I have some columns which contains more than 1 value. I have created relational table to  store those values against employeeID.
For this we'll take an example of Languages:
For employee I have added 3 languages with each proficiency level
Language Proficiency Level
------------   ---------------------
English  Fluent
Portugal  Conversational
Hindi   Native 

so in employee table there is one record and in relational table record as like above
Now when I will show record into grid, client is expecting like this
Employee Name  Designation                    Languages
ABC                        Software Engineer           English-Fluent; Portugal-Conversational; Hindi-Native

Is it possible to do this. There are other work around for this like cursor, temp table or in C# code. But I want to do this single query if possible.

Please help me out.

Regards,
Avinash
                                               


Pavlina
Telerik team
 answered on 24 Mar 2011
4 answers
202 views

.Net 3.5
Telerik 2010.3.1317.35

I have a datagrid that has defined columns, and autogenerated columns are set to false,
The dataseource is a datatable and all my databindings are set on datatextfields.

on itemdatabound i compare two of the fields ((int)maxRead and (int)maxNote) and depending on the result i set the row font to bold (to show unread posts)

but as soon as i group any of the columns i get,
"maxRead is neither a DataColumn nor a DataRelation for table GroupedTable0."

I tried adding the maxRead as a defined column in the grid but that gave the same result.

heres my code,
i get the error on the "if ((int)drw["maxRead"] != (int)drw["maxNote"

])'" row below.

 

 

 

 

 

 

protected void grCaseList_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item.DataItem is DataRowView)
        {
            DataRowView drw = (DataRowView)e.Item.DataItem;
            if ((int)drw["maxRead"] != (int)drw["maxNote"])
            {
                e.Item.Font.Bold = true;
            }
        }
    }


<telerik:RadGrid ID="grCaseList" runat="server" Skin="Windows7" 
    AllowPaging="True" AllowSorting="True" GridLines="None" ShowGroupPanel="True" 
        Width="100%" AutoGenerateColumns="False" 
        onitemdatabound="grCaseList_ItemDataBound">
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Windows7"></HeaderContextMenu>
  
    <MasterTableView EnableColumnsViewState="false">
        <CommandItemSettings ExportToPdfText="Export to Pdf">
        </CommandItemSettings>
        <RowIndicatorColumn>
            <HeaderStyle Width="20px"></HeaderStyle>
        </RowIndicatorColumn>
        <ExpandCollapseColumn>
            <HeaderStyle Width="20px"></HeaderStyle>
        </ExpandCollapseColumn>
        <Columns>
            <telerik:GridHyperLinkColumn DataTextField="cs_id" DataType="System.Int32" 
                FilterControlAltText="Filter cs_id column" HeaderText="ID" 
                UniqueName="cs_id" DataNavigateUrlFields="caseUrl">
            </telerik:GridHyperLinkColumn>
            <telerik:GridHyperLinkColumn DataTextField="cs_header" 
                FilterControlAltText="Filter cs_header column" HeaderText="Rubrik" 
                UniqueName="cs_header" DataNavigateUrlFields="caseUrl">
            </telerik:GridHyperLinkColumn>
            <telerik:GridHyperLinkColumn DataTextField="nt_us_name" 
                FilterControlAltText="Filter nt_us_name column" HeaderText="Senast ändrad av" 
                UniqueName="nt_us_name">
            </telerik:GridHyperLinkColumn>
            <telerik:GridDateTimeColumn DataField="cs_timePosted" 
                FilterControlAltText="Filter cs_timePosted column" HeaderText="Inlagt" 
                UniqueName="cs_timePosted" DataFormatString="{0:yy-MM-dd hh:mm}">
            </telerik:GridDateTimeColumn>
            <telerik:GridDateTimeColumn DataField="cs_timePlanned" 
                DataType="System.DateTime" FilterControlAltText="Filter cs_timePlanned column" 
                HeaderText="Planerat" UniqueName="cs_timePlanned" DataFormatString="{0:yy-MM-dd hh:mm}">
            </telerik:GridDateTimeColumn>
            <telerik:GridDateTimeColumn DataField="cs_timeClosed" 
                FilterControlAltText="Filter cs_timeClosed column" HeaderText="Avslutat" 
                UniqueName="cs_timeClosed" DataFormatString="{0:yy-MM-dd hh:mm}">
            </telerik:GridDateTimeColumn>
            <telerik:GridBoundColumn DataField="cs_fromIP" 
                FilterControlAltText="Filter cs_fromIP column" HeaderText="IP" 
                UniqueName="cs_fromIP">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="cs_fritext" 
                FilterControlAltText="Filter cs_fritext column" HeaderText="Fritext" 
                UniqueName="cs_fritext">
            </telerik:GridBoundColumn>
            <telerik:GridHyperLinkColumn DataTextField="cs_fromComputerName" 
                FilterControlAltText="Filter cs_fromComputerName column" HeaderText="Dator" 
                UniqueName="cs_fromComputerName">
            </telerik:GridHyperLinkColumn>
            <telerik:GridBoundColumn DataField="st_name" 
                FilterControlAltText="Filter st_name column" HeaderText="Status" 
                UniqueName="st_name">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="ty_name" 
                FilterControlAltText="Filter ty_name column" HeaderText="Typ" 
                UniqueName="ty_name">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="prio" 
                FilterControlAltText="Filter prio column" HeaderText="Prio" UniqueName="prio">
            </telerik:GridBoundColumn>
            <telerik:GridDateTimeColumn DataField="nt_timePosted" 
                FilterControlAltText="Filter nt_timePosted column" HeaderText="Uppdaterad" 
                UniqueName="nt_timePosted" DataFormatString="{0:yy-MM-dd hh:mm}">
            </telerik:GridDateTimeColumn>
            <telerik:GridHyperLinkColumn DataTextField="cs_us_name" 
                FilterControlAltText="Filter cs_us_name column" HeaderText="Inlagt av" 
                UniqueName="cs_us_name">
            </telerik:GridHyperLinkColumn>
            <telerik:GridHyperLinkColumn DataTextField="adm_ad_username" 
                FilterControlAltText="Filter adm_ad_username column" HeaderText="Ansvarig" 
                UniqueName="adm_ad_username">
            </telerik:GridHyperLinkColumn>
            <telerik:GridBoundColumn DataField="maxRead" 
                FilterControlAltText="Filter maxRead column" HeaderText="maxRead" 
                UniqueName="maxRead" Visible="False">
            </telerik:GridBoundColumn>
        </Columns>
  
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
    </MasterTableView>
    <ClientSettings AllowDragToGroup="True">
    </ClientSettings>
  
<FilterMenu EnableImageSprites="False"></FilterMenu>
</telerik:RadGrid>


Page load,
dsHelpdeskG2.caseListDataTable dtCases = null;
  
if (((AdManager.UserInfo)Session[Common.userSession]).Status == AdManager.LoginStatus.User)
{
    dsHelpdeskG2TableAdapters.caseListTableAdapter taCases = new dsHelpdeskG2TableAdapters.caseListTableAdapter();
dtCases = taCases.caseListUser(((AdManager.UserInfo)Session[Common.userSession]).AnstId);
}
grCaseList.DataSource = dtCases;
grCaseList.DataBind();
Christian
Top achievements
Rank 1
 answered on 24 Mar 2011
3 answers
240 views
Well, that's basically what I want to do. I want to programmatically create PageViews on the server side, along with tabs. Couldn't find an example for the views. Any help?
Helen
Telerik team
 answered on 24 Mar 2011
5 answers
88 views
Take the following code and paste it into the editor in HTML mode...
<html>
    <head>
        <title></title>
        <style type="text/css">
            OL LI {LIST-STYLE-TYPE: upper-roman;}
            OL LI OL LI {LIST-STYLE-TYPE: upper-alpha;}
            OL LI OL LI OL LI {LIST-STYLE-TYPE: decimal;}
        </style>
    </head>
    <body>
        <ol>
            <li>Test...
            <ol>
                <li>add sub bullet after this item...
                </li>
                <li>it most likely got formatted with an "A" and not a "1"<br />
                <ol>
                    <li>It should have been a 1 like this line</li>
                </ol>
                </li>
            </ol>
            </li>
        </ol>
    </body>
</html>
Flip back to design view and it looks great. Then in design view add a sub bullet to bullet A. It will be formatted with an "A" instead of a "1" that the css style defines. But, if you switch back to HTML view and then back to Design view the formatting is correct. Am I doing something wrong or is this a known issue?
Rumen
Telerik team
 answered on 24 Mar 2011
3 answers
107 views
Hello

I installed the new 2011 Q1 telerik dll and now radfileexplorer dosent work. If I build a webpage only containing radscriptmanager and the fileexplorer like this:
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
  <Scripts>
    <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" />
  </Scripts>
</telerik:RadScriptManager>
<div>
<telerik:RadFileExplorer ID="fileexplorer1" runat="server" Width="500" Height="500"></telerik:RadFileExplorer>
</div>

I get this error:

No property or field 'error' exists in type 'DataRowView'


What could be the reason for this?
Dobromir
Telerik team
 answered on 24 Mar 2011
2 answers
447 views
V Q1/2011

I could not find in the documentation an explanation for the callbackFnName parameter of RadWindowManager.RadAlert.
It works for me when I have null there, but I am just guessing.


Svetlina Anati
Telerik team
 answered on 24 Mar 2011
1 answer
68 views
hi

i want to get loading panel on radgrid selected index changed event how to do it
Shinu
Top achievements
Rank 2
 answered on 24 Mar 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?