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


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

delete more than one row in datagrid in silverlight 3

Posted By:      Posted Date: September 12, 2010    Points: 0   Category :ASP.Net
 
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        


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

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

Refresh Silverlight datagrid

  
In a Silverlight page I have a datagrid (items loaded from a SP list) and below it a dataform that lets the user make edits to the items displayed in the datagrid when a row is selected from the datagrid.  However, when a user makes an edit to an item using the dataform, the datagrid doesn’t get refreshed when I re-query (via CAML) the SP list to refresh the datagrid.  Only if I change another item in the dataform, does the datagrid then refresh as expected. Code when I Edit the list item in the dataform: public void EndEdit() { ClientContext context = new ClientContext(ApplicationContext.Current.Url); context.Load(context.Web); _skills = context.Web.Lists.GetByTitle("Skills_NewRequest").GetItemById(skillId); _skills["TimeStamp"] = TimeStamp; _skills["Parent"] = Parent; _skills.Update(); context.ExecuteQueryAsync(OnRequestSucceeded, OnFailListener); } private void OnRequestSucceeded(Object sender, ClientRequestSucceededEventArgs args) { Deployment.Current.Dispatcher.BeginInvoke(BindData); } private void BindData() { //MessageBox.Show("Your request has been submitted!"); }   And here’s the code for refreshing the datagrid: private void dataFormNewPending_EditEnding(object sender, DataFormEditEn

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

Add, Modify, Delete Screen with a Datagrid on top listing all the records

  

Hi,

I have the requirement of creating an Add, Modify, Delete Screen with a Datagrid on top listing all the records. This needs to be incorporated using WPF with .Net 4.

1. I have to create a Base Control which holds a Datagrid and a tool bar with Add, Modify, Delete and Cancel buttons.
2. I have to create a Control (detail) having some fields like name, address, dateofbirth, etc. I need to inherit the above base control in this detail control to override events like btnAdd_Click, btnModify_Click, btnDelete_Click, etc.

Please let me know how to achieve this in WPF, I am facing couple of problem here:

1. I followed the approach mentioned in the below link.

http://svetoslavsavov.blogspot.com/2009/09/user-control-inheritance-in-wpf.html

Following this approach I am using a wpf custom control for my base control. But I am not sure if its good to place my Datagrid in Generic.xaml. Even with this approach I am facing problems in wiring up Datagrid Events from Generic.xaml to my custom control (my base control) class.

Please give a example solution for this problem.


WPF DataGrid Style Templates to make it look like the Silverlight DataGrid

  

Hi,

Many of you might have noticed that the WPF DataGrid looks very blah compared to the Silverlight DataGrid.

Here are the WPF DataGrid Screenshot and Silverlight DataGrid Screenshot.

See how in the Silverlight DataGrid the lines are better, there are alternating row backgrounds and the selected row also looks better.

I am surprised the WPF DataGrid doesn't use the same styles by default as the Silverlight.

Has anyone styles the WPF DataGrid to make it look like the Silverlight DataGrid and if so can you share the templates with me?

Or is there a built-in theme in WPF DataGrid that looks close to the Silverlight DataGrid?

Thanks

Cooper


to delete a row from database in silverlight

  

how to delete a row from the table using Domain service class,,,and i have kept a delete button in the telerik datagrid...so how to delete a row from database...



How to delete a row drom database through datagrid view in Visual Basic 2008?

  

I am trying to delete a row from database through datagridview. some more information about coding is "data as Dataset" & "adap as TableAdapter" & "Group is my Table Name". I am using Visual Basic 2008 express edition with sql server 2008 Express Edition with Management Studio. I created the .mdf file in Mangement studio and i connected this file directly to the project. My opreating System is WINxp Proffessional. Now my code is given below:

For Each Row As DataGridViewRow In GroupDataGridView.SelectedRows
GroupDataGridView.Rows.Remove(Row)
'Me.adap.Update(Me.data.Group)

 

when i applied this code only one was deletd that time. But when i close the program and redubug the program whole data was deleted.

And then next i tryed this code :

Dim dr As DataRow
    dr = Me.data.Group.Rows.Item(GroupDataGridView.CurrentRow.Index)
    dr.Delete()
    Me.data.AcceptChanges()
    Me.adap.Update(Me.data.Group)

or

Me.data.Group.Rows(GroupDataGridView.CurrentRow.Index).Delete()
    Me.data.AcceptChanges()
    Me.adap.Update(Me.data)
<

Silverlight - Dynamically generating a table for datagrid

  

Hi there,

 

I am parsing a table in my Silverlight application. Lets say the table is as follows

*   A   B   C

A   1   2   3

B   3   4   6

C   2   2  2

I do not know before hand the column names, how many columns there are so, as far as I know, I can only see a solution to presenting this as a table with the traditional unbound data strategy as in windows forms.  However, my solution is in Silverlight, so I necessarely need to bind to an object.  But as said, I do not know the object properties, so I got stuck.  Please help; this seems like it should be very simple to display a parsed table.

 

Many thanks. 

 


Selecting One Checkbox Control In DataGrid Control Using MVVM Using Silverlight

  
In this post I will show you how to select single check-box control when you have single check-box control in each row of the datagrid control. As you all know that check-box controls are normally used for the multiple selection and radio buttons are used for single selection. But there are sometimes requirement that control should be check-box and selection should be single. Mean if user view data in the datagrid control then he/she should only select one check-box at a time not more then one. Main page is shown in the Image 1. Here you can see that I have placed check-box control in the first column of the datagrid control which I have also highlighted.

Get SelectedItems From DataGrid Using MVVM In Silverlight

  
In this post what I want to learn and to share something like how to get the selected items from the data grid control of the Silver light using MVVM. You can see the main output of the example code in the Image 1, here you can see that I have a data grid control and three button with label Add, edit and delete records. Let me explain you what is happening in the example code, user is allowed to select multiple record from the grid and the selected records Ids are displayed in the "Selected Ids" area. If user select only one record then add and edit buttons are enabled and if records are more then one then add and edit buttons are disabled. Similarly If number of selected item count is shown in the delete button text.

How To Use DataTriggers In Silverlight DataGrid

  
In this short post I will show you how you can use DataTriggers in datagrid control DataGridTemplateColumn. This was one of the questions when reading one of the forum to change persform some sort of functionality depending on the value of the property. Out of the example code can be seen in the Image 1 here you can see that I have used the DataTrigger for the Subscribed which is nullable Boolean type, mean It hold true , false and null value.

Delete Datagrid Rows

  
One of the question which was asked on the silverlight forum was how to delete multiple rows of the datagrid when you have provided the checkboxs in the datagrid for the selection of more then one row in the datagrid.

Serving Silverlight Apps from Windows Mobile

  
Even if mobile dev is not my every day work, thanks to the .Net Compact Framework, it's still .Net programming.

Here is the scenario:

You come back home, you have a windows mobile phone wifi capable and you want to quickly get access to your phone pictures from your home network.
You just activate the Wifi, run my app and then browse to the provided link from any computer on the network.

Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

  
In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.

How to format and update GridView and DataGrid rows using JQuery

  
The behavior described in this question is as expected. When you set text of a cell in grid, it directly affects HTML that is going to be rendered. When you set text value of a cell, it means that you are setting innerText of the cell. The column that GridView creates for command fields (Edit, Delete and Select) are a (anchor) or button elements. So you can see what will happen if you set text value in that cell. It will wipe out those link or button controls and replace them with simple text string.
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