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

Hide Filter on CommandITem (add record)

2 Answers 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brandon
Top achievements
Rank 1
Brandon asked on 18 Apr 2008, 05:20 PM
Hello!

Is it possible to hide the filter row in my grid when a user clicks "Add new record"?

Also, my Grid stays in Edit mode when I click "Add new record". How do I go about canceling the edit before the Insert form is opened?

I've searched and can't find these answers, thanks for your time in advance!
Brandon

2 Answers, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 21 Apr 2008, 07:49 AM
Hi Brandon,

Thank you for contacting us and for your question.

With the official release of RadControls for ASP.NET AJAX, you can hide the filter row in RadGrid easily client-side:

http://www.telerik.com/demos/aspnet/prometheus/Grid/Examples/GeneralFeatures/Filtering/DefaultCS.aspx

As to the canceling the edit item, that can be achieved through the following code snippet:

 private void RadGrid1_ItemCommand(object  source, GridCommandEventArgs e) 
 RadGrid grid = (source as RadGrid); 
 if (e.CommandName == RadGrid.InitInsertCommandName) 
 { 
    if (grid.EditItems.Count > 0) 
   { 
     grid.MasterTableView.ClearEditItems(); 
   } 
 } 
}  

You can find more info on the topic in the docs here.

Regards,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Brandon
Top achievements
Rank 1
answered on 21 Apr 2008, 05:49 PM
I figured there'd be an easy answer for both of these questions. However, I'm having troubles figuring out how to call a client jscript function from my codebehind?


VB code for the solution to my closing problem below. I'm hoping I can put something in the If statements that call those client side functions?  ::

        Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand 
            Dim grid As RadGrid = source 
 
            If e.CommandName = RadGrid.InitInsertCommandName Then 
                If grid.EditItems.Count > 0 Then 
 
                    grid.MasterTableView.ClearEditItems() 
                End If 
            End If 
            If (e.CommandName = RadGrid.EditCommandName) Then 
                e.Item.OwnerTableView.IsItemInserted = False 
            End If 
        End Sub 

You guys are fantastic, love the product, thanks for the help :)
Tags
Grid
Asked by
Brandon
Top achievements
Rank 1
Answers by
Konstantin Petkov
Telerik team
Brandon
Top achievements
Rank 1
Share this question
or