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

How can i do filtering with rad grid?

6 Answers 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Swapnil
Top achievements
Rank 1
Swapnil asked on 24 Sep 2012, 11:29 AM
How can i do filtering with rad grid?
Thanks.

6 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 24 Sep 2012, 11:44 AM
Hi,
Try setting AllowFilteringByColumn as true to enable filtering in RadGrid.
aspx: 

<telerik:RadGrid ID="RadGrid2" runat="server" AutoGenerateColumns="false" AllowFilteringByColumn="true" OnNeedDataSource="RadGrid2_NeedDataSource" onprerender="RadGrid2_PreRender">
    <MasterTableView>
    <Columns>
        . . .     
    </Columns>
     </MasterTableView>
</telerik:RadGrid>
Also check the following demo.
Grid / Filtering Template Columns

Thanks,
Princy.


0
Swapnil
Top achievements
Rank 1
answered on 24 Sep 2012, 12:14 PM
Hi
what to write on these events
OnNeedDataSource="RadGrid2_NeedDataSource" onprerender="RadGrid2_PreRender"

i am now using inbuilt filtering like write click on grid and then by checking allow filtering,
but sometime it works properly some time not
Thanks
0
Accepted
Princy
Top achievements
Rank 2
answered on 25 Sep 2012, 04:13 AM
Hi,

I apologize for attaching extra event(Prerender) which doesn't have any relation with this. You can populate the grid in NeedDataSource event as shown below.
C#:
protected void RadGrid2_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
        SqlConnection con1 = new SqlConnection(WebConfigurationManager.ConnectionStrings["NorthwindConnectionString3"].ConnectionString);
        SqlCommand cmd = new SqlCommand("SELECT top 5 * FROM [Orders]", con1);
        SqlDataAdapter ad = new SqlDataAdapter(cmd);
        DataSet ds = new DataSet();
        ad.Fill(ds);
        RadGrid2.DataSource = ds;
}

Thanks,
Princy.
0
Swapnil
Top achievements
Rank 1
answered on 25 Sep 2012, 04:20 AM
Thanks Princy.
0
Swapnil
Top achievements
Rank 1
answered on 25 Sep 2012, 04:22 AM
Hi Princy,Can you tell me how can i do insert,update,delete with rad grid?
because i am new to rad controls.
Thanks in Advance.
0
Princy
Top achievements
Rank 2
answered on 26 Sep 2012, 04:37 AM
Hi,

You can perform automatic operations in RadGrid by setting the following.
aspx:
<telerik:RadGrid ID="RadGrid1"  runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"  AllowAutomaticUpdates="True" . . . >
</telerik:RadGrid>
Check the following demo which implements the same.
Grid / Automatic Operations

Thanks,
Princy.
Tags
Grid
Asked by
Swapnil
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Swapnil
Top achievements
Rank 1
Share this question
or