.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Post New Web Links

delete button in datagrid in MVVM not working

Posted By:      Posted Date: September 07, 2010    Points: 0   Category :WPF
 
hi all, i am using VS 2010 with silverlight 4.0. i have a datagrid. i have added a delete button as data template. but on button click, the event is not firing .  <sdk:DataGrid AutoGenerateColumns="False"                       Height="94"                       HorizontalAlignment="Left"                       Margin="0,53,0,0"                       Name="dataGrid1" VerticalAlignment="Top" Width="560"                       ItemsSource="{Binding SelectedComponentInfo.FilterComponentCriteriaMapping}"                       SelectedItem="{Binding SelectedMappingInfo, Mode=TwoWay}" CanUserReorderColumns="True" CanUserResizeColumns="True" DataCon


View Complete Post


More Related Resource Links

delete button in datagrid in MVVM not working

  
i have a datagrid. i have added a delete button as data template. but on button click, the event is not firing .  <sdk:DataGrid AutoGenerateColumns="False"                       Height="94"                       HorizontalAlignment="Left"                       Margin="0,53,0,0"                       Name="dataGrid1" VerticalAlignment="Top" Width="560"                       ItemsSource="{Binding SelectedComponentInfo.FilterComponentCriteriaMapping}"                       SelectedItem="{Binding SelectedMappingInfo, Mode=TwoWay}" CanUserReorderColumns="True" CanUserResizeColumns="True" DataContext="{Binding}">    

delete button in datagrid in MVVM not working

  
hi all, i am using VS 2010 with silverlight 4.0. i have a datagrid. i have added a delete button as data template. but on button click, the event is not firing .  <sdk:DataGrid AutoGenerateColumns="False"                       Height="94"                       HorizontalAlignment="Left"                       Margin="0,53,0,0"                       Name="dataGrid1" VerticalAlignment="Top" Width="560"                       ItemsSource="{Binding SelectedComponentInfo.FilterComponentCriteriaMapping}"                       SelectedItem="{Binding SelectedMappingInfo, Mode=TwoWay}" CanUserReorderColumns="True" CanUserResizeColumns="True" DataCon

Datagrid Link button within the Update panel events are not working

  

Hi,

I have a datagrid with linkbutton within the datagrid.   When i click on link button there is no response.   I have tried in different ways like
1.   after data binding to the datagrid
updatepanel1.Update()
2. AsyncPostBackTrigger ControlID="lnk1" EventName="Tick"

can any one please tell me How to fire the linkbutton


Thanks & Regards,
Jeevan.


Delete DataGrid row (WPF) by clicking Delete key button

  

Hi,

I have WPF 4 desktop-based application. In one of the windows of this application I have DataGrid with data, binded with SQL Server database (via ADO.NET Entity Framework). In order to manipulate with data I have delete button, that deletes selected row from DataGrid and call SaveChanges() method.

Now I want to add support for keyboard manipulations, e.g. i want to let user to remove row by selecting and clicking on Delete keyboard button.

If I set CanUserDeleteRows="True" in window's XAML, it removes selected row, but doesn't make commit to database, in other words, it doesn't call SaveChanges() method.

I tried to add keyDown event handler to DataGrid an check if (e.Key == Key.Delete), so run remove method that removes selected row and call SaveChanges() method, but it doesn't work.

My question is how can I add keyboard event handler to DataGrid that will let remove selected row and call SaveChanges() method or just run my own method, that deals w

update/delete not working on server only

  

my aspx page works in VWD, and everything works on the server EXCEPT update and delete sql functions. any ideas?

thanks 


Delete not working on List.aspx - out of box

  

Hello,


I'am trying to use Dynamic data web site on my project. I have Visual Studio 2010 enf Framework 4.0. I create the default project with the wizard. I add my own Entity Data Model.

When I try to use the "delete" autogenerated button on List.aspx, on the table ServerSetting (see image below), I receive a null exception.  I have no custom code involved in this operation and cannot seem to determine what is Null.

Any help would be appreciated!



Thanks,




Ben

[NullReferenceException: Object reference not set to an instance of an object.]
   System.Data.Objects.Internal.ForeignKeyFactory.CreateConceptualNullKey(EntityKey originalKey) +30
   System.Data.Objects.DataClasses.EntityReference.NullAllForeignKeys() +722
   System.Data.Objects.EntityEntry.NullAllForeignKeys() +235
   System.Data.Objects.EntityEntry.Delete(Boolean doFixup) +77
   System.Data.Objects.EntityEntry.Delete() +9
   System.Data.Objects.ObjectContext.DeleteObject(Object entity, EntitySet expectedEntitySet) +169
   System.Data.Objects.ObjectContext.DeleteObject

