473,789 Members | 2,860 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Grid View Delete

I have the followning code in my HTML part. But when I click on Deletw
link it deleted the record from gridview as well as from Datasource
but it give me following error page
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.NotSuppo rtedException: Updating is not
supported by ObjectDataSourc e 'ObjectDataSour ce1' unless the
deleteMethod is specified.


Here Is the code

DataKeyNames="U serId" DataSourceID="O bjectDataSource 1"
OnRowCommand="g dAddUser_RowCom mand"
OnRowDataBound= "gdAddUser_RowD ataBound"
OnRowDeleting=" gdAddUser_RowDe leting"
Width="390px"
önSelectedIndex Changed="gdAddU ser_SelectedInd exChanged"
AutoGenerateEdi tButton="True">

CommandArgument ='<%# Eval("UserId") %>'
CommandName ="Delete">
Delete

protected void gdAddUser_RowDa taBound(object sender,
GridViewRowEven tArgs e)
{
if (e.Row.RowType == DataControlRowT ype.DataRow)
{
LinkButton l = (LinkButton)e.R ow.FindControl( "LinkButton 1");
l.Attributes.Ad d("onclick", "javascript:ret urn " +
"confirm('A re you sure you want to delete this record " +
DataBinder.Eval (e.Row.DataItem , "UserId") + "')");
}

}
protected void gdAddUser_RowCo mmand(object sender,
GridViewCommand EventArgs e)
{
if (e.CommandName == "Delete")
{
// get the categoryID of the clicked row
int AppId = Convert.ToInt32 (e.CommandArgum ent);
// Delete the record
DeleteRecordByI D(AppId);
// Implement this on your own
}

}
//protected void gdAddUser_RowDe leted(object sender,
GridViewDeleted EventArgs e)

//}
protected void gdAddUser_RowDe leting(object sender,
GridViewDeleteE ventArgs e)
{
int AppId = (int)gdAddUser. DataKeys[e.RowIndex].Value;
DeleteRecordByI D(AppId);//implement yourself
}

Apr 18 '07 #1
0 1617

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1964
by: pmud | last post by:
Hi, I have 4 columns in my sql database table. I added a data adapter , data set & a data grid to view this information. But the data grid is displaying those 4 columns TWICE , i.e in the data grid i see 8 columns. In case this is useful, the primary key is Serial no. which is an identity ....i.e everytime a row is added to the database, it increments by1. Also, when i configured the data adapter, it couldnt Generate the UPDATE &...
1
1801
by: Shiva | last post by:
Hi, My (main)form has a subform that contains the details of the mainform. The default view of the mainform is 'single form', the default view of the subform containing the details is 'Datasheet' - Datasheet displays the data of the associated table as a grid. I want both the mainform (the master) and the subform to be displayed as grid. But after changing the default view of the mainform to 'datasheet', the subform disappears...
3
3013
by: NewBie | last post by:
i have created a datatable and bind it to my datagrid1 to how can i delete rows by content for exampl i have 3 column test1 test2 test3 with a number of rows, lets say 5 in one of these cells of column TEST2 there is a value of "BET" in it How can i find it and delete that row Thanks
6
1486
by: Paul | last post by:
Hi I have 2 data grids and several controls on a web page. The grids will vary in size, just wondering if the lower grid could be covered by part of the upper grid depending on its size or is there a way to dynamically shift the lower grid so it appears just below the upper grid? Thanks. -- Paul G Software engineer.
0
2079
by: ¿ Mahesh Kumar | last post by:
I have created a XML file as datasource which i 'm binding to a grid view control. During runtime I'm capturing items in XML file and displaying in a GRID VIEW control. but i want to remove or flush the XML file content on page load. I tried parentnode.removeall () but no use.. (1) how to clean/delete the XML file nodes on page load for using as DATA SOURCE which again i'm binding to Grid view..?? (2) and also on page refresh my gird...
0
2396
by: weiwei | last post by:
Hi; I am having trouble to get variable from grid view. here is my scenario. I want to delete a row in database from web page, in additon, I also want to delete that user's directory in c:drive. so far, I can only finished the first part which is to delete the row from database, Please see below code where I want to get variable in order to delete the directory. Thanks in advance <%@ Page Language="VB" Debug="true" %> <script...
3
1916
by: Andrew Robinson | last post by:
I have a Grid View and associated Object Data Source control. The ODS interface with a custom data source that returns a List<MyEntity>. I am only referencing some of the columns on the GridView. When editing a row within the Grid View, the columns that are not referenced, are being set to null. Is this by design or am I missing something else somewhere?
1
2671
by: 67237 | last post by:
i just want to know how to delete a row from a grid view since the data is been retrieved as the data table to the grid view so by clicking delete button the row should delete please do help me to solve this problem and also same for the data grid also.
1
1271
by: Max2006 | last post by:
Hi, We need to develop a user control that extend GridView to be able to view/edit database tables. The components should have parameters for TableName and ConnectionString, then shows the records and allow users edit, delete or update records. The name of table will be define at runtime (as opposed to compile time)
4
1520
by: universe | last post by:
I am developing a website(File system), in that I am using a grid view control. In the code behind file, I am using gridview control's rowDeleting event. When the user clicks delete button , I am displaying a messagebox asking whether to delete or not. When I am running from source it works fine. But after publishing my website, from the published pages, when I click the delete button, I am getting the following error. "showing a model...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10410
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9984
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.