Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Delete Row from Grid

Posted on 2013-01-05
4
Medium Priority
?
238 Views
Last Modified: 2013-01-06
Hi,

Pls find the attached image.

I have 2 dropdowns (NewsSector, NewsSectorType). when i select values from these 2 dropdowns and click on Add button, it will add rows to grid.
For each row I have Delete icon(img button), when user click on this button i have to delete row from grid(not from database).
Pls note that on click of this delete button, data should not be deleted from db. only from the grid?

how to do this?

pls find the code below:

protected void RadGridNewsSectorType_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                //pls help me to write code here
            }
        }
grid.jpg
0
Comment
Question by:swathi111
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 20

Expert Comment

by:informaniac
ID: 38746424
Please show us the code you have used to bind the gridview.
0
 

Author Comment

by:swathi111
ID: 38746503
Hi,

Pls find the attached file for code which i used to bind the grid
code.txt
0
 
LVL 20

Expert Comment

by:informaniac
ID: 38746529
Int index=((GridviewRow)sender).RowIndex
RadGridNewsSectorType.Rows.Delete(index);
0
 
LVL 7

Accepted Solution

by:
armchang earned 2000 total points
ID: 38746546
hi swathi111,

This is what I'm using in my projects.

protected void RadGridNewsSectorType_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                int ID = Convert.ToInt32((string)e.CommandArgument);
                dtSectors.Rows[ID].Delete();
                grdDetails.DataSource = dtSectors;
                grdDetails.DataBind();
            }
        }

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question