Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
75 views
I am not sure if this is the right place for me to ask the technical question . Let me know please if this is not the right place.

I am using a radmenu control  set on the page vertically.   It goes down to three level. Now what I want to set is to show the link of the parent node as we go down on the nodes. 

For example when click on the root control and go down to the parent  and then to its child  nodes in the parth should be hightlighted. 

Also I must say we populate the RadMenu control dynamically at runtime. 

I have tried many examples on around the internet but no prevail. Please help thanks.
Yana
Telerik team
 answered on 10 Aug 2010
1 answer
105 views
Is there a built in way to send up multiple values to the Service?
Svetlina Anati
Telerik team
 answered on 10 Aug 2010
0 answers
197 views
So i have the need to create programmatically a grid so I began to dig around to see how this could be done, and found i needed to implement the ITemplate interface. So the following classes is those implementations. One for the header template, one for the itemtemplate and one for the footer template.

My problem is, for the first column, all works out great, with the numeric RadNumericTextBox validating good, the footer sums the values i put on the items RadNumericTextBox and it's perfect. But for the other columns, the it seems like it's a normal textbox. No validation is made, the the footer doesnt sum up the values. In attachment is the imagem of the final grid.

And sorry for the long post :)

The is the Header template. I have the need to divide the header into 2 columns, One will have the values from the datasource and the other will contain RadNumericTextBox with the type of currency. (see attachment for a visualization of the final result)

public class RadGridHeaderTemplate : ITemplate

    private string _columName;
    public string ColumName
    {
        get { return _columName; }
        set { _columName = value; }
    }
    public RadGridHeaderTemplate(string cName)
    {
        _columName = cName;
    }
  
    public RadGridHeaderTemplate()
    {
    }
  
    public void InstantiateIn(Control container)
    {
        Table table = new Table();
        TableRow row1 = new TableRow();
        TableRow row2 = new TableRow();
  
        TableCell cell11 = new TableCell();
        TableCell cell21 = new TableCell();
        TableCell cell22 = new TableCell();
  
        cell11.ColumnSpan = 2;
        cell11.BackColor = System.Drawing.Color.Aqua;
        cell11.Text = ColumName;
        row1.Cells.Add(cell11);
  
        cell21.Text = "Valores Actuais";
        cell21.BackColor = System.Drawing.Color.Aqua;
        row2.Cells.Add(cell21);
  
        cell22.Text = "Valores Novos";
        cell22.BackColor = System.Drawing.Color.Aqua;
        row2.Cells.Add(cell22);
  
        table.Rows.Add(row1);
        table.Rows.Add(row2);
        container.Controls.Add(table);
    }
}

This is the Item Template, where i fill the values. One of the cells will have the values from the datasource, the other will contain a RadNumericTextBox  (see attachment for a visualization of the final and for an example of the datasource)

public class RadGridItemTemplate: ITemplate
{
    protected LiteralControl lControl;
    protected RangeValidator validatorTextBox;
    protected RadNumericTextBox textBox;
    private string _columnName;
    private string _headerName;
    private bool _isOrigin;

    
public string ColumnName
    {
        get { return _columnName; }
        set { _columnName = value; }
    }
  
    public string HeaderName
    {
        get { return _headerName; }
        set { _headerName = value; }
    }
  
    public bool IsOrigin
    {
        get { return _isOrigin; }
        set { _isOrigin = value; }
    }

    
public RadGridItemTemplate(string cName, string hName, bool isOrigin)
    {
        _columnName = cName;
        _headerName = hName;
        _isOrigin = isOrigin;
    }
    public RadGridItemTemplate()
    
    }

    
