Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
105 views
hey there,

how can i use Hierarchical radgrid with advance data binding??..Where should i call NeedDataSource events for detail and master grid??..

thanks
Amit
Princy
Top achievements
Rank 2
 answered on 22 Mar 2011
2 answers
368 views
Hi,

I have one Radtreeview in the left side and Radgrid in the rightside.
Radtreeview binded dynamically. Its working fine.
private void BuildDataTable()
    {
        DataTable data = new DataTable();
        data.Columns.Add("parent_id");
        data.Columns.Add("child_id");
        data.Columns.Add("child_code");

        data.Rows.Add(null, "25", "AF-Angel Falls");
        data.Rows.Add(null, "26", "RR-Rapid Run");
        data.Rows.Add("25", "38", "P1-Phase1");
        data.Rows.Add("26", "39", "P1-Phase1");
        data.Rows.Add("38", "172", "001-Lot1");
        data.Rows.Add("38", "173", "002-Lot2");
        data.Rows.Add("38", "174", "003-Lot3");
        data.Rows.Add("38", "175", "004-Lot4");
        data.Rows.Add("38", "176", "005-Lot5");
        data.Rows.Add("39", "177", "001-Lot1");
        data.Rows.Add("39", "178", "002-Lot2");
        data.Rows.Add("39", "179", "003-Lot3");
        data.Rows.Add("39", "180", "004-Lot4");
        data.Rows.Add("39", "181", "005-Lot5");

        RadTreeView1.DataFieldID = "child_id";
        RadTreeView1.DataFieldParentID = "parent_id";
        RadTreeView1.DataTextField = "child_code";
        RadTreeView1.DataValueField = "child_id";
        RadTreeView1.ExpandAnimation.Duration = 100;
        RadTreeView1.DataSource = data;
        RadTreeView1.DataBind();
    }

when i select childnode (Lot1), based on childnode value i have to populate radgrid in the rightside.

private void BindRadGrid()
    {
       string selectedNodevalue = RadTreeView1.SelectedNode.Value; // Get the selected node value (ID)

        // Set the grid DataSource
        conn = new MySqlConnection(connString);
        MySqlDataAdapter adapter = new MySqlDataAdapter();
        string query = "SELECT distinct tsa.org_finish_Date,mjt.jobtype_code,tsap.total_float,tsap.activity_desc,tsap.original_duration, " +
                "tsap.early_start_display,tsap.early_finish_display, tsap.actual_start,tsap.actual_finish,tsap.pct,mdrc.delay_reason_code_id, " +
                "mdrc.delay_reason_code,tsap.delay_days,tsap.act_log,tsap.rem_duration, tsap.mandatory_start,tsap.mandatory_finish " +
                "from tsm_schedule_activities_publish_s tsap " +
                "inner join tsm_schedule ts on tsap.schedule_id=ts.schedule_id " +
                "inner join tsm_schedule_activities tsa on tsap.schedule_id=tsa.schedule_id " +
                "inner join msm_delay_reason_codes mdrc on tsap.delay_reason_code_id=mdrc.delay_reason_code_id " +
                "inner join msl_jobtypes mjt on ts.jobtype_id=mjt.jobtype_id " +
                "inner join min_com_lots mcl on mcl.com_lot_id=ts.com_lot_id where mcl.lot_id="+selectedNodevalue;
        adapter.SelectCommand = new MySqlCommand(query, conn);
        // DataSet myDataSet = new DataSet();
        conn.Open();
        try
        {
            adapter.Fill(myDataSet, "tsm_schedule_activities_publish_s");
        }
        finally
        {
            conn.Close();
        }
        RadGrid1.DataSource = myDataSet;
        //RadGrid1.DataBind();
    }

  error is, "Object reference not set to an instance of an object".
I am getting an error in this area
string selectedNodevalue = RadTreeView1.SelectedNode.Value; // Get the selected node value (ID).

my final output is in the attachment, when i hard coded the childnode value i got output like this.

Thanks,
Nagendra.
Nagendra
Top achievements
Rank 1
 answered on 22 Mar 2011
