Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
174 views
I want to do something similar to what's demonstrated here: http://demos.telerik.com/aspnet-ajax/grid/examples/programming/multicolumnheaders/defaultcs.aspx but in reverse.

Meaning, I have a set of columns and then I want a 2nd line for that row and the column that's in the second line to span all columns.  See the attached image for a crudely drawn example of what we're trying to make happen.

Anyone have any ideas if it's possible with RadGrid?
Marin
Telerik team
 answered on 07 Jun 2013
2 answers
1.1K+ views
Hi Team,
I have a radgrid with a template column that has numeric values bound to it.
I want to show the sum of all values in a column footer. I tried using Aggregate="Sum" but it gives the sum of values on a single page.
My grid has almost 200 pages and I want to show the sum of ALL values in that column in column footer.

Here is my grid:

<telerik:RadGrid ID="rgGLLineItem" runat="server" OnNeedDataSource="rgGLLineItem_NeedDataSource" OnItemDataBound="rgGLLineItem_ItemDataBound" AllowFilteringByColumn="true" CssClass="GridHieght" ShowFooter="true">
                        <MasterTableView>
                            <Columns>
<telerik:GridTemplateColumn DataField="AmountInLocalCurr" HeaderText="Amount In LocalCurr." UniqueName="AmountInLocalCurrency" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" >
                                    <ItemTemplate>
                                       <asp:Label ID="lblAmountInLocalCurr" runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.AmountInLocalCurr","{0:N}") %>' />
                                       <asp:Label  ID="lblCrDr" runat="server" />
                                    </ItemTemplate>
                                    <FooterStyle HorizontalAlign="Right"/>
                                    <ItemStyle HorizontalAlign="Right" />
                                </telerik:GridTemplateColumn>

</Columns>
                        </MasterTableView>
                      <GroupingSettings CaseSensitive="False" />
                      <ClientSettings Scrolling-AllowScroll="true" Scrolling-UseStaticHeaders="true" ClientEvents-OnMasterTableViewCreating="SetGridHeight"></ClientSettings>
                    </telerik:RadGrid>


Another problems is with the Filters. As this column is Template column, with no specific data type specified, I think it should accept string input as well. Because,  in ItemDataBound Event, I am setting a text to the label lblCrDr , Cr or Dr depending upon the value of a column.

This is the DataBound Event:

 if (e.Item is GridDataItem)
                {
                    GridDataItem item = e.Item as GridDataItem;

                    Label lblCrDr = (Label)item.FindControl("lblCrDr");

                    if (item["AccountJournalEventCRDR"].Text == "1")
                    {
                        lblCrDr.ForeColor = System.Drawing.Color.Red;
                        lblCrDr.Text = "(Cr) ";
                    }
                    if (item["AccountJournalEventCRDR"].Text == "2")
                    {
                        lblCrDr.ForeColor = System.Drawing.Color.Gray;
                        lblCrDr.Text = "(Dr) ";
                    }
                }

Could you please help me on this?
Any help appreciated.

Thanks,
Lok..
Lokesh
Top achievements
Rank 1
 answered on 07 Jun 2013
3 answers
68 views
Hello,

we have build a custom skin from your Metro Skin Source Files and have renamed them so they fit to our Application name and do not conflict with the build in.
We have put that skin files into an assembly as you have descripted in your documentation and disabled Embedded Skin for the whole project. The skin name is applied to all controls.

We are currently using Version: 2013.1.403.35

Now, we have the problem, that the styles from our skin does not come to use on several parts of the controls.
For example, one part of our app uses the scheduler control.

The Skin name get applied to the control as you ca see here:
<div id="ctl00_ADBISContentPlaceHolder_radScheduler" class="RadScheduler RadScheduler_Adbis" style="height: 540px;">