public void InstantiateIn(Control container)
    {
        Table table = new Table();
        table.BorderColor = System.Drawing.Color.Black;
        table.Style.Add(HtmlTextWriterStyle.BorderWidth, "1px");
        TableRow row1 = new TableRow();
  
        textBox = new RadNumericTextBox();
        textBox.ID = "templateColumnTextBox";
        textBox.Type = NumericType.Currency;
        textBox.ClientEvents.OnBlur = "Blur";
        textBox.ClientEvents.OnFocus = "Focus";
        textBox.Width = Unit.Pixel(60);
  
        if (IsOrigin)
        {
            lControl = new LiteralControl();
            lControl.ID = "lControl";
            lControl.DataBinding += lControl_DataBinding;
  
            TableCell cell11 = new TableCell();
            TableCell cell12 = new TableCell();
  
  
            cell11.Width = Unit.Pixel(50);
            cell11.Style.Add(HtmlTextWriterStyle.TextAlign, "center");
            cell11.Controls.Add(lControl);
            cell12.Controls.Add(textBox);
  
            row1.Cells.Add(cell11);
            row1.Cells.Add(cell12);
        }
        else
        {
            TableCell cell11 = new TableCell();
            cell11.Controls.Add(textBox);
  
            row1.Cells.Add(cell11);
        }
  
  
        table.Rows.Add(row1);
        container.Controls.Add(table);
    }

    
public void lControl_DataBinding(object sender, EventArgs e)
    {
        LiteralControl l = (LiteralControl)sender;
        GridDataItem container = (GridDataItem)l.NamingContainer;
        l.Text = String.Format("{0:C}", Convert.ToDouble(((DataRowView) container.DataItem)[ColumnName]));
    }


Footer template for my column. On the footer, I want to have the sum of all values of the textboxes. For that I use javascript, indicated on the line textBox.ClientEvents.OnLoad = "Load";
public class RadGridFooterTemplate : ITemplate
{
    protected RadNumericTextBox textBox;
    private bool _isOrigin;
  
    public bool IsOrigin
    {
        get { return _isOrigin; }
        set { _isOrigin = value; }
    }
  
    public RadGridFooterTemplate(bool isOrigin)
    {
        _isOrigin = isOrigin;
    }
    public RadGridFooterTemplate()
     
    }
  
    public void InstantiateIn(Control container)
    {
        Table table = new Table();
        TableRow row1 = new TableRow();
  
        textBox = new RadNumericTextBox();
        textBox.ID = "footerColumnTextBox";
        textBox.Type = NumericType.Currency;
        textBox.ClientEvents.OnLoad = "Load";
        textBox.Enabled = false;
  
        if (IsOrigin)
        {
            TableCell cell11 = new TableCell();
            TableCell cell12 = new TableCell();
  
            cell11.Text = "Total";
            cell12.Controls.Add(textBox);
  
            row1.Cells.Add(cell11);
            row1.Cells.Add(cell12);
        }
        else
        {
            TableCell cell11 = new TableCell();
            cell11.Controls.Add(textBox);
  
            row1.Cells.Add(cell11);
        }
  
  
        table.Rows.Add(row1);
        container.Controls.Add(table);
    }
}


