Hello all,

I have an application in which I have put a datagrid with update and delete buttons.
What I want is when I change the contents of the columns and click on update button, it should update that particular cell value into the database.

My xaml code is as follows :-

<UserControl x:Class="Petroweb_WPF_App.Petroweb_UserControls.Petroweb_ManageUploads"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="800" xmlns:my="clr-namespace:Petroweb_WPF_App.Petroweb_UserControls" HorizontalAlignment="Center" VerticalAlignment="Center">
    <Grid Height="Auto" Width="Auto">
        <DataGrid x:Name="PetroManageGrid" AutoGenerateColumns="False" ColumnWidth="*" AlternatingRowBackground="Transparent" RowBackground="Transparent">
            <DataGrid.Columns>
                <DataGridTextColumn x:Name="FName" Binding="{Binding FileName}" Width="150" Header="File Name"></DataGridTextColumn>
                <DataGridTextColumn x:Name="FPath" Binding="{Binding FilePath}" Width="450" Header="File Path"></DataGridTextColumn>
                <DataGridTemplateColumn>
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Content="Update" x:Name="UpdateB" Width="100" Click="UpdateB_Click"></Button>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn>
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Content="Delete" x:Name="DeleteB" Width="100" Click="DeleteB_Click"></Button>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
        </DataGrid>
    </Grid>
</UserControl>

Please help someone.
Thanks a lot.

Please help me someone.

Thanks a lot in advance.

Is there no one to help me ???

Thanks for no help anyways I've found a solution on my own.

commented: Quit whining. +0

please share the solution... I am also got stiuck in same place

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.