Please take a look at the attached screenshot.
The background of the header should be violet, but it is transparent.
When you take a look at the dev panel at the bottom you see that the background color value is taken from the first seen css selectors (.RadScheduler .rsHeader) and not from our skin file which is the second visible css selector (.RadScheduler_Adbis .rsHeader)

These both css rules are are part of the same WebResource.axd result but the ".RadScheduler .rsHeader" css rules are not part of our Skin files. Are these rules part of the EmbeddedBaseStylesheet and how can we fix this problem without assigning "!important" rules to every css style that does not fit...

Thanks for support.


Kate
Telerik team
 answered on 07 Jun 2013
2 answers
146 views
Hi!

I'm using DotNetNuke 7.0.6 and when editing some containers it's showing the following message.

"A critical error has occurred. Telerik.Web.UI.RadWindow with ID='Window' was unable to find an embedded skin with the name 'Black'. Please, make sure that the skin name is spelled correctly and that you have added a reference to the Telerik.Web.UI.Skins.dll assembly in your project. If you want to use a custom skin, set EnableEmbeddedSkins=false."

Have you ran into this?

Thanks and best regards!
Hugo Figueira
Hugo
Top achievements
Rank 1
 answered on 07 Jun 2013
1 answer
125 views
Hi everybody,
I have a problem: I have a radgrid and I want allow selected first column but others don't allow. 
I did: allow rowselected and filter by column name. However, this way is not good because radgrid 
is post back when I click in all columns.
Have any ideas ?
Thanks you very much!
function onRowSelected(sender, args)
{
       var MasterTableView = sender.get_masterTableView();
       var row = MasterTableView.get_selectedItems()[0];
       var strMA_TU = MasterTableView.getCellByColumnUniqueName(row, "MA_DV");
       var cellIndex = args.get_domEvent().target.cellIndex;       
       var colName = MasterTableView.getColumnUniqueNameByCellIndex(getHeaderRow(sender), cellIndex);      
       if(colName == "GIABQ"){
            var name = strMA_TU.innerHTML;
            Service_Test.Web_TITLE_CHITIET(name);            
            <%Session["CHILD_MADVIQLY"] = "OK";%>  
            <%Session["TEST"] = "OK"; %>      
       }
       else{
            <%Session["TEST"] = null ;%>
       }
     
}
 
Eyup
Telerik team
 answered on 07 Jun 2013
4 answers
567 views
Hello,
I have a RadDateTimePicker used where the mindate is the current time and setting the selected datetime to the closest 30 minutes from the current time onwards. Even though I set the mindate to the current time. I am able to select an earlier time before the mindate value from the timeview. 

ASP Markup : 
<telerik:RadDateTimePicker ID="dpDate" runat="server" Width="190" TabIndex="19">
    <Calendar ID="ddCalendar" runat="server" EnableKeyboardNavigation="true">
    </Calendar>
    <DateInput ID="ddDate" runat="server" DateFormat="dd/MM/yyyy hh:mm tt">
    </DateInput>
    <TimeView ID="TimeView1" runat="server" Interval="00:30:00">
    </TimeView>
</telerik:RadDateTimePicker>


C# Code : 
this.dpDate.MinDate = DateTime.Now;
this.dpDate.SelectedDate = DateTime.Now.AddMinutes(30 - (DateTime.Now.Minute % 30)).AddSeconds(-DateTime.Now.Second).AddMilliseconds(-DateTime.Now.Millisecond);
Viktor Tachev
Telerik team
 answered on 07 Jun 2013
1 answer
57 views
My Page header contains:

<meta http-equiv="X-UA-Compatible" content="IE=7" />


After Upgrading from version: 2010.3.1109
to version: 2012.5.215

I get this error when I run the page:

SCRIPT87: Invalid argument.
Telerik.Web.UI.WebResource.axd, line 678 character 1


How can I resolve this ?
Thanks.

Viktor Tachev
Telerik team
 answered on 07 Jun 2013
