Data Controls :: GridView Last Row Delete Button Disable Functionality Not Working For Edit Button
May 7, 2015
In one of my Web Page, there is one Modal Pop up, in which I am using Gridview Edit, Update, CancelEdit, Delete functionality.Main functionality is : If while deleting any of the Gridview Row, if only 1 row remains in Gridview (that row can be any row), then that row should not get deleted.Rest of Edit, Update, CancelEdit functionally is working fine.
I used below code for above:
 C#:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindGrid();
[Code]....
problem is: When any last row is left in Gridview, its Delete button is disables that time (as per requirement and functionality). But when user clicks on Gridview "Edit" button, update section opens, and at that time "Delete" button gets Enabled, so that time user can delete the last row of Gridview which should not be done.I had fixed this problem for "Cancel" and "Update" button of Gridview using below line:
Response.Redirect(Request.Url.AbsoluteUri); but unable to fix it for "Edit" button of Gridview. If Last row is left in Gridview , and user clicks on Gridview "Edit" button of that row, then at that time "Delete" button should not get "enabled" it should remain "disabled"
View 1 Replies
Similar Messages:
Feb 15, 2010
[Code]....
I need the button1 to be disabled till user check any ckeck boxand become enable with any chec
View 6 Replies
Mar 28, 2011
I have a progam that need to use button to edit and delete in GridView.i put the edit button to ItemTemplate, update and cancel button in EditTemplatebut i don't know how to bind the method in the button click.his following are my html code:
<asp:GridView ID="gvDesc" runat="server" AllowPaging="True" AutoGenerateColumns="False"
Height="192px" Width="496px" DataKeyNames="TechCodeID" PageSize="5" CellPadding="4" ForeColor="White" GridLines="None" BackColor="White" CssClass="GridView">
<Columns>
[code]...
View 5 Replies
Jan 13, 2010
I have been trying to get a Gridview of a list of usernames and passwords for site login that the Edit button would be disabled if one of the columns had a certain word in it?
For now, I need the Edit button to be disabled if the Username for a record is "admin". Is there a way to do this? My current code is here:
[Code]....
View 15 Replies
Aug 3, 2013
Suppose the Gridview on the page is for showing the detail records of the Header master record on the same page. How to disable the "Edit" within the Gridview? I would like to disable the "choose" in the Popup of the Gridview and also to disable any buttons of that.
View 1 Replies
May 7, 2015
I have a gridview with Edit and delete lini on it. I want to change the text of "delete".
I don't want to use link button because I have already implemented the code and its working fine. I just want to rename the "delete" text on grid view.
View 1 Replies
Aug 9, 2010
I need to check for two differect text to make the Edit button inactive. For example, I need to make the button inactive when the ActionTypeName field has value either Accepted date or Received date. I can do one check with Accepted date but not both.
View 1 Replies
May 6, 2010
I would like to implement code to delete the selected row in the gridivew using Radiobutton .
View 11 Replies
Jan 24, 2016
I have a record in gridview contains string with special character like single quotes( ' ) etc..I've a edit button in gridview when i click on edit button of any record of Gridview then corresponding record shown to text box.
But on that time single quote looks like below ....
Before edit button click string in gridview cell, a testimonial or show consists of a person's written or spoken statement
After edit button click string in textbox, a testimonial or show consists of a person's written or spoken statement but when I click update button shows following error :
"A potentially dangerous Request.Form value was detected from the client (ctl00$ContentPlaceHolder1$tb_comment="...f a person's written or sp...")"
What is the solution so that single quote shows as it original format as it looks in gridview cell when i click on edit button.
View 1 Replies
Feb 9, 2011
how to enable the delete button only if the user have modify the data in a gridview
[code]....
View 3 Replies
Apr 16, 2010
I have a very complex page with 11 formviews, 1 dropdownlist, and 11 sqlDataSources.I have several issues
Page: This page controls my website users and their info. There are 2 different users with 3 different permissions; users - 1 Primary(account Creator), and the rest; Permissions - View, Edit(Manage), Create/Delete(Author)
Each Formview controls one column in the table.
1st. After Permissions are read, the add, delete buttons are to be disabled if no permission. If the User selected is the PrimaryUser the delete button is disabled. On Page load, the delete button is enabled even though the displayed user is the Primary, when you select another user, then select the primary again, the delete button is disabled, but when you select another user the delete button is still disabled. This should not be!
2nd. I then added a check to see if there was one or more locations, and if there is only one, then disable the edit button that allows a user to assign a user to a specific location. example: if there are 3 locations, you may assign a user to that office location, but if there is only one location, there is no need. I try to disable the edit button in formview, but I get "object reference not set to instance" which is total cr#$ because the button is there in the form.
3rd. When a page loads and all of your sqlDataSources have a Select controlParameter that is determined by a DropDownList, how is the initial record determined other than it is the first record?No matter how I work my code, these issues do not work, and it is very frustrating and holding my project back. I have been working on thes for a week.
[Code]....
View 2 Replies
Sep 4, 2010
I have problem with the buttons Edit and Delete in Gridview for very long time and i really need about it. So the when i click edit i get in edit mode and when click update the values in the row i was changing disappear but only in the gridview. When check in the Database nothing happens. The delete button not works at all, i mean when click on it only refresh the table.
See how looks my page:
Now here's my code in aspx:
[Code]....
Now here's my code in cs:
[Code]....
I'm not sure if the statements not working. P.S. the cancel button works fine.
View 25 Replies
Feb 11, 2011
I've a listview in which i'm binding data from objectdata source. I have a requirement where i've to allow edit/delete for only certail listviewitem which meets specific requirement. How do i dynamically set that some item can be only be edited not deleted thus only edit button/link should appear and vice-versa.
View 2 Replies
Apr 6, 2010
I am using Sharepoint Designer and trying to insert a Delete button into a gridview. I added this to the top of my ASPX:
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
Assembly="Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" %>
and I added this as a Gridview column:
<SharePoint:DeleteItemButton
runat="server"
ID="CustomFormDeleteItemButton"
ControlMode="Edit"
/>
and this is the error I get:
An error occurred during the processing of . System.Web.UI.WebControls.DataControlFieldCollection must have items of type 'System.Web.UI.WebControls.DataControlField'. 'SharePoint:DeleteItemButton' is of type 'Microsoft.SharePoint.WebControls.DeleteItemButton'.
View 4 Replies
Nov 5, 2010
Edit and Delete functionality works flawlessly in Gridview if all data is pulled ONLY FROM ONE TABLE. But pulling data from one table give you ID's instead of actual values that are stored in other tables.
After creating a usable Select statement that would pull all the correct values, my Edit and Delete functionality no longer work.
Here is code.
[Code]....
View 2 Replies
Mar 20, 2010
how to disable functionality of refresh (logo or button) in browser
View 2 Replies
Jun 28, 2013
I've created an exact copy of this tutorial (vb) [URL] ....
However the delete click is not firing at all - I've removed the click confirmation too but the DeleteCustomers sub just isn't getting called. It compiles & runs fine with the edit/update actions.
View 1 Replies
Dec 30, 2010
How can one disable a Link Button in gridview. In gridview, I had defined linkbutton as :
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkbtndownload" runat="server" CssClass="Links" CommandName="DownloadPdf" CommandArgument='<%#Eval("Client_ID")%>'>Download</asp:LinkButton></td>
</ItemTemplate>
</asp:TemplateField>
View 2 Replies
Mar 9, 2010
Using my own button I would add a little bit of script to the onclick asking if the user wants to delete or not.How can I do this with the grid view?given that this is the button...
<asp:CommandField
ButtonType="Button"
ShowEditButton="True"
/>
How do I call the script?
View 5 Replies
Jan 28, 2011
I was trying add a custom delete button image to a gridview's commandfield, like:
<asp:CommandField
buttonType="Image"
DeleteImageUrl="~/manager/images/Delete.gif"
ShowDeleteButton="true"
/>
The delete event does not seem to fire with this code, however, and after googling a bit
View 3 Replies
Oct 17, 2010
s it possible to only display a delete button within gridView if a db field (processed) = 'n'
View 3 Replies
Mar 17, 2011
im tryin to delete row from gridview without success. Im build the gridview using autogeneratecolumns=true and i get the name of the SQL table from the queryString using stored procedures the code is:
[Code]....
and the stored procedure:
[Code]....
How can i add delete button to delete rows from the gridview?
View 23 Replies
Dec 21, 2010
I built a simple application that is used to manage photos for an image gallery on my employer's website. A user can add, edit, or delete items which are stored in an XML file. I've set up Up/Down buttons so that I can move pictures up and down in the order.On the first page, I've disabled the Up button of the first item on the RowDataBound event... since it's already first
[Code]....
I'm trying to do the same for the Down button on the last item of the last
[Code]...
View 5 Replies
May 7, 2015
I want a solution for checkbox Check changed.in my gridview when i check on any row it hits check changed event and i have made a button visible if atleast one checkbox is checked.(But when i uncheck i want the button to get hidden if no row is selected).
View 1 Replies
Aug 10, 2012
I have Link Button to Export to excel in Master page. Since I have placed it in master page I can see Export link button in every page. I need to disable link button where gridview is not present in a page.
IÂ thing using Enabled property we can do. How to proceed. Is there any other way to do it.
<asp:LinkButton ID="LinkButtonExport" Text="Export to Excel" runat="server" OnClick="LinkButtonExport_Click" />
View 1 Replies