Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
130 views
Hi Forum,
Please assist, I am creating the Radgrid programmatically and want to add Radcombox as a filtering item to it. 
 No Clue, and I've tried everything I can find. 
I want the design output like the attached file.

Bali.

here is the code i am using

     rdGrd = new RadGrid();
            rdGrd.AutoGenerateColumns = false;
            rdGrd.AllowPaging = true;           
            rdGrd.AllowSorting = true;
            rdGrd.AllowFilteringByColumn = true;     

            rdGrd.Width = Unit.Pixel(600);
            rdGrd.EnableAJAX = true;
            rdGrd.EnableAJAXLoadingTemplate = true;
            rdGrd.Skin = "None";
                      
            rdGrd.NeedDataSource += new GridNeedDataSourceEventHandler(rdGrd_NeedDataSource);
            rdGrd.ItemDataBound += new GridItemEventHandler(rdGrd_ItemDataBound);
            rdGrd.PageSize = 25;
            rdGrd.ID = "grd";

  GridBoundColumn boundColumn1 = new GridBoundColumn();
                boundColumn1.DataField = "FirmName";
                boundColumn1.UniqueName = "Firm";
                boundColumn1.HeaderText = "Firm";
                boundColumn1.AllowFiltering = true;                
                boundColumn1.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
                boundColumn1.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
                boundColumn1.ItemStyle.VerticalAlign = VerticalAlign.Top;

  //HOW CAN I ADD A RADCOBOBOX HERE AS A FILTERING ITEM

  GridTemplateColumn templateColumnRank = new GridTemplateColumn();
                templateColumnRank.AllowFiltering = false;
                templateColumnRank.HeaderTemplate = new NColHeaderTemplate(120, "Rank", "cont3", "2009, 2008", "LeaderRank, LeaderRankM1", "cont4, cont5");
                templateColumnRank.ItemTemplate = new NColItemTemplate(120, "LeaderRank, LeaderRankM1", "cont1, cont2");

 

  rdGrd.MasterTableView.Columns.Add(templateColumnRank);
                rdGrd.MasterTableView.Columns.Add(boundColumn1);
  
     this.Controls.Add(rdGrd);

 

