This is a migrated thread and some comments may be shown as answers.

How Could Control Two RadGrid from One RadDatePicker

3 Answers 69 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 16 Apr 2009, 04:28 PM

I would like to control data being displayed in two non hierarchical RadGrids using one RadDatePicker control. When the OnSelectDateChanged event occurs, I want the two grids to display content for that date only. The two grids use RadGridX_ItemDataBound to color code some of the data when the grids are refreshed.

I was hoping Telerik Rad Controls could invoke two functions or register two functions from one event handler. For example:

OnSelectedDateChanged="Raddatepicker2_SelectedDateChanged1; Raddatepicker2_SelectedDateChanged2". In this logic, Raddatepicker2_SelectedDateChanged1 would call on the server side,  SqlDataSource1.SelectCommand and Raddatepicker2_SelectedDateChanged2 would call SqlDataSource2.SelectCommand which have “WHERE” clauses with the selected date. This approach failed. I will appreciate any suggestion or hint.

 

Thanks,

Baxis

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Apr 2009, 10:06 AM
Hi Eric,

You can use the same OnSelectedDateChanged event of the RadDatePicker for both the Grids. In the OnSelectedDateChanged  event you can access the Selected date and invoke the SelectCommand of both the SqlDataSources.

Shinu.
0
Eric
Top achievements
Rank 1
answered on 17 Apr 2009, 04:01 PM

Hi Shinu,

Thanks for your prompt reply. Please note that I have tried that route with partial success. The data are being displayed correctly but the rows and columns color coding is only working on the first load.

When OnSelectDateChanged is fired, the color coding is not working and sometimes I am getting a timeout error.  I am using the following code snippet inside RadGrid_ItemDataBound:

 

foreach (GridDataItem item1 in RadGrid1.MasterTableView.Items)

            {

 

                foreach (GridColumn col in RadGrid1.MasterTableView.RenderColumns)

                {

                  

 

                    if (item1["SLA_DEADLINE"].Text == " ")

                    {

                        for (int i = 0; i < item1.Cells.Count; i++)

                        {

 

                            item1.Cells[i].ForeColor =                        System.Drawing.Color.White;

                            item1.Cells[i].BackColor = System.Drawing.Color.Green;

                            item1.Cells[i].Font.Bold = true;

                        }

                    }

}

}

Baxis

0
Eric
Top achievements
Rank 1
answered on 20 Apr 2009, 01:24 PM
Hi Shinu,


It works! I found the error in my WHERE clause.


Thanks
Baxis
Tags
Grid
Asked by
Eric
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Eric
Top achievements
Rank 1
Share this question
or