1 answer
105 views
Hi Experts,

   I have created Rotator, where if i click on image javascript should open,it should be done from code behind.
Now the problem is, if i click on any corner or outside the image,(ItemClick) event is firing,but when i click on the image it is not firing.
How to accomplish this,please help me with this,its urgent.

Here is my code :
---------------------------

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
   
    <style type="text/css">
        .itemTemplate
        {
            width: 80px;/* 11px margin is taken into account */
            height: 50px;
        }
        .rightArrow
        {
            cursor: pointer;
            float: right;
        }
        .leftArrow
        {
            cursor: pointer;
            float: left;
        }
    </style>

  

</head>
<body class="BODY">
    <form runat="server" id="mainForm" method="post">
   
    <telerik:RadScriptManager ID="ScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <div style="width: 454px;">
<asp:Image ImageUrl="images/right.gif" ID="img_right" AlternateText="right" runat="server"
CssClass="rightArrow" />
        <asp:Image ImageUrl="images/left.gif" ID="img_left" AlternateText="left" runat="server" CssClass="leftArrow"/>
        <div style="background-image: url(images/bg.gif); width: 355px; height: 103px; margin-left: 49px;
            padding-top: 19px; background-repeat: no-repeat; box-sizing: border-box; -moz-box-sizing: border-box;">
            <div style="margin-left: 20px; padding-top: 20px;">
                <telerik:RadRotator DataSourceID="xmlDataSource1" runat="server" ID="RadRotator1" 
                OnItemCreated="RadRotator1_OnItemCreated" OnItemClick="RadRotator1_OnItemClick"     Width="314" Height="50" ItemWidth="80" ItemHeight="50" FrameDuration="1" RotatorType="ButtonsOver">
                    <ItemTemplate>
                        <div class="itemTemplate">
                          
                        <asp:ImageButton ID="Img1" runat="server"  ImageUrl='Images/<%# XPath("Image") %>' AlternateText="" style="margin: 0px 11px;" /> 
                        <asp:Label ID="RowIndex" runat="server"></asp:Label>
                        </div>
                    </ItemTemplate>
                    <ControlButtons LeftButtonID="img_left" RightButtonID="img_right" />
                </telerik:RadRotator>
            </div>
        </div>
    </div>
    <br />
    <asp:XmlDataSource ID="xmlDataSource1" runat="Server" DataFile="~/data.xml"></asp:XmlDataSource>
   
  
   
   
    <telerik:RadWindow ID="UserListDialog" runat="server" Title="Editing record" Height="320px" 
                Width="310px" Left="150px" ReloadOnShow="true" ShowContentDuringLoad="false"
                Modal="true">
                <ContentTemplate>
                This is Rad Window content
                </ContentTemplate>
            </telerik:RadWindow>
    
   
    </form>
</body>
</html>
 
Code Behind
----------------------
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;

public partial class Default3 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void RadRotator1_OnItemCreated(object sender, RadRotatorEventArgs e)
    {
        if (e.Item.DataItem != null)
        {
            Label RowIndex = (Label)e.Item.FindControl("RowIndex");

            ImageButton image1 = e.Item.FindControl("Img1") as ImageButton;// Find the asp:Image server control
            
            RowIndex.Text = Convert.ToString(e.Item.Index);


            string text = Convert.ToString(RowIndex.Text);
            ClientScript.RegisterClientScriptBlock(GetType(), "ClientScript", "<script>alert('" + text + "')</script>");
   

         
        }
    }


    protected void RadRotator1_OnItemClick(object sender, RadRotatorEventArgs e)
    {
        RadRotator rotator = sender as RadRotator;
        rotator.InitialItemIndex = e.Item.Index;// Persist the index 

        string text = Convert.ToString(rotator.InitialItemIndex);
        ClientScript.RegisterClientScriptBlock(GetType(), "ClientScript", "<script>alert('" + text + "')</script>");
    }

}



Please help me with this.