public class NColHeaderTemplate : ITemplate
    {
        protected LiteralControl lControl0;
        private int iColumnWidth;
        private int nColHeader;
        private string sTopLevelColumnName;
        private string sTopLevelColumnNameUniqueID;
        private string[] sNBottomColumnName;
        private string[] sNBottomColSortCommandArgument;
        private string[] sNBottomColumnNameUniqueID;
        private string sCellHorizontalAlign;

        public NColHeaderTemplate(int ColumnWidth, string TopLevelColumnName, string TopLevelColumnNameUniqueID, string NBottomColumnName, string NBottomColSortCommandArgument, string NBottomColumnNameUniqueID)
        {
            iColumnWidth = ColumnWidth;
            sTopLevelColumnName = TopLevelColumnName.Trim();
            sTopLevelColumnNameUniqueID = TopLevelColumnNameUniqueID.Trim();
            sNBottomColumnName = NBottomColumnName.Split(Convert.ToChar(","));
            sNBottomColSortCommandArgument = NBottomColSortCommandArgument.Split(Convert.ToChar(","));
            sNBottomColumnNameUniqueID = NBottomColumnNameUniqueID.Split(Convert.ToChar(","));
            //ColHeaderParam = nColHeaderParam.Split(Convert.ToChar(","));
            nColHeader = sNBottomColumnName.Length;
            sCellHorizontalAlign = "Center";
        }

       
        public void InstantiateIn(System.Web.UI.Control container)
        {
            lControl0 = new LiteralControl();
            lControl0.ID = sTopLevelColumnNameUniqueID;
            lControl0.Text = sTopLevelColumnName;

            Table table = new Table();
            table.Width = Unit.Pixel(iColumnWidth);

            TableRow row1 = new TableRow();
            TableRow row2 = new TableRow();

            TableCell cell11 = new TableCell();
           
            cell11.Controls.Add(lControl0);
            cell11.ColumnSpan = nColHeader;

            row1.Cells.Add(cell11);
            table.Rows.Add(row1);

            for (int i = 0; i < nColHeader; i++)
            {

                LinkButton lbControl = new LinkButton();
                lbControl.ID = sNBottomColumnNameUniqueID[i].ToString().Trim();
                lbControl.Text = sNBottomColumnName[i].ToString().Trim();
                lbControl.CommandName = "Sort";
                lbControl.CommandArgument = sNBottomColSortCommandArgument[i].ToString().Trim();

                TableCell cell = new TableCell();
                cell.HorizontalAlign = HorizontalAlign.Center
               
                cell.Controls.Add(lbControl);
                cell.Width = iColumnWidth / nColHeader;
                row2.Cells.Add(cell);

            }

            table.Rows.Add(row2);
            container.Controls.Add(table);
        }
    }

    public class NColItemTemplate : ITemplate
    {

        //protected LiteralControl lControl;
        protected HyperLink lControl;
        private int iColumnWidth;
        private int nColItem;
        private string[] sNBottomDataColumnName;
        private string[] sNBottomDataControlUniqueID;
        private string sBottomDataColumnName;
        private string sCellHorizontalAlign;
       

        public NColItemTemplate(int ColumnWidth, string NBottomDataColumnName, string NBottomDataControlUniqueID)
        {
            sNBottomDataColumnName = NBottomDataColumnName.Split(Convert.ToChar(","));
            sNBottomDataControlUniqueID = NBottomDataControlUniqueID.Split(Convert.ToChar(","));
            nColItem = sNBottomDataColumnName.Length;
            iColumnWidth = ColumnWidth;
            sCellHorizontalAlign = "Center";
        }
       
        public void InstantiateIn(System.Web.UI.Control container)
        {
            Table table = new Table();
            table.Width = Unit.Pixel(iColumnWidth);

            TableRow row1 = new TableRow();
            for (int i = 0; i < nColItem; i++)
            {
                //lControl = new LiteralControl();
                lControl = new HyperLink();
                lControl.ID = sNBottomDataControlUniqueID[i].Trim();
                lControl.Text = sNBottomDataColumnName[i].ToString().Trim();
                lControl.DataBinding += new EventHandler(lControl_DataBinding);

                TableCell cell = new TableCell();
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.VerticalAlign = VerticalAlign.Top;
               

                cell.Width = iColumnWidth / nColItem;
                cell.Controls.Add(lControl);
                row1.Cells.Add(cell);
            }
            table.Rows.Add(row1);
            container.Controls.Add(table);
            container.Controls.Add(new LiteralControl("<br />"));
        }
        public void lControl_DataBinding(object sender, EventArgs e)
        {
           // LiteralControl l = (LiteralControl)sender;
            HyperLink l = (HyperLink)sender;
            GridDataItem container = (GridDataItem)l.NamingContainer;
            sBottomDataColumnName = l.Text.Trim();
            l.Text = ((DataRowView)container.DataItem)[sBottomDataColumnName].ToString();
            l.Target = "_blank";
            l.NavigateUrl = "http://www.google.com/search?hl=en&q=" + ((DataRowView)container.DataItem)[sBottomDataColumnName].ToString() + "&btnG=Google+Search";

        }

 

    }

Bali
Top achievements
Rank 1
 answered on 23 Dec 2010
3 answers
264 views
Hi,

I have a radgrid with dynamic GridBoundColumns created, where we apply custom format string to each of them based on data type
eg: boundColumn.DataFormatString = "{0:N}" for decimal or any number type.

I have support for both server-side and client-side aggregate functionality. But facing some issues now.

Scenario : If we apply a custom DataFormatString to a column
Grid is loaded fine. But if user selects a aggregate type using Footer Aggregate Menu from Column Header, Aggregate Name is not displayed within the footer result.

Aggregate Operation is executed fine and desired result is displayed but we are not able to see the Aggregate name.

Eg: We apply “Count” aggregation on Column1 then the footer result is displayed as “x.
 The expected result should be “Count : x”

It works fine when no dataformat string is applied on bound columns. 

Here is a post which says , which in-turn says aggregate title names can be turned off by seting DataFormatString.
http://stackoverflow.com/questions/1244894/telerik-radgrid-custom-aggregate-unwanted-text

So in our case, its the same that is happening. We are setting the dataformatstring and cant see the aggregate titles.

Need a solution to get this working.
Are there any specific constraints to use in order to support both server side and client side aggregates with formats applied ? Or am I missing anything here ?

Any thoughts ?
Martin
Telerik team
 answered on 23 Dec 2010
5 answers
837 views
Hello,

In the RadDatePicker control I've set MaxDate/MinDate and ValidationGroup, but I am still able to submit form with invalid date.

Using following example I am able to submit form with "AA" text or "1/1/2020" date in the RadDatePicker. I've tried solution with raddatepicker validation but it doesn't work when user presses Enter - form is submitted.

