Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
54 views
Hi,

Can I sort the Grid after binding? For example: I have the Datasource with 50 rows and bind it to Grid (10 rows per page). After binding, I want to sort on specific field and only on the specific page of the Grid, can I do that?

Thanks a lot
Dan
Dan
Top achievements
Rank 1
 answered on 24 Dec 2010
4 answers
211 views
I need to know how to set the background color of a group header cell to something other than white.

here is the back end code that I have tried.

Attempt 1
protected void RadGrid1_ExcelExportCellFormatting(object source, ExcelExportCellFormattingEventArgs e)
{
    GridDataItem item = e.Cell.Parent as GridDataItem;
    if(item.ItemType == GridItemType.GroupHeader)
        item.Style["background-color"] = "#FFFF00";
}


Attempt 2... which did not work either. I have Group: as my header text... I guess I was hoping that it would grab that info...
protected void RadGrid1_ExcelExportCellFormatting(object source, ExcelExportCellFormattingEventArgs e)
{
    GridDataItem item = e.Cell.Parent as GridDataItem;
    if (e.Cell.Text.Contains("Group:"))
        item.Style["background-color"] = "#FFFF00";
}

I am exporting using ExcelHTML.

Thanks,

Dustin
Daniel
Telerik team
 answered on 23 Dec 2010
4 answers
112 views
Is there any easy way to disable features within the recurrence panel when creating/updating appointments? For example, I want to use monthly recurrence, but I do NOT want to allow the user to select a monthly interval -- I want the appointment to occur every month. So, I would like to leave everything as-is, but disable/hide the controls that allow the user to select a monthly interval. I'd also like to change the text from "every month(s)" to "every month", since that's all I'll be allowing. I've been working on this all day, and it's really driving me insane now. Surely there's some way to manage this type of configuration without creating completely custom templates, right? PLEASE HELP -- I'M DESPERATE!

Thanks for your help,
Landon
Landon
Top achievements
Rank 1
 answered on 23 Dec 2010
1 answer
47 views
I am having a little issue here. I've got a big shiney RadGrid with a nested table view, inside of which there is a RadMultiPage with a RadTab, 3 Tabs, and 3 PageViews. Sounds like fun already, doesn't it?? Yeah, it is.

Anyway, inside the first page view, there is another separate RadGrid (I'm kind of new to this, so I'm not sure if the radgrid inside the pageview inside of the NestedViewTemplate would be an independent RadGrid or a child of the first RadGrid..bear with me, bear with me.). So, within this child...grid... thing, there's naturally a bunch of columns and rows, and a column of edit buttons and a column of delete buttons that do their jobs just they way they should.

So in here there is a RadComboBox, which is populated from... somewhere... a table in our database that has just, like, a list of types you are able to choose from.

My quandary is thus: How do I get it to choose all the rows in that table (that's populating the RadComboBox) except ONE!? No matter what I do, all I can get it to do is make that value not show up in the values that the table is already displaying, but whenever I open that combo box again when I try to edit, that value is still there!!!

I'm terribly new to this stuff. Please be gentle.
Amber
Top achievements
Rank 1
 answered on 23 Dec 2010
4 answers
198 views
can i disable transfer function on certain item? in my case, if the item has value of 0 or "" or the item is enabled = false then do not allow transfering on that item. can i do that on client side? please help. thanks.
Arpit
Top achievements
Rank 1
 answered on 23 Dec 2010
2 answers
167 views
Hi

i have a .js file to control when a user close the browser tab then destroy all session on the server.
This control when not fire when change the page with a link 'a' or submit a form else the control will fire.

I have a listbox ajaxed and when i click an item my cotrol fire and destroy all session... disaster...

its possible to bind all ajax avent for block the destroy session?

my js.file
======================================
var validNavigation = false;

/* No HTML output is returned*/
function endSession() {
    //$.get("../logout.aspx");
    alert("MedOFFICEweb - Sessione terminata.");
    validNavigation = false
}

function wireUpEvents() {

    /*
    * For a list of events that triggers onbeforeunload on IE
    * check http://msdn.microsoft.com/en-us/library/ms536907(VS.85).aspx
    */

    window.onbeforeunload = function() {       
            if (!validNavigation) {
                endSession();
            }                                  
    }

 
        
    // Attach the event click for all links in the page
    $("a").bind("click", function() {
    validNavigation = true;
        //alert("a")
    });

    // Attach the event submit for all forms in the page
    $("form").bind("submit", function() {
    validNavigation = true;
        //alert("form")
    });

 }

// Wire up the events as soon as the DOM tree is ready
$(document).ready(function() {    
    wireUpEvents();
});
===========================================



 
Fabio
Top achievements
Rank 2
 answered on 23 Dec 2010
1 answer
102 views
Hello Telerik,

I am new to Rad Controls.  I am trying to assign different data sources to different chart series in one Rad Chart but i couldn't able to find solution for that. So can you help me figure out this issue.

Here is  my problem description

I need to display bar series and line series in one Rad Chart and both series need to display different data sets.

Thanks
Swetha
Ves
Telerik team
 answered on 23 Dec 2010
2 answers
102 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
214 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
768 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?