Thanks in Advance
     Prasanth
Slav
Telerik team
 answered on 07 Jun 2013
9 answers
714 views
Hello,

I've been trying to teach myself, with no prior web development experience, to design a program for my internship. In order to get familiar with telerik's tools, I've been making practice applications and everything was going fine, until I ran into a snag.

For quite some time now, I've been trying to figure out how to use the dropdownlists in Radgrid to my advantage. I would like a dropdownlist to reference another table, but from, of course, the same database. For instance, say I make a table using the provided telerik.mdf database. I display from the appointments table many fields, including the userid, and would then like to display, based on that userid, the corresponding username from the "users" table. I hope that I'm articulating my needs well enough- I'm new at this.

I have tried a number of things. I have tried, on the properties menu, trying to get the dropdownlist to reference another database, but then datafield never recognizes fields from that second datasource, but if I reference the first datasource, the listtextfield and listvaluefield can't see things from the second table. Maybe theres something I'm missing here about how it works, but I felt like no combination would work here.

I have also tried manually populating the dropdownlist from the codebehind, but the list always ends up empty. I try filling up a dataset with a dataadapter and then giving the dropdownlist the information that way, but it never fills, whether I try to set the properties that way or grab the elements from the dataset individually and put them in- I'm just always ending up with empty lists.

Obviously 2 things are true- I have changed the code around many times and this is just a snapshot, so I hope all of my explanations have articulated well enough the other things I have tried. Furthermore I bet the code is poorly written at this point- I'm still just experimenting with how these things work. Nonetheless, here is the aspx code:

<%

@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AgainWithTheInternStuff._Default" %>

 

<%

@ 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">

 

<

 

html xmlns="http://www.w3.org/1999/xhtml" >

 

<

 

head runat="server">

 

 

<title></title>

 

 

<style type="text/css">

 

 

.style1

 

{

 

margin-top: 0px;

 

}

 

</style>

 

</

 

head>

 

<

 

body>

 

 

<form id="form1" runat="server">

 

 

<div>

 

 

 

</div>

 

 

<asp:ScriptManager ID="ScriptManager1" runat="server">

 

 

</asp:ScriptManager>

 

 

 

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateEditColumn="True"

 

 

CssClass="style1" DataSourceID="SqlDataSource1" GridLines="None"

 

 

onitemdatabound="RadGrid1_ItemDataBound">

 

<

 

MasterTableView autogeneratecolumns="False" datakeynames="ID"

 

 

datasourceid="SqlDataSource1">

 

<

 

RowIndicatorColumn>

 

<

 

HeaderStyle Width="20px"></HeaderStyle>

 

</

 

RowIndicatorColumn>

 

<

 

ExpandCollapseColumn>

 

<

 

HeaderStyle Width="20px"></HeaderStyle>

 

</

 

ExpandCollapseColumn>

 

 

<Columns>

 

 

<telerik:GridBoundColumn DataField="ID" DataType="System.Int32" HeaderText="ID"

 

 

ReadOnly="True" SortExpression="ID" UniqueName="ID"

 

 

EditFormColumnIndex="3">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="Subject" HeaderText="Subject"

 

 

SortExpression="Subject" UniqueName="Subject">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="Start" DataType="System.DateTime"

 

 

HeaderText="Start" SortExpression="Start" UniqueName="Start">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="End" DataType="System.DateTime"

 

 

HeaderText="End" SortExpression="End" UniqueName="End">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="UserID" HeaderText="UserID"

 

 

SortExpression="UserID" UniqueName="UserID" DataType="System.Int32">

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridDropDownColumn DropDownControlType="DropDownList"

 

 

HeaderText="User Name" UniqueName="DropDown">

 

 

</telerik:GridDropDownColumn>

 

 

 

</Columns>

 

 

</

 

MasterTableView>

 

 

</telerik:RadGrid>

 

 

 

