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

RadGrid.Rows.Clear() doesn't work

11 Answers 1509 Views
GridView
This is a migrated thread and some comments may be shown as answers.
andi
Top achievements
Rank 1
andi asked on 28 Jan 2008, 09:35 PM
RadGrid.Rows.Clear() doesn't work!? is there a bug?

thanks, andreas

11 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 29 Jan 2008, 01:03 PM
Hi Andreas,

Thank you for reporting this issue.

We managed to reproduce this issue on our side and we will address it in our upcoming Q1 2008 release.

Please, excuse us for the inconvenience. We have updated your Telerik points.

Don't hesitate to contact us if you have other questions.

Kind regards,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mike
Top achievements
Rank 2
answered on 05 Mar 2008, 02:54 PM

Hi Telerik,

Do you guys have a work around for this issue?

When I try to use the following code the column widths get all messed up.

 private void BuildGridColumns()  
        {  
            grdrResults.MasterGridViewTemplate.AutoGenerateColumns = false;  
            grdrResults.MasterGridViewTemplate.AllowAutoSizeColumns = true;  
            grdrResults.MasterGridViewTemplate.Columns.Add(new GridViewTextBoxColumn("DocID"));  
            grdrResults.MasterGridViewTemplate.Columns.Add(new GridViewTextBoxColumn("DocName"));  
            grdrResults.MasterGridViewTemplate.Columns.Add(new GridViewTextBoxColumn("DocTypeName"));  
            grdrResults.MasterGridViewTemplate.Columns.Add(new GridViewTextBoxColumn("DocCatName"));  
            grdrResults.MasterGridViewTemplate.Columns.Add(new GridViewTextBoxColumn("DocStatusName"));  
        }  
 
        private void BindData(string strCatName, int intStateID)  
        {  
            grdrResults.MasterGridViewTemplate.Columns.Clear();  
            BuildGridColumns();  
            grdrResults.DataSource = AppDocument.SearchDocuments("ReturnAll", 0, 0, "", 0, strCatName, 0, "Released", "", 0, intStateID, 0, false);  
        } 

Regards,
Mike
0
Jack
Telerik team
answered on 06 Mar 2008, 05:04 PM
Hello mike,

Thank you for reporting this issue.

We managed to reproduce it. It will be addressed in our upcoming release Q1 2008. To work around this issue, place a call to the BeginUpdate method before clearing the columns and a call to the EndUpdate method after binding the grid. Refer to the code snippet below:

private void BindData(string strCatName, int intStateID) 
    grdrResults.GridElement.BeginUpdate(); 
    grdrResults.MasterGridViewTemplate.Columns.Clear(); 
    BuildGridColumns(); 
    grdrResults.DataSource = AppDocument.SearchDocuments("ReturnAll", 0, 0, "", 0, strCatName, 0, "Released""", 0, intStateID, 0, false); 
    grdrResults.GridElement.EndUpdate(); 
}  
 

I hope this helps. Let me know, if you need further assistance.

Sincerely yours,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jose Maria Andrew Sison
Top achievements
Rank 1
answered on 29 Oct 2010, 08:01 AM
:: workaround ^_^

set your radgridview datasource = nothing.

RadGridView.DataSource = Nothing

hope this helps!


0
Emanuel Varga
Top achievements
Rank 1
answered on 29 Oct 2010, 08:18 AM
Hello,

To clear selection in the current version you can use:
VB:
Me.RadGridView1.ClearSelection()
Me.RadGridView1.CurrentRow = Nothing
'usually this is enough but if you still have something selected you should uncomment the following line
'Me.RadGridView1.CurrentCell.IsSelected = False

C#:
this.radGridView1.ClearSelection();
this.radGridView1.CurrentRow = null;
//usually this is enough but if you still have something selected you should uncomment the following line
this.radGridView1.CurrentCell.IsSelected = false;

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga
0
Jack
Telerik team
answered on 02 Nov 2010, 12:57 PM
Hi Jose,

Regarding the Rows.Clear method, it works only when using a data source that supports it or when RadGridView is used in unbound mode.

Regarding the layout issue, I tested the case using our latest release and it works well. Please contact us if you experience issues. We will be glad to help.

Should you have any other questions, do not hesitate to write us.

Greetings, Jack
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jorge
Top achievements
Rank 1
answered on 14 Mar 2011, 02:28 PM
Good morning!

My version of the telerik is RadControls for ASP.NET Ajax 2010 Q3.

I'm trying to remove columns that are inserted with the command gridProntuarios.MasterTableView.Columns.Add() of grid through the command "gridProntuarios.MasterTableView.Columns.Clear();" and
"gridProntuarios.Columns.Clear();" but don't work.

What would the solution for this trouble?

Thanks!
0
Richard Slade
Top achievements
Rank 2
answered on 14 Mar 2011, 03:27 PM
Hello,

You have posted your question in the WinForms forums. To gain a quicker, more accurate response, please re-direct your question to the asp.net ajax forums where I'm sure you will find the help that you need. May I also request that you only post your questions once as posting multiple questions that are the same may further slow down response times.

Regards,
Richard
0
Sivaprakas Subramanian
Top achievements
Rank 1
answered on 09 Apr 2011, 07:00 AM
hi andi try this

RadGrid1.GroupDescriptors.Clear()

RadGrid1.Rows.Clear()

Its work for me

0
kia
Top achievements
Rank 1
answered on 16 May 2011, 01:05 PM
Hi
Your soluion have 2 step:
1: set EnableViewState="false" in your aspx file.
2: gridView.DataSource = null;
    gridView.DataBind();


Hope this help
0
Abdulrahman Khalil
Top achievements
Rank 1
answered on 24 May 2011, 08:14 AM
Hi Sivaprakas Subramanian,

Thanks for your help,
its also working with me,

Great job Sivaprakas Subramanian.


Abdulrahman
Tags
GridView
Asked by
andi
Top achievements
Rank 1
Answers by
Jack
Telerik team
Mike
Top achievements
Rank 2
Jose Maria Andrew Sison
Top achievements
Rank 1
Emanuel Varga
Top achievements
Rank 1
Jorge
Top achievements
Rank 1
Richard Slade
Top achievements
Rank 2
Sivaprakas Subramanian
Top achievements
Rank 1
kia
Top achievements
Rank 1
Abdulrahman Khalil
Top achievements
Rank 1
Share this question
or