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


Top 5 Contributors of the Month
Kaviya Balasubramanian
Sgraph Infotech
Imran Ghani
Post New Web Links

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

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :WPF
 

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.




View Complete Post


More Related Resource Links

Allow or deny roles to update, insert and delete records.

  
Hello, I have two roles "Admin" and "Basic". I also have a listview on the web page. My goal is that to make "Admin" role has the highest privilege to deal with records such as "insert", "update" and "delete". For the role "Basic", it only can update the records. Is there any sample code for that? Thanks.  

I have relation many to many - how can I delete records from intermediate table ?

  
I have tables: Books id title Authors id name BooksAuthors book_id author_id Entity Framework generated only models for tables Books and Authors in relation many to many. How can I delete from table BooksAuthors all records where book_id =5 ?

Delete Multiple Records

  
Hai friends,            How to delete multiple records using checkbox in gridview?

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

Problem with listing records from table (object not found)

  
Hi everyone, I'm creating a website based on ASP.NET MVC 2 and SQL Server 2008 R2 Express for the database. After creating the table in database, I want to list all records in that table. For that, I use "scaffold'ing in ASP.NET to automatically generate the view file. But I encountered an error when loading that page. The error message was: [CODE] Server Error in '/' Application. Invalid object name 'dbo.Accommodations'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'dbo.Accommodations'. Source Error: Line 41:         </tr> Line 42: Line 43:     <% foreach (var item in Model) { %> Line 44: Line 45:         <tr> Source File: d:\MyProject\Views\Accommodation\Index.aspx    Line: 43 Stack Trace: [SqlException (0x80131904): Invalid object name 'dbo.Accommodations'.]    System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +2030802    System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5009584 &n

Is the delete records LINQ correct ?

  
I hope to delete all records in DBPrograms, is the following code correct?               DBContext db = DBContext(PublicDBPar.ConnectionString);            db.DBPrograms.DeleteAllOnSubmit(db.DBPrograms);            db.SubmitChanges();

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        

how to delete records automatically at server side

  
the application which i created is a web application which doesnt need much of a database,so i am just using the sql express  free version which allows 4 gb of data,to avoid disasters iw ould like to delete records which are very old like,1 month,2 months old etc,how can i do this periodically should i do this on client side or the server side... what id there are 100000 records and if we put this in page load or some method,it could take some time to delete,which i dont want..........can anyone suggest how i can automate this process at the server side only Please help me... thanks  

How to delete many records with minimal locks and IO?

  
hi, I have a larg db (160GB) that used both as OLTP and DW. there are several large tables that normally experience 10k-30k transactions per hour. most of them are INSERT and part are UPDATE. Tables have cluster PK of 5-8 fields with datetime one of them. tables have several indexes. normally we dont delete records. BUT, end-user may quit service once in a while and in this case we have a job to delete all his raw data. we have a job that tries to do it in small chunks to reduce impact on other processing jobs, but actually it slows down all other important transactions with long locks. I would like to know what is the best way to delete records from a large table with minimum impact on other transactions (insert and update). The delete task is a background job that is executed during night and may take many hours. here is my code: ALTER     PROCEDURE SP_ADMIN_DEL_DATA     @CompanyID int,     @itemID nvarchar(50) = '-1' AS begin     -- @itemID = -1 for all items     declare @d datetime     declare @upperDate datetime       set @upperDate = dbo.FN_DateOnly(getdate() + 1)     set @d = @upperDate - 800     while @d <= @upperDate     begin     begin tran     DELETE I_EVENTS with (PAGLOC

How to delete many records with minimal locks and IO?

  
How to delete many records with minimal locks and IO? hi, I have a larg db (160GB) that used both as OLTP and DW. there are several large tables that normally experience 10k-30k transactions per hour. most of them are INSERT and part are UPDATE. Tables have cluster PK of 5-8 fields with datetime one of them. tables have several indexes. normally we dont delete records. BUT, end-user may quit service once in a while and in this case we have a job to delete all his raw data. we have a job that tries to do it in small chunks to reduce impact on other processing jobs, but actually it slows down all other important transactions with long locks. I would like to know what is the best way to delete records from a large table with minimum impact on other transactions (insert and update). The delete task is a background job that is executed during night and may take many hours. here is my code: ALTER @CompanyID     int, @itemID     nvarchar(50) = '-1' AS begin -- @itemID = -1 for all items declare     @d   declare     @upperDate   set     @upperDate = dbo.FN_DateOnly(getdate() + 1) set     @d = @upperDate - 800 while     @d <= @upperDate begin begin     tran DELETE       I_EVENTS with (PAGLOCK) WHERE     G_COMPANY_ID

How to delete many records with minimal locks and IO?

  
How to delete many records with minimal locks and IO? hi, I have a larg db (160GB) that used both as OLTP and DW. there are several large tables that normally experience 10k-30k transactions per hour. most of them are INSERT and part are UPDATE. Tables have cluster PK of 5-8 fields with datetime one of them. tables have several indexes. normally we dont delete records. BUT, end-user may quit service once in a while and in this case we have a job to delete all his raw data. we have a job that tries to do it in small chunks to reduce impact on other processing jobs, but actually it slows down all other important transactions with long locks. I would like to know what is the best way to delete records from a large table with minimum impact on other transactions (insert and update). The delete task is a background job that is executed during night and may take many hours. here is my code: ALTER @CompanyID     int, @itemID     nvarchar(50) = '-1' AS begin -- @itemID = -1 for all items declare     @d   declare     @upperDate   set     @upperDate = dbo.FN_DateOnly(getdate() + 1) set     @d = @upperDate - 800 while     @d <= @upperDate begin begin     tran DELETE       I_EVENTS with (PAGLOCK) WHERE     G_COMPANY_ID

Delete records if it is not getting inserted and also in the related tables

  
Hi All, If the insert into table person is successful, but the insert into table subject fails, delete the person record and all records associated with the person that were also inserted. If the insert into table person is successful, and the insert into subject is successful, but the insert into the booking table fails, delete the subject record, the person record ,and all records associated with the person that were also inserted. The reason for the failure into the 3 tables (person, subject, booking) should be logged to tblErrors . Also, a message should be written to tblErrors which logs the fact that this situation has occurred.     -- I have few stored procs which does inserts and updates How would i capture the record which is not getting inserted and log in to log table and delete the previous records which got inserted  which are related to that.

Delete Duplicate Records from MySQL table

  

I have Revision column in Quote table with time stamp (MySql table) now i am viewing the entire date and time my end user want to view only Date he doesnot want to see time how can i pull only date.i am displaying revision column in two ways one in grid view and another one in field value

Query in my Grid view
Dim query As String = "SELECT QuoteNumber,Revision,Vendor,PartNumber,status,Customer,Requestor from quotes"
On select check box in grid view, filed values will be loaded with data.

field value
txtRev.Text = dt.Rows(indx)("Revision").ToString()

 

 

 


Hyperlink to add, modify and delete?

  

On the home page of my SP2010 site (http://blahblah.com/Dev/default.aspx ) I have a few icons.  On the left is the usual SP Libraries and Lists.  In one of the lists is a fairly elaborate InfoPath based add/remove/delete screens (http://blahblah/Dev/Lists/CMDB/AllItems.aspx ).  I'd like to make the icons on the home page hyperlinked to allow the user to jump directly into the 'Add new Item' to a list, 'Edit' a list item, or 'Modify' a list item ... all in modal dialog format.

If I go to the list I want to have this work for and hover over the Add New Item in the List I get this:

http://blahblah.com/Dev/_layouts/listform.aspx?PageType=8&ListId={AD9712E6-CC28-4ACD-9192-C1ECCEDA96C7}&RootFolder=

Is there a way to easily provide a hyperlink to this?

Thanks.


how to delete records from multiple tables.

  

Hi Friends,Tell me How to delete records from multiple tables by using a single query.


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