I have problem with a Delete button that I added beside this GridView. At the runtime its IsEnabled property goes "false"!
would you please help me to figure it out, why?
Here is the XAML Code:
<telerik:RadGridView Margin="12,12,12,68" Name="radGridView1" AutoGenerateColumns="False" FlowDirection="RightToLeft"
ElementExporting="radGridView1_ElementExporting" ShowColumnFooters="True" ShowGroupFooters="True" AutoExpandGroups="True"
ShowInsertRow="False" SelectionMode="Extended" ActionOnLostFocus="None">
<telerik:RadGridView.Columns>
...
</telerik:RadGridView.Columns>
</telerik:RadGridView>
<Button Height="50" HorizontalAlignment="Left" Margin="68,0,0,12" x:Name="btnDelete" VerticalAlignment="Bottom" Width="50" Click="btnDelete_Click" Command="telerikGrid:RadGridViewCommands.Delete" CommandTarget="{Binding ElementName=RadGridView1}"/>
and this is the code-behind it:
public partial class myProgram : Page
{
KDBEntitiesSecond DBContext = new KDBEntitiesSecond();
public myProgram()
{
InitializeComponent();
var queryGrid = from c in DBContext.TblLeads select c;
radGridView1.ItemsSource = queryGrid;
}
would you please help me to figure it out, why?
Here is the XAML Code:
<telerik:RadGridView Margin="12,12,12,68" Name="radGridView1" AutoGenerateColumns="False" FlowDirection="RightToLeft"
ElementExporting="radGridView1_ElementExporting" ShowColumnFooters="True" ShowGroupFooters="True" AutoExpandGroups="True"
ShowInsertRow="False" SelectionMode="Extended" ActionOnLostFocus="None">
<telerik:RadGridView.Columns>
...
</telerik:RadGridView.Columns>
</telerik:RadGridView>
<Button Height="50" HorizontalAlignment="Left" Margin="68,0,0,12" x:Name="btnDelete" VerticalAlignment="Bottom" Width="50" Click="btnDelete_Click" Command="telerikGrid:RadGridViewCommands.Delete" CommandTarget="{Binding ElementName=RadGridView1}"/>
public partial class myProgram : Page
{
KDBEntitiesSecond DBContext = new KDBEntitiesSecond();
public myProgram()
{
InitializeComponent();
var queryGrid = from c in DBContext.TblLeads select c;
radGridView1.ItemsSource = queryGrid;
}
private void btnDelete_Click(object sender, RoutedEventArgs e)
{
DBContext.SaveChanges();
}
}
Thanks in advance!
{
DBContext.SaveChanges();
}
}