Please check my example.

<%@ Page Language="C#" AutoEventWireup="true" %> 
 
<%@ 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>Untitled Page</title> 
</head> 
<body> 
 
  <script runat="server"
    protected void Button1_Click(object sender, EventArgs e) 
    { 
      Title = "ok"
    } 
  </script> 
 
  <form id="form1" runat="server"
  <telerik:RadScriptManager runat="server"
  </telerik:RadScriptManager> 
  <telerik:RadDatePicker ID="RadDatePicker1" runat="server" MaxDate="2010-12-31"
    <DateInput runat="server" InvalidStyleDuration="100" ValidationGroup="Test"
    </DateInput> 
  </telerik:RadDatePicker> 
  <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" ValidationGroup="Test" /> 
  </form> 
</body> 
</html> 

My configuration:
  • VS 2008
  • Telerik For ASP.NET AJAX (Telerik.Web.UI.dll Version=2008.1.619.35)
  • IE 7.0
  • Firefox 3.0

Best regards, Oleg.
Arash
Top achievements
Rank 1
 answered on 23 Dec 2010
7 answers
241 views
Does anyone have any advice on Radscheduler functionality on Iphone using Safari or Opera Mini? Iphone does not allow for a double click on a cell, has anyone had to tackle this with their customers, and how did you solve it?


Thanks,
Kamen Bundev
Telerik team
 answered on 23 Dec 2010
1 answer
64 views

Posted 0 minutes ago (permalink)

1. i have tree with about 4 levels
the first level i get from server code and the other
by webservice.

