Select a Row in DataGrid and Delete this Row

My goal is to put the Rows from one (left) GridView into the secend (right) GridVIew.

For this I would like to use Drag and Drop becauce this would do just that but I can find only D&D features in e.g. Dojo. Is it possible in ASP.NET, too?

Because I didn't find the D&D solution for ASP.NET I created two GridViews with a SELECT Label for choosing a Row. Then I chosen the SelectedIndexChanged event but when I want to delete the selected row then an error occurs that this isn't possible. Does anyone knows how I can solve my problem? Thank you!

0
baer999
2/20/2009 10:36:01 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

3 Replies
799 Views

Similar Articles

[PageSpeed] 21

 Hello!!

Plz see following link.

http://codeasp.net/blogs/vinay_jss/microsoft.net/67/gridview-row-edit-delete-update-and-paging 


Sincerely,
Vinay Kumar Gupta

Code Review Service || Join now: CodeASP.NET Community || Recent Blogs postings || new forum

Please mark the most helpful reply/replies as "Answer".
0
vinay_jss
2/21/2009 3:41:17 AM

 Hello,

On selectedindex changed of left gridview remove the selected row form your data set which is assiged as data source to left grid and rebind it again.

same way add the row in data set which is assigned as data source to right grid and rebind it again.


Thanks,
Kalpana Patel

Remember to click “Mark as Answer” on the post, if it helps you.
0
kyuti
2/21/2009 3:55:32 AM

At the moment I do this:

 

 

    protected void viewAllPersons_SelectedIndexChanged(object sender, EventArgs e)
    {
        dtSelectedPersons.Rows.Add(dtAllPersons.Rows.Find(viewAllPersons.SelectedValue.ToString()).ItemArray);

        viewAllPersons.SelectedRow.Visible = false;

        viewAllPersons.DataSource = dtAllPersons;
        viewAllPersons.DataBind();

        viewSelectedPersons.DataSource = dtSelectedPersons;
        viewSelectedPersons.DataBind();
    }
0
baer999
2/21/2009 12:28:46 PM
Reply:

Similar Artilces:

How to delete Datagrid row if that row is not selected
Hi, I faced a problem. I have a simple datagrid. It allows user to select a particular row of data say row 5. It works completely fine but if user wants to delete row 7 when row 5 is selected, the datagrid will delete 5 (which is the selected row) instead of 7. How to go about this issue? Thanks! Regards, FrancisSGDOTNET.ORG Can't you just select row 7 and delete it?Thanks!Bernie At first, DataGrid deletes nothing. It sends out only commands that your code has to handle. You have to use DeleteCommand event of datagrid. In this event you have to take the row index from event...

Datagrid Sort,Select Row, Delete Row etc
Is there a way or technology where we can select a data grid row and delete it or update it without the use of javascript or call another page based on the selected row of datagrid? I donot want to do postback to the server, and would like to avoid javascript code on the client side.     abdulbq: Is there a way or technology where we can select a data grid row and delete it or update it without the use of javascript or call another page based on the selected row of datagrid? I donot want to do postback to the server, and would like to avoid javascript code on the client si...