Select only one radio button in a datagrid

  

I have been frantically searching for help to select only one radio button in datagrid and deselect the other when a new button is clicked.

I do not want to use javascript. Can someone help me on this?


Delete not working all the time.

  
From time to time i am getting this error when attempting to delete a file. Exception Details: System.IO.IOException: The process cannot access the file 'D:\gallery\images\Untitled-1.jpg' because it is being used by another process. And the times i see it most is if i upload the image and then within seconds try to delete the image. Is there anything that can be done on my part to help prevent this? 

How to get the combobox value inside Datagrid on Edit button click event

  
Hi     I have Datagrid template column like<DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn>DataGridTemplateColumn Header="Edit" x:Name="Edit" ><DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn.CellEditingTemplate></DataGridTemplateColumn>SelectionChanged="cmbDGTeam_SelectionChanged" IsTabStop="True" /></DataTemplate><ComboBox Height="22" IsEditable="True" IsReadOnly="True" ItemsSource="{Binding}" DisplayMemberPath="Title" SelectedValuePath="TeamID" x:Name="cmbDGTeam"  SelectedValue="{Binding Path=TeamID,Mode=TwoWay}"<DataGridTemplateColumn.CellEditingTemplate><DataTemplate><DataTemplate><TextBlock Text="{Binding Title}"/></DataTemplate></DataGridTemplateColumn.CellTemplate><DataGridTemplateColumn Header="Team" Width="75"><DataGridTemplateColumn.CellTemplate> and Edit button Template column <DataGridTemplateColumn Header="Edit" x:Name="Edit" > </DataGridTemplateColumn.CellTemplate></DataTemplate><Button Content="Edit" IsEnabled="False" x:Name="btnEdit" Click="btnEdit_Click" ></Button>&l

DataGrid Paging not working

  
I got DataGrid Paging functionality on, I can see the paging 1,2,3,4,5.... but when i try to click on it to go to that page the datagrid just goes blank (does not render any record anything). My code is below: <asp:DataGrid ID="dgArticles" AllowPaging="true" Width="100%" AllowSorting="True" AutoGenerateColumns="False" runat="server" OnPageIndexChanged="dgArticles_PageIndexChanged" PageSize="15" EnableViewState= "true"> <ItemStyle Font-Names="Arial" Font-Size="12px" /> <HeaderStyle Font-Bold="true" ForeColor="#FFFFFF" Font-Names="Arial" Font-Size="14px" BackColor="#B2C1D1" /> <PagerStyle Mode="NumericPages" CssClass="FooterButton" Font-Size="Large" /> <AlternatingItemStyle BackColor="#EAEAEA" /> <Columns> <asp:BoundColumn DataField="ContentID" HeaderText="Content ID" /> <asp:HyperLinkColumn DataTextField="Headline" DataNavigateUrlField="ContentID" DataNavigateUrlFormatString=

popup for delete button

  
Hi, I have a set of CheckBox where i should select and delete them. So if i click delete button without selecting any checkbox  then the popup msg should be  "Select any one checkbox" after selecting the msg should be "Are you sure you want to delete". Can anyone provide me JavaScript for this or is there any better way other than using JS. ThanksHi,I have a set of CheckBox where i should select and delete them.So if i click delete button without selecting any checkbox  then the popup msg should be "Select any one checkbox"after selecting the msg should be "Are you sure you want to delete".Can anyone provide me JavaScript for this or is there any better way other than using JS.Thanks

Gridview and delete option - Button click displays message

  
Hi, I have a gridview connected to a sql database that allows the user to delete the record. I used the ASP.net automatic "options" for this. However, I would like when the user deletes a record, a message (textbox) appears in the form to say the record has been deleted. Please can anyone provide some sample codes?   Thanks in advance. Nijojo.