This final code, is where i do the assembling of the grid
 
        RadGrid radGrid = new RadGrid();
  
        radGrid.ID = "gvSetValues";
        radGrid.DataSource = buildDataTable;
        
        radGrid.AllowPaging = false;
        radGrid.AllowSorting = false;
        radGrid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;
        radGrid.AutoGenerateColumns = false;
        radGrid.ShowStatusBar = true;
        radGrid.ShowFooter = true;
        radGrid.MasterTableView.ShowFooter = true;
    
        GridBoundColumn boundColumn = new GridBoundColumn();
        boundColumn.DataField = "Meses";
        boundColumn.UniqueName = "Meses";
        boundColumn.HeaderText = "Meses/PPI";
        radGrid.MasterTableView.Columns.Add(boundColumn);
  
        foreach (DataColumn column in buildDataTable.Columns)
        {
            //Add origins Columns
            if (column.ColumnName.StartsWith("O_"))
            {
                GridTemplateColumn templateColumn = new GridTemplateColumn();
                templateColumn.HeaderTemplate = new RadGridHeaderTemplate(column.ColumnName.Split('_')[1]);
                templateColumn.ItemTemplate = new RadGridItemTemplate(column.ColumnName, column.ColumnName.Split('_')[1], true);
                templateColumn.FooterTemplate = new RadGridFooterTemplate(true);
                radGrid.MasterTableView.Columns.Add(templateColumn);
                templateColumn.UniqueName = "OldValues";
            }
  
            //Add Destinations Columns
            if (column.ColumnName.StartsWith("D_"))
            {
                GridTemplateColumn templateColumn = new GridTemplateColumn();
                templateColumn.HeaderText = column.ColumnName.Split('_')[1];
                templateColumn.ItemTemplate = new RadGridItemTemplate(column.ColumnName, column.ColumnName.Split('_')[1], false);
                templateColumn.FooterTemplate = new RadGridFooterTemplate(false);
                radGrid.MasterTableView.Columns.Add(templateColumn);
            }
        }
  
        radGrid.DataBind();
        phGvMoveValues.Controls.Add(radGrid);
Rui Brito
Top achievements
Rank 1
 asked on 10 Aug 2010
4 answers
141 views
Hi All, 


Is it possible to show to asp panels inside <NestedViewTemplate> of RADGRID, so that one panel should bind with one data source
 and another panel should show bind with another data source.


Ex: <telerik:RadGrid ID="RadGrid1" runat="server" onneeddatasource="RadGrid1_NeedDataSource"  >
            
        
        <HeaderContextMenu EnableAutoScroll="True"></HeaderContextMenu>

        <MasterTableView AutoGenerateColumns="False" CellSpacing="1"  CommandItemDisplay="Top" DataKeyNames="T_ID" GridLines="Vertical"
        PagerStyle-Mode="NextPrevAndNumeric"   />
               
             <NestedViewTemplate>

   <asp:Panel ID="panel1" runat="server" BorderStyle="Solid" BorderWidth="2px" >
                     <telerik:RadListView ID="RadListView1" runat="server"  DataSourceID="ObjectDataSource1"
                        ItemPlaceholderID="ParentContainer" >
                        </telerik:RadListView>
                    </asp:Panel>


           <asp:Panel ID="panel2" runat="server" BorderStyle="Solid" BorderWidth="2px" >                    
                     
                       <telerik:RadListView ID="RadListView2" runat="server"  DataSourceID="ObjectDataSource2"
                       ItemPlaceholderID="ParentContainer" >
        </telerik:RadListView>                   
                   </asp:Panel>
                     
             </NestedViewTemplate>

</MasterTableView>
        </telerik:RadGrid>

Or how can i achieve same  thing from any other alternative.

Currently i am refering http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplatedeclarativerelations/defaultcs.aspx, but in my case i need 2 panels.

naimish
Top achievements
Rank 1
 answered on 10 Aug 2010
2 answers
85 views
Hi,

How can I highlight grid row on mouse-over?

Many thanks.

M G
FISCAL
Top achievements
Rank 1
 answered on 10 Aug 2010
5 answers
185 views
Hi,

Iam using ASP.NET Ajax Q1 2008 Controls. Following is the scenario which we have encountered

We have 5 tabs with every tab having one grid each. Now on every post back in grid 1, all grids have there Individual events fired.

Requirement is to fire only the events of grid which is requested ie if user clicks on tab 3 only 3rd grid will load.

Following techniques were tried :-

1. We tried using AutoPostBack=true  for radtabstrip and RenderSelectedPageOnly=true for Multipage but we were unable to acheive the requirement

2. We tried to capture the tab that has been clicked or selected but before we get the selected tab name, all individual events of all grid fire which is exactly what is not required.

Kindly help to acheive the solution to the above problem.

Pavlina
Telerik team
 answered on 10 Aug 2010
1 answer
131 views
How can i  set the combo from client side.?

The way i do it now is

