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

Conditional DataBinding

1 Answer 90 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tzahi
Top achievements
Rank 1
Tzahi asked on 31 Dec 2011, 10:25 AM
Hi all,


I have a grid view with an automatic datasource binding.
I would like this databinding to fire only if meets some condition.

Today, when ever a text is entered to the TextBox and a button is pressed the databidning is excuted.

Note - I don't want to change the datasource query, just it's happening...


Can I override this?


Thx

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 02 Jan 2012, 02:58 PM
Hi,

What DataSource controls are you using? You can try handling its Selecting server-side event and cancel it if the conditions are not met.

protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
    e.Cancel = true;
}


All the best,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Tzahi
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or