<asp:SqlDataSource ID="SqlDataSource1" runat="server"

 

 

ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"

 

 

 

SelectCommand="SELECT [ID], [Subject], [Start], [End], [UserID] FROM [Appointments]">

 

 

</asp:SqlDataSource>

 

 

</form>

 

</

 

body>

 

</

 

html>

 




And here is the .cs code:

using

 

System;

 

using

 

System.Collections.Generic;

 

using

 

System.Linq;

 

using

 

System.Web;

 

using

 

System.Web.UI;

 

using

 

System.Web.UI.WebControls;

 

using

 

System.Data.SqlClient;

 

using

 

System.Data;

 

using

 

System.Configuration;

 

using

 

Telerik.Web.UI;

 

namespace

 

AgainWithTheInternStuff

 

{

 

public partial class _Default : System.Web.UI.Page

 

{

 

SqlDataAdapter sdadapter ;

 

 

DataSet dset ;

 

 

SqlCommand scom ;

 

 

SqlConnection scon ;

 

 

 

protected void Page_Load(object sender, EventArgs e)

 

{

scon =

new SqlConnection(ConfigurationManager

 

.ConnectionStrings[

"TelerikConnectionString"].ConnectionString );

 

scom =

new SqlCommand();

 

dset =

new DataSet();

 

sdadapter =

new SqlDataAdapter();

 

 

}

 

protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)

 

{

scon.Open();

scom.Connection = scon;

scom.CommandText =

"SELECT ID, UserName FROM Users";

 

sdadapter.SelectCommand = scom;

sdadapter.Fill(dset);

scon.Close();

 

 

 

if (e.Item is GridEditFormItem && e.Item.IsInEditMode)

 

{

 

GridEditFormItem efi = (GridEditFormItem)e.Item;

 

 

DropDownList ddl = (DropDownList)efi["DropDown"].Controls[0];

 

ddl.DataSource = dset;

 

ddl.DataMember =

"Users";

 

ddl.DataValueField =

"ID";

 

ddl.DataTextField =

"UserName";

 

 

ddl.DataBind();

}

 

 

 

}

}

}






Anyway, I see that you all get back to people very quickly and very thoroughly, and wondered if you could shed some light on why some of these things aren't working, and where my lapse in understanding is. Thank you so much for your time.


Nicole
Kostadin
Telerik team
 answered on 07 Jun 2013
4 answers
338 views
Hi All,

Im having Javascript error whenever I do sorting on my GridTemplateColumn..
Microsoft JScript runtime error: Unable to set value of the property 'control': object is null or undefined
error on --> a.control=this; 
under --> Telerik.Web.UI.We....ed16cbdc [dynamic] 

I have used this as a reference but it didnt work for me. http://www.telerik.com/help/aspnet-ajax/grid-sorting-for-hyperlink-template-columns.html

The only difference is that Im using Masterpage and the grid is inside RadMultiPage..

<asp:Content ID="Content3" ContentPlaceHolderID="BodyContentPlaceHolder" runat="server">
......
.....
<
telerik:RadMultiPage ID="MultiPageMain"  .......
    <telerik:RadPageView ID="PanelPageView1"  .......
         <telerik:RadGrid ID="GrdMain" runat="server" AutoGenerateColumns="False" CellSpacing="0" AllowSorting="True" ......
               <MasterTableView TableLayout="Fixed">
              <Columns>
                <telerik:GridTemplateColumn HeaderText="Comp Name" UniqueName="CompName" SortExpression="CompName">
               <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                            <ItemTemplate>
                                  <
asp:Label ID="lblCompName" Runat="server" Text='<%# Convert.ToString(DataBinder.Eval(Container.DataItem, "CompName")) %>' />
                            </ItemTemplate>
             </telerik:GridTemplateColumn>
                    ......
......


 

Thanks in Advance.



RJ
Top achievements
Rank 1
 answered on 07 Jun 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?