in the begining i just recieve
the first level
i know from advanced what is their checked property
some are:

  • 0 - Unchecked
  • 1 - Checked
  • 2 - Indeterminate

    how can i set these values by code ,when the component can't make it itself
    , because it doesn't have childs yet (until i click on some of the first level and recive by webservice their childs. the second level)

    2. one more problem is that tri state doesn't work properly. example: one of the three childs isn't checked, the father of it, the second level is Indeterminate but the first level is Checked  instead of Indeterminate 

  • Nikolay Tsenkov
    Telerik team
     answered on 23 Dec 2010
    8 answers
    519 views
    Hi -

    I have:
    Installed AJAX
    Installed RadControls_for_ASP.NET_AJAX_2010_1_519_dev.msi
    Added a RadGrid to a web part
    Complied and deployed using VS 2010

    On runtime I get:

    Parser Error

    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

    Parser Error Message: Could not load file or assembly 'Telerik.Web.UI' or one of its dependencies. The system cannot find the file specified.

    Source Error:

    Line 7:  <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    Line 8:  <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SubmittalUserControl.ascx.cs" Inherits="Tribridge_PM_Portal.Submittal.SubmittalUserControl" %>
    Line 9: <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>Line 10: 
    Line 11: <script type="text/javascript" language="javascript">

    Source File: /_CONTROLTEMPLATES/Tribridge_PM_Portal/Submittal/SubmittalUserControl.ascx    Line: 9

    Assembly Load Trace: The following information can be helpful to determine why the assembly 'Telerik.Web.UI' could not be loaded.

    WRN: Assembly binding logging is turned OFF.
    To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
    Note: There is some performance penalty associated with assembly bind failure logging.
    To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
    

    One issue may be that I do not see two required dll's in the GAC.

    Telerik.Ajax.SharePoint.dll and RadEditorSharePoint.dll.

    I do not see these anywhere in the Rad install path or on my hard drive either.

    Please advise where these are located.

    I noticed when I ran the Telerik installer it did not update the GAC or sp web.config either.

    Thank you.




    Sebastian
    Telerik team
     answered on 23 Dec 2010
    1 answer
    76 views
    Hi,

    I am using hierarchical grids in my page. The child grid is expanding on click of parent link, but the right side part of the child grid is missing.  This behaviour is not consistant always, some times its showing the full sub grid. Please refer the attached screen shots for reference.


    Regards,
    Chandrababu.
    Iana Tsolova
    Telerik team
     answered on 23 Dec 2010
    13 answers
    447 views
    I am developing prototype using telerik rad controls. One of my requirement is to display a radgrid dynamically inside a radwindow  which comes up as a new pop window, on hyperlink click event. There is an additional radgrid on the page. I would then want to drag a row from the dynamically created radgrid(inside radwindow) into existing radgrid on the same page.
    I know that radwindow can be used as container for containing controls from same page but I want to the radwindow as new pop up on same page and then I can refer Id's of both radgrid controls while drag and drop.

    Kindly reply
    Neerav Patel
    Nikolay Tsenkov
    Telerik team
     answered on 23 Dec 2010
    5 answers
    299 views
    Hi all,

    Apologies if this is a question answered elsewhere or if I've missed something simple.

    I've got a treeview in which I build the nodes dynamically based on a datasource - specifically I'm manually creating new RadTreeNodes and inserting them because I want different behaviours based on each, but that's probably not directly relevant. At the time of creating each node I assign it to a predefined (in the .aspx) RadContextMenu, like this:

    RadTreeNode contactNode = new RadTreeNode();  
    if (contact == currentCustomer.ContactAccounts)  
       contactNode.ImageUrl = "~/images/icons/16/user-business.png";  
    else 
       contactNode.ImageUrl = "~/images/icons/16/user-worker.png";  
    contactNode.Text = contact.Name;  
     
    if (contact.Email.Length > 0 && contact.Fax.Length > 0)  
    {  
       contactNode.ContextMenuID = "contactContextMenuEmailAndFax";  
    }  
    else if (contact.Email.Length > 0)  
    {  
       contactNode.ContextMenuID = "contactContextMenuEmailOnly";  
    }  
    ... etc etc etc 

    There are two things I'd like to do and haven't found a means of doing:

    1) rather than define 4 multiple menus including email, fax, email and fax and neither, it'd be nice to be able to iterate the collection of menuitems and simply disable the ones that don't matter

    2) I'd like to set the NavigateUrl property of the "Email contact" menu item to a mailto: link at render time


    Is there a way to do this?

    Cheers,

    Kev
    Nikolay Tsenkov
    Telerik team
     answered on 23 Dec 2010
    1 answer
    79 views
    Hello,

    I am using a Grid with a custom filter column as described in the demo http://demos.telerik.com/aspnet-ajax/grid/examples/programming/filteringtemplatecolumns/defaultcs.aspx 

    The problem I have is that when I turn off the viewstate for the grid the event below does not fire in the event chain.
    private void rcBox_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
         {
             ((GridFilteringItem)(((RadComboBox)sender).Parent.Parent)).FireCommandEvent("Filter", new Pair());
         }


            private void rcBox_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
            {
                ((GridFilteringItem)(((RadComboBox)sender).Parent.Parent)).FireCommandEvent("Filter", new Pair());
            }
       private void rcBox_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
            {
                ((GridFilteringItem)(((RadComboBox)sender).Parent.Parent)).FireCommandEvent("Filter", new Pair());
            }
    If I turn on view state then it works fine. I have tried setting the selectedvalue in the "protected override void SetupFilterControls(TableCell cell)" method as follows, but all that does is maintain the selectedvalue during postback and does not cause the  rcBox_SelectedIndexChangedevent to fire. You can see from the code below I tried to fire the Filter command but it is too early and causes other problems.

    var formvalue = HttpContext.Current.Request.Form[rcBox.UniqueID];
               if (!string.IsNullOrEmpty(formvalue))
               {
                   rcBox.SelectedValue = formvalue;
                   //((GridFilteringItem)(rcBox.Parent.Parent)).FireCommandEvent("Filter", new Pair());
               }


    Is this a bug in the grid, my only solution is to use viewstate but this is a large gird.

    I have also notcied that if the viewstate is switched off you can not change page with the page number buttons and can only use the left and right page buttons.
    Iana Tsolova
    Telerik team
     answered on 23 Dec 2010
    Narrow your results
    Selected tags
    Tags
    +? more
    Top users last month
    Miljana
    Top achievements
    Rank 2
    Iron
    Iron
    Joel
    Top achievements
    Rank 3
    Bronze
    Bronze
    Bronze
    Cynthia
    Top achievements
    Rank 1
    John
    Top achievements
    Rank 1
    Iron
    Mozart
    Top achievements
    Rank 1
    Iron
    Veteran
    Want to show your ninja superpower to fellow developers?
    Top users last month
    Miljana
    Top achievements
    Rank 2
    Iron
    Iron
    Joel
    Top achievements
    Rank 3
    Bronze
    Bronze
    Bronze
    Cynthia
    Top achievements
    Rank 1
    John
    Top achievements
    Rank 1
    Iron
    Mozart
    Top achievements
    Rank 1
    Iron
    Veteran
    Want to show your ninja superpower to fellow developers?
    Want to show your ninja superpower to fellow developers?