How to set the row number and get the row number for ("selected row) in Datagrid
I face a problem that i can't get the selected row of the datagrid in both server side script (VB.net) and client side script (javascript) As i can't use the button column / hyperlink column in the datagrid. Thus , i need to handle the change the background color of the selected row and also to get the selected row number for Update/Delete. Thanks in advance. This depends on how do you perform the selection. Do you want to implement chaning of the SelectedRow at the client side without any postback? If you have no issues with postback, then you can do s little trick here: 1. ...

I want to select top 3 rows except the first from 4 rows of a Table. It should select from top 2 row,top3 row and top4 row.
 Hi, Let say I've 4 rows in a table. I want to select top 3 rows except the first from 4 rows of a Table. It should select from top 2 row,top3 row and top4 row. Thanks in advance Asghar Ali Mohammed http://www.aliwebdev.com(Web Designer and Developer)Do not forget to "MARK AS ANSWER" on the post that helped you. If you can use Linq, you can use Skip. http://msdn.microsoft.com/en-us/vcsharp/aa336757.aspxThanks, EdMicrosoft MVP - ASP/ASP.NET Hii dear..U can fire the Query select Top(3) from Table1 order by id desc.. "A conclusion is whe...

select the row of the datagrid whose value is same as one of the value of row of datagrid
hellow all,  I have a datagrid which is bound to the ordertable,so all the orderdetails are shown on the page load. but my requirement is that,i have a textbox and a search button,when the user enter the order number in the text box and click on the search button the datagrid should show that record whose order number is entered by the user n most imp that the record may be in the 65th or 34th row of the datagrid,i wants to put it in the first row. how to do it. If there's a reason you can't filter down to just the one row, you'll have to come up with some paging algorithm that wil...

Selecting a Datagrid row by clicking the row
Hello I am trying to configure my Datagrid so that I can click anywhere on the row and it will invoke the OnItemCommand event and run the associated subroutine. To do this I have created a datagrid with the following: <asp:DataGrid id="dgrdTSOverview_Approved" AutoGenerateColumns="False" OnItemDataBound="Mouseover_Hover" DataKeyField="Timesheet_id" OnItemCommand="dgrdTSOverview_Approved_ItemCommand" ShowHeader="true" BorderWidth="0" CellPadding="2" CssClass="datagri...

Datagrid Row Row/cell selection
I have a data grid that is displaying the results of a query to a database. It has 4 columns (say appID, FAQID, FAQ, Source). I have created the FAQ column as a TemplateColumn and set it as a LinkButton as I want a new page of the application to load when a user clicks on the FAQ. The new page is to display to complete solution to the FAQ. Is there any way that I can retrieve the value from the FAQID column that relates to the clicked FAQ so that I can pass this to the new usercontrol? Regards, Wallace You could certainly do this. Since you have the FAQID in the one of the ce...

update: how to delete a row only if the row is selected first
i have tried everything to get past this error and im finding it hard to delete a row from my database, can any1 help? code so far - delete with confirmation:   <asp:GridView ID="GridView1" runat="server" AllowPaging="True" CellPadding="4" ForeColor="#333333" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" DataKeyNames="fileID" OnRowCommand="GridView1_RowCommand" OnRowDataBound="GridView1_RowDataBound" OnRowDeleting...

Gridview paging enabled. Has checkbox to select the row . If user select the checkbox on one page and move to 2nd page to select the rows there also to export the selected rows to excel. But doing so
HiI am using Gridview and that has paging enabled. Using checkbox to select the particular row of the gridview to export the selected rows to the excel . Everything is working fine except for one case.Let user selected the "check" box for, five rows which user would like to export to excel (two of rows on page 1 of results and 3 of them on page 2 of results), however it only exports the 3 row details from page 2, because it seems to de-select the 2 rows from page 1 when I move to page 2 and vice versa. The code i am using is as :protected void BtnExcel_Click(object sender, EventArg...

How to get the row index of a selected row in listview control
Can someone please tell me how to get the index of a selected row in a listview.  <ItemTemplate> <asp:LinkButton runat="server" class="linkButton" id="xxxxx" Text='<%#Eval("documenttype") %>' CommandName="OpenFile" CommandArgument='<%#Eval("DocumentKey") %>'></asp:LinkButton></ItemTemplate>what you have to do is, in itemcommand event of ListView, you have to get the value of row indexif(e.CommandName == "corrospondingcommaandname"){     &nb...

how to select a row in datagrid and return primary key of that row?
any body? i am suck! =( pls help!! b General rule is to assign a primary column to DataKeysField attribute of the grid and then use GridItem.DataKeys(Index) to extract the valueBug [MCSD] so would that be under the SUB of GridItem_EditCommand? or Griditem_SelectedIndexChanged?? i just don't get it.. so stuck! =( b Does not matter. You can use that logic in any grid events as: dim intID=CInt(DataGrid1.DataKeys(e.Item.ItemIndex)) Bug [MCSD]...

hw to delete a row in datagrid using row index?
hi i ve written code like thisLabel rangeId = (Label)e.Item.FindControl("lblRangeId");//deleting the rows near rangeid.DataSet dsDeleteRange = SqlHelper.ExecuteDataset(trans, CommandType.Text,"Delete tPrintServiceRange where RangeId=" + rangeId.Text);lblMessage.Text = "Data Deleted Sucessfully.";lblMessage.ForeColor = System.Drawing.Color.Green;trans.Commit();BindRange();here i need to avoid bindrange(); to get the fresh data from the database and need to delete the row in datagrid which i deleted in database.is it possible to avoid the bind...

DataGrid Selected Row Moves To Top Row of Grid????
Hello all, I have a data grid with a link Button column Built in Property Builder (coding in C#). Problem: When a link button is clicked, the row that was selected moves to the top row of the data grid. I need to find a way to simply keep the row where it is and highlight it. I've tried to set the back color of the selectedItem in the Format section of the property builder but nothing happens. If I use a select button highlighting the row as mentioned above works fine but i need to use a link button. If I code the click event of a select button column to response.redirect(&q...

Add new controls to a gridview row; when editing that row using the edit row feature in the gridview control.
Hi all  I have a questions that looks hard / complex to me, and i know you can help me in this. Q {  I have row in a Gridview and i have an edit option to it. I press the edit button, to edit the values in that row and update data all the way back to the database. Now when i press the edit button, i want a drop down list to be displayed that contain values for a particular field in my grid view. (for now only plain text boxes appear.) } I hope you understand my question, all i need to do is replace the text box controls with a dropdown list when i am editing a row in ...

Web resources about - Select a Row in DataGrid and Delete this Row - asp.net.presentation-controls

Want to preview our new DataGrid for Xamarin.Forms?
tl;dr Zumero.DataGrid is a Xamarin.Forms control for displaying data in rows and columns. If you would be interested in testing and previewing ...

Mad King DataGrid
This post is about scrolling in WPF and the egocentric DataGrid control. I’ll give the project background but if all you’re interested in is ...

Stack Overflow
Stack Exchange log in - careers - chat - meta - about - faq Questions Tags Users Badges Unanswered Ask Question Top Questions interesting 295 ...

Microsoft Silverlight - Wikipedia, the free encyclopedia
Microsoft Silverlight is an application framework for writing and running rich Internet applications , with features and purposes similar to ...

Flash Builder Plug-in for SAP Netweaver Gateway - Adobe Labs
Search Navigation Labs Home Wiki Home Technologies Alchemy Blueprint Camera Profiles and DNG Profile Editor Cirrus ColdFusion 10 DNG Codec Fireworks ...

Casaba Security » Products » X5s Testing Tool For Finding XSS Vulnerabilities
Security analysis, consulting, development and testing partners who understand your business strategy.

CodeGuru - Microsoft developers related ideas, articles, tips, tricks, comments, downloads, and so much ...
CodeGuru is where developers can come to share ideas, articles, questions, answers, tips, tricks, comments, downloads, and so much more related ...

Caliburn Micro: WPF, Silverlight, WP7 and WinRT/Metro made easy.
A small, yet powerful framework designed for WPF, Silverlight and WP7. It implements a variety of UI patterns for solving real-world problems. ...

Quick Answers - CodeProject
Questions - Free source code and tutorials for Software developers and Architects.; Updated: 11 Jul 2012

license-discuss@opensource.org: 11636: first draft of license proliferation committee report
FYI,the first draft report of the OSI's License Proliferation Committee.To join the OSI's license proliferation discuss email list, send anemail ...

Resources last updated: 1/1/2016 8:57:42 AM