1 answer
316 views
My data is being shown in RadGrid. i am trying to export data in Excel. Properties are set for the RadGrid
like
        rdGridCustomer.ExportSettings.FileName = "MyDataFile";
        rdGridCustomer.ExportSettings.ExportOnlyData = true;
        rdGridCustomer.ExportSettings.IgnorePaging = false ;
        rdGridCustomer.ExportSettings.OpenInNewWindow = true;
        rdGridCustomer.ExportSettings.Excel.FileExtension = "xls";
        rdGridCustomer.ExportSettings.Excel.Format = Telerik.Web.UI.GridExcelExportFormat.Html;

event on that Excel is being exported.
 protected void btnExport_Click(object sender, EventArgs e)
    {
       
        rdGridCustomer.MasterTableView.ExportToExcel();     
    }
   event of Radgrid that is generated error
   Index was outside the bounds of the array.
when below event is fired after btnExport_Click event error occurs. It occurs only when
rdGridCustomer.MasterTableView.ExportToExcel();     this code of line exceuted.
 protected void rgModuleGrid_PreRender(object sender, EventArgs e)
      {
          // Institute Maximum Page Size for Main Grid
          GridPagerItem pagerItem = (GridPagerItem)rdGridCustomer.MasterTableView.GetItems(GridItemType.Pager)[1];
          on this above bold line error occures.
          RadNumericTextBox textBox = (RadNumericTextBox)pagerItem.FindControl("ChangePageSizeTextBox");
       }
please give me solution.
Thanks.
Princy
Top achievements
Rank 2
 answered on 22 Mar 2011
1 answer
212 views
I'm using the U.S. calendar format convention, but was wondering if I can change the order in which the week appears in my calendars.  Right now it appears as Sunday, Monday,...Saturday.  I was wondering if there is a setting to start the week at Monday and have it finish on Sunday.  I have an application which is based on a weekday and weekend times, so it would help to be able to see the calendar is the same format.

Thanks
Shinu
Top achievements
Rank 2
 answered on 22 Mar 2011
2 answers
252 views

Hi there,

I'm loading a RadGrid with AutoGenerateColumns="true", for databinding I'm using NeedDataSource(...) event handler. Since I want to format values from some columns I use the ColumnCreated(...) event handler. I also want to do some Aggregation based on  the type of column. For this, I have the following helper method:

public static void ColumnCreated(object sender, Telerik.Web.UI.GridColumnCreatedEventArgs e)
        {
           
            if(!string.IsNullOrEmpty(e.Column.UniqueName))
            {
                GridBoundColumn gbc = e.Column as GridBoundColumn;

                if (gbc != null)
                {
                    gbc.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;

                    gbc.HeaderText = gbc.UniqueName.ToUpper() == "EXPANDCOLUMN" ? string.Empty : gbc.UniqueName;

                    switch (gbc.DataTypeName.ToUpper())
                    {
                        case "SYSTEM.DATETIME":
                            gbc.DataFormatString = "{0:d}";
                            break;
                        case "SYSTEM.DECIMAL":
                            gbc.DataFormatString = "{0:N2}";
                            gbc.Aggregate = GridAggregateFunction.Sum;
                            gbc.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
                            gbc.FooterStyle.HorizontalAlign = HorizontalAlign.Right;
                            break;
                    }
                }               
            }
        }

But when this event fires something real "weird" is happening. I keep getting the following error:

Microsoft JScript runtime error:
Sys.WebForms.PageRequestManagerServerErrorException: cannot find column [xxxxxx].

When I mean "weird" is that such column does exist!.

On the other hand, when I comment out the logic inside ColumnCreated(...) event, the error does not show up. But as you might expect... the values are not formatted as well as there is no Aggregation on the columns that I want, and I do really want the event to fire since I need to do some formatting on the values of certain columns.

Thanks in advance,

Felix


Today, I tried a different approach.  This time I used the ItemDataBound(...) event.

The code now is as follows:

protected void gvwOperaciones_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if(e.Item.ItemType == GridItemType.AlternatingItem ||
            e.Item.ItemType == GridItemType.Item)
        {
            int colIndex = 0;
            DataRowView drv = e.Item.DataItem as DataRowView;

            foreach (DataColumn dc in drv.DataView.Table.Columns)
            {
                GridDataItem gdi = e.Item as GridDataItem;
                switch (dc.DataType.ToString().ToUpper())
                {
                    case "SYSTEM.DATETIME":
                        gdi[dc.ColumnName].Text = string.Format("{0:d}", drv[dc.ColumnName]);                       
                        break;
                    case "SYSTEM.DECIMAL":
                        gdi[dc.ColumnName].Text = string.Format("{0:N2}", drv[dc.ColumnName]);
                        GridBoundColumn gbc = gvwOperaciones.MasterTableView.AutoGeneratedColumns[colIndex] as GridBoundColumn;
                        if(gbc != null)
                            gbc.Aggregate = GridAggregateFunction.Sum;
                        break;
                    default:
                        break;
                }
                colIndex++;
            }
        }
    }


But something interesting again!!!, this time if I comment out the lines:

GridBoundColumn gbc = gvwOperaciones.MasterTableView.AutoGeneratedColumns[colIndex] as GridBoundColumn;
if(gbc != null)
    gbc.Aggregate = GridAggregateFunction.Sum;


It works! but remember that the aggregation Does not occur!!!

Now as soon as I put them back again, the aforementioned error in javascript pops up again!!! 

Question:
Is it bug in RadGrid? Am I not coding the right way?

This is really driving me nuts! :-( Can some one, please shed some light on this?

Felix
Felix Ruben Melendez Batres
Top achievements
Rank 1
 answered on 21 Mar 2011
1 answer
53 views
What is the best way to dynamically assign the skin of a RadMenu control?

I've created a Sharepoint 2010 webpart, and exposed a text property named "Skin", which can be set when you modify the webpart.

I'd like to use the value of this property to change the skin once the property is set.

Therefore, I've used the following code in the PreRender event:

this.RadMenu1.Skin = WebPart.Skin.ToString();

but it doesn't seem to work... but I know the PreRender event is being fired - I can debug through it.

Is there a refresh that needs to be called after the line above?

Thanks in advance for your help.

Bill Richardson
Kalina
Telerik team
 answered on 21 Mar 2011
0 answers
99 views
It has recently come to our attention that our visitors using AOL is encountering problems when trying to use the Rad Controls we have placed on our site. 

Mostly around the RadDatePicker; from a user comment, "it shows that there is not a calendar icon to the right of the start and end date areas to click on to enter the start and end dates".

Is there any reports out that indicate AOL users are having problems with Telerik AJAX Controls?  Any insight in this at all?

We are gathering more information, as which browser they are using, but we are not receiving any other complaints from visitors NOT using AOL.

Any help or insight would be great!
Paul
Top achievements
Rank 2
 asked on 21 Mar 2011
7 answers
89 views
So, if you want to add and image upload icon - you lose the rest of the functionality of the radEditor?  How do I retain the other information in the menu of the radEditor yet add the ability to add images?

Thanks in advance.
Marin Bratanov
Telerik team
 answered on 21 Mar 2011
10 answers
190 views
Hi,
I handle the client side double click event to move a node from one tree to another.

my code :

treeSrc.trackChanges();

treeDst.trackChanges();

treeSrc.get_nodes().remove(node);

treeDst.get_nodes().add(node);

treeSrc.commitChanges();

treeDst.commitChanges();
...

When I double click some tree node it will be actually moved. However, I also got a runtime error: "'null' is null or not an object"

...

if

(this.get_contextMenuIDs().length>0){

Telerik.Web.UI.RadContextMenu.hideAll();

}

},_expandOnHover:function(e){

if(Telerik.Web.UI.RadTreeView._draggingTreeView){

var _53=this._extractNodeFromDomElement(e.eventMapTarget);

this._hoveredNode=_53;

window.setTimeout(function(){

if(_53==_53._getControl()._hoveredNode){

_53.set_expanded(true);

}

},1000);

}

return true;

},_toggle:function(e){

var _55=this._extractNodeFromDomElement(e.eventMapTarget);

if(!_55.get_isEnabled()){ //This line causes problem

return;

}

this._hideContextMenus();

e.stopPropagation();

var _56=_55.get_expanded();

if(_56==false){

if(this.raise_nodeExpanding(_55)){

return;

}
...

any idea on this?

Cheers,
Elton

Helen
Telerik team
 answered on 21 Mar 2011
2 answers
61 views
I am wondering if I can use a different datasource for the day view instead of the week or the month view?
Rick
Top achievements
Rank 1
 answered on 21 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?