on Client side i pass value using hidden inputs to server side than i call ajaxRequest


j_inComboText.value = Description;

j_inComboVal.value = StatusId;

$find(

 

"<%= RadAjaxManager1.ClientID %>").ajaxRequest();

On server side i implement

 

 

 

if (rcbStatus.SelectedIndex == 0)

 

    rcbStatus.Items.Remove(0);

 

 

RadComboBoxItem ps = new RadComboBoxItem();

 

ps.Text = inComboText.value ;

ps.Value = inComboVal.Value ;

rcbStatus.Items.Insert(0, ps);

rcbStatus.SelectedIndex = 0;

It shows that my value is set ok in the combo but not refresh it to appear in the header of the combo?

Shinu
Top achievements
Rank 2
 answered on 10 Aug 2010
1 answer
80 views
Hi all,

I have installed trail version of Telerik controls. Could you tell me, can I use radgrid control to my existing asp.net application?
I am not interested to create another new web application for radgrid usability
Suggest me if I am wrong


Thanks,
Nagarajan Govindarajan.
Nagarajan
Top achievements
Rank 1
 answered on 10 Aug 2010
1 answer
151 views
Hi,
I'm trying to avoid duplicate appointments
I have created an appointment with Recurrence "weekly" that end after 5 occurrences, 1/8/2010 08:00 - 09:00
and it is being created OK
1/8/2010 08:00 - 09:00
8/8/2010 08:00 - 09:00
15/8/2010 08:00 - 09:00
22/8/2010 08:00 - 09:00
29/8/2010 08:00 - 09:00

now I create another appointment that overlap one of the re occurrence instance  for example  "8/8/2010 08:00 - 09:00" ,
I'm using the GetAppointmentsInRange to check for duplicates,
on the first and last occurrence it found a match,
on the middle occurrences it fail to find a match,
I have the same problem also when trying to create a new event with recurrence, that start at "8/8/2010 08:00 - 09:00" with weekly recurrence that end after 3 occurrences (I loop through the occurrences to check)

I'm using 2009 Q2

Please advise,
Mickey
Peter
Telerik team
 answered on 10 Aug 2010
2 answers
155 views
Hi,
   sorry for bothering you, but this is getting me crazy.
I'm using 2010q2.

The problem:

What I'm trying to accomplish is to use external js files instead of the "axd" resource files.
I've looked to your examples and I don't find them suitable for an application of medium/large dimension.
In fact you are suggesting of adding the scripts to the ScriptManager
<asp:ScriptManager ID="ScriptManager1" runat="server" >
      
<Scripts>
         
<asp:ScriptReference Path="~/Scripts/Common/Core.js" />

      </Scripts>
</
asp:ScriptManager>


This is a mess when dealing with hundreds of pages because developers must always remember which js files must be included for each control.

My idea (as a sidenote I've always used this approach with all the third party libraries I've used in all my projects):
I inherited from your controls, for example I created
public class ExTabStrip : RadTabStrip
(another sidenote: I plan to do it independently of this issue, because it is always better to be able to add new behaviors to third party controls)
Since I know a bit of asp.net I've looked to your controls and noticed that they are implementing MS IScriptControl interface, so I thought the right solution was to override
IEnumerable<ScriptReference> GetScriptReferences()
and add there the external js files. In this way everything is wrapped in the control and the page must not know about these details.
For example 
protected override IEnumerable<ScriptReference> GetScriptReferences()
{
List<ScriptReference> scriptReferences = new List<ScriptReference>();
scriptReferences.Add(new ScriptReference("~/JS/Telerik/Common/Core.js"));
... // Other js files specific for each control
return scriptReferences;
}
But I get a lot of js errors. Sometimes this happens because some js files are imported more than once in the page (like the "PopupScripts.js" script)

Is this approach correct?
Is there any way to reach my goal?

Best regards, Andrea Pirola
Peter
Telerik team
 answered on 10 Aug 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?