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

[Solved] Clearing Grid and binding new resutls?

1 Answer 85 Views
Grid
This is a migrated thread and some comments may be shown as answers.
James O'Brien
Top achievements
Rank 1
James O'Brien asked on 09 Oct 2009, 03:16 PM

I having an issue rebinding and/or clearing the old results in the grid. The code below populates RadGridType. On load returnCourseName return 63 records (confirmed). Then the user selects something on RadGridProduct and this function is launched again, this time returnCourseName returns 21 records (confirmed) but the 63 records are still in RadGridType. All I want to do is clear the grid and send it new results. That all!!!

<telerik:RadGrid   
                                        ID="RadGridType"   
                                        runat="server"   
                                        AutoGenerateColumns="False"   
                                        GridLines="None"   
                                        AllowMultiRowSelection="True"   
                                        ShowHeader="False"   
                                        BorderStyle="None"   
                                        Skin="Web20"   
                                        ForeColor="#3399CC"   
                                        Font-Bold="False"   
                                        Font-Italic="False"   
                                        Font-Names="Verdana"   
                                        Font-Overline="False"   
                                        Font-Strikeout="False"   
                                        Font-Underline="False">  
                                        <AlternatingItemStyle   
                                            Font-Bold="False"   
                                            Font-Italic="False"   
                                            Font-Overline="False"   
                                            Font-Strikeout="False"   
                                            Font-Underline="False"   
                                            ForeColor="#3399CC"   
                                            Wrap="True" /> 
                                        <ItemStyle   
                                            Font-Bold="False"   
                                            Font-Italic="False"   
                                            Font-Overline="False"   
                                            Font-Strikeout="False"   
                                            Font-Underline="False"   
                                            ForeColor="#3399CC"   
                                            Wrap="True" /> 
                                        <MasterTableView   
                                            Font-Bold="False"   
                                            Font-Italic="False"   
                                            Font-Names="Verdana"   
                                            Font-Overline="False"   
                                            Font-Strikeout="False"   
                                            Font-Underline="False"   
                                            Font-Size="11px">  
                                        <RowIndicatorColumn> 
                                        <HeaderStyle Width="20px"></HeaderStyle> 
                                        </RowIndicatorColumn> 
                                        <ExpandCollapseColumn> 
                                        <HeaderStyle Width="20px"></HeaderStyle> 
                                        </ExpandCollapseColumn> 
                                            <Columns> 
                                                <telerik:GridClientSelectColumn Display="False" UniqueName="columnBlank">  
                                                </telerik:GridClientSelectColumn> 
                                                <telerik:GridBoundColumn   
                                                    DataField="CourseName"   
                                                    UniqueName="colCourseNameSelect"   
                                                    HeaderButtonType="None">  
                                                </telerik:GridBoundColumn> 
                                            </Columns> 
                                            <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" ForeColor="#3399CC" Wrap="True" /> 
                                            <AlternatingItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" ForeColor="#3399CC" Wrap="True" /> 
                                            <EditItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Wrap="True" BackColor="Black" ForeColor="White" /> 
                                        </MasterTableView> 
                                        <SelectedItemStyle Font-Bold="True" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Wrap="True" ForeColor="Maroon" BackColor="Silver" /> 
                                        <ClientSettings EnableRowHoverStyle="False">  
                                            <Selecting AllowRowSelect="True" /> 
                                        </ClientSettings> 
                                    </telerik:RadGrid> 

public void returnCourseName(string strLocation)  
    {  
        GridItemCollection GDC = RadGridProduct.SelectedItems;  
        RadGridType.DataSource = new List<string>(0);  
        RadGridType.DataBind();  
        RadGridType.DataSource = clsTraining.returnCourseName(strLocation, GDC);  
        RadGridType.DataBind();  
    } 

1 Answer, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 09 Oct 2009, 09:02 PM
The code seems OK to me, we would probably need more information in terms of your implementation of this control and other controls on the page.
Tags
Grid
Asked by
James O'Brien
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Share this question
or