DataGrid Button + event in Footer, event not getting fire!

  
hi.First Time i am trying this...I have one Datagrid with Footer. Footer Row Contains Input fields with one Button to add New Values. I have button click event but not getting fires. my code follows:protected void dgPrice_ItemCreated(object sender, DataGridItemEventArgs e)    {            Button btnAdd = new Button();            btnAdd.Text = "Add";            btnAdd.Width = 80;            btnAdd.ID = "btnAdd";           // btnAdd.Attributes.Add("onClick", "return validateRates()");            btnAdd.CommandName = "add";            btnAdd.CommandArgument = e.Item.ItemIndex.ToString();            btnAdd.Command +=new CommandEventHandler (PriceNew);            e.Item.Cells[6].Controls.Add(btnAdd);}protected void PriceNew(object sender, EventArgs e)    {}btnAdd.command/ btnAdd.click event not getting fired I also tried to

ReportViewer Print Button not working correctly with windows 7 clients

  
I need some help being pointed in the right direction to fix the following issue: - After building several reports using reportviewer and testing with windows XP clients everything seemed to be fine.  I noticed that the first time the client loaded the asp.net website and clicked the print button it asked permission to install a small file (I assume this is to allow the reportviewer to access the clients printers).   - The problem I have is on Windows 7 Clients.  They can view/export the reports with no problem, but when they click the print button it ask permission to install the small file, but a error is given during the install process and the file is not installed.   If anyone has a solution or can point me in the right direction it would be helpfull.  I am using Visual Studios 2008 on Windows XP PRO and the site is hosted on Windows Server 2003 R3   Thanks 

The delete and edit buttons not working in gridview!

  
Hi everyone. I have problem with the buttons Edit and Delete in Gridview for very long time and i really need help about it.  So the when i click edit i get in edit mode and when click update the values in the row i was changing disappear but only in the gridview. When check in the Database nothing happens. The delete button not works at all, i mean when click on it only refresh the table. If see something wrong in my code please help. See how looks my page:Now here's my code in aspx:<%@ Page Language="C#" Title="Specific Search in Phone Directory" ... ... ... <asp:SqlDataSource ID="SqlDataSource7" runat="server" ConnectionString="<%$ ConnectionStrings:ThisIsMyConnection2 %>" OldValuesParameterFormatString="original_{0}" DeleteCommand="DELETE FROM [Resident] WHERE [MobileNum] = @MobileNum" InsertCommand="INSERT INTO [Resident] ([FNAME], [LNAME], [MobileNum], [HomeNum], [OfficeNum], [FaxNum]) VALUES (@FNAME, @LNAME, @MobileNum, @HomeNum, @OfficeNum, @FaxNum)" SelectCommand = "SELECT * FROM [Resident] WHERE (([FNAME] + ' ' + [LNAME] LIKE '%' + @FANDLNAME + '%'))" UpdateCommand=

delete more than one row in datagrid in silverlight 3

  
I tried to delete more than one row in datagird in silverlight, using chechbox checked, and binding to itemsource. I have following code: ---------------------- Orderlist = (System.Collections.ObjectModel.ObservableCollection<SilverlightWebService.Order>)dgOrders.ItemsSource;  System.Collections.ObjectModel.ObservableCollection<SilverlightWebService.Order> orderlist1 = new System.Collections.ObjectModel.ObservableCollection<ConcourseSilverlight.SilverlightWebService.Order>(); foreach (SilverlightWebService.Order aorder in Orderlist) { if (aorder.CheckedItem == false) orderlist1.Add(aorder); }  dgOrders.ItemsSource = orderlist1; -------------- DataGrid will be repopulated. But values selected will be defaut ones, that means data selected is not retained. may be itemsource is changes. how can I resolve this        

Gridview Delete not working

  
I just downloaded VS2010 with Framework 4.0.30319 I've bound a gridview control to a datasource, defined the select, insert, and delete SQL statements. Select and insert are working just fine thank you, but when I select the (auto-generated) Delete link, a postback occurs, but the row/record remains in the gridview. I have the one-segment key in the select statement, in an invisible column of the gidview. I've set the DataKeyNames property to this column name (CinID).  The delete query reads - DELETE FROM CallIn WHERE (CinID = Cid) I've defined the parameter Cid as the Gridview.SelectedRow, .SelectedDataKey, .SelectedIndex, and .SelectedValue, all with no joy. I created SUB Gridview.RowCommand put a breakpoint there. e.Command shows "Delete" and e.CommandArgument shows the correct row index (1). I created SUB Girdview.DeletingRow and put a breakpoint there. debug shows .SelectedRow=nothing and .SelectedDataKey=nothing (but I don't know if they *should* show something, since I'm not selecting, but rather deleting the row. The postback occurs (click), the grid refreshes, but nothing happens. I cannot figure out why the clicked-on row does not delete. Any ideas?  
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend