MVC :: After Deleting The Record Successfully At The End It Is Not Refreshing The Page Properly?
Jun 13, 2010
has someone make ajax.actionlink for delete to work properly.After deleting the record successfully at the end it is not refreshing the page properly.the page refresh is my problem. i have defined the updatetarget id and returning view(model) from my controller but it is returning the master page with it.So the thing is that i am having a page with a page.I have used redirect as well which is not refreshing,
[Code]....
abc is the id of the table From controller
View("ManageGroup,Model);
View 1 Replies
Similar Messages:
Sep 30, 2010
I have a form that when I click the delete button I want it to refresh the grid with that record removed from the grid. Does anyone know how to do this. Is this something handled in the code behind? Here is my code for the delete button on the design page:
[Code]....
View 17 Replies
Nov 27, 2010
I am using a Gridview inside an UpdatePanel. I am using the RowCommand method to call my code to delete the record. The gridview is bound to a <list> collection. I am unable to get the Gridview to postback / refresh after the users deletes a record; however, if I refresh the page in the browser and the page loads, it obviously is gone. I have searched quite a bit on this where others are having problems but nothing they did work for me, so I was hoping someone could review my code and let me know what I am doing wrong.
Here is my ASPX:
[Code]....
Here is my C#
[Code]....
When I step through the code, the postback happens and then my delete code is called, so once the delete code happens, the page is already finished loading, which seems to be my problem.
View 2 Replies
Jun 22, 2010
I am having trouble changing page numbers on my gridview after deleting a record if the deletion of the record causes there to be no more records on that page. Currently I have a form below the gridview that adds a record to the datasource of the gridview.
[Code]....
Code behind stuff:
[Code]....
Now with this code above, if I insert a new record using the form below the gridview, it will reload and go to the new page if the insertion causes the record to appear on a new page, however when I delete that record, thus causing nothing to be on that page, the gridview visually just dissappears. I've got the gridview bound by a linqdatasource control, and on the page_load function I only databind if the page is not a postback.
View 2 Replies
Nov 28, 2010
Trying to check if an insert of a new record into an SQL table is happening successfully. I can see that the insert is occuring OK but am not getting the verification to happen.
I'm a little new to C#, I'm thinking it may be in the syntax I'm using in my method in the .cs file line 45. Can't seem to fix it right though.
[Code]....
[Code]....
View 1 Replies
Jan 18, 2011
I would like to show a modal ui-dialog when a record is successfully saved to the database.
View 8 Replies
Jan 29, 2010
My insert is adding a record to the database in the call to the stored procedure in SQL Server, but a -1 is returned - Shouldn't it return 0 if the insert/update was successful?
Result = myCommand.ExecuteNonQuery();
View 3 Replies
Mar 24, 2010
I've followed a blog here on removing a record. this is what I have. everything works except the page doesn't refresh after delete has been called as if it's doing it in AJAX. I only see the change when i do a manual page refresh. [URL]
Master Page Head section
<head runat="server">
<title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.3.2.js" type="text/javascript"></script>
</head>
Index View:
<% foreach (var item in Model) { %>
<tr>
<d>
<%= Html.ActionLink("Edit", "Edit", new { id = item.LogId })%> |
<%= Html.ActionLink("Details", "Details", new { id=item.LogId })%> |
<a href="/Log/Delete/<%= item.LogId %>" onclick="$.post(this.href); return false;">Delete</a>
</td>
<td>
<%= Html.Encode(item.CampaignId) %>
</td>
Controller:
//DELETE
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Delete(int id)
{
try
{
_repository.Remove(id);
return RedirectToAction("Index");
}
catch
{
return View();
}
}
View 4 Replies
Mar 4, 2010
I have a requirement where a user logs on to a server where exists a website. The user bring up the site on a browser on that server and loads a power point presentation slide. At that time, users using their laptop clicks on the link to that site and sees that particular PPT slide loaded on the server. Then the operator/user on the server clicks on the second slide and the laptop would now see the second slide. Is this possible to do? If yes, then what technology to use? DHTML? or something else.
View 4 Replies
Feb 1, 2011
I am trying to delete a record being displayed in a table on my ManageUser view using a sub-form, thus
<table cellpadding="2" cellspacing="0" border="1" summary="User Grid" style="text-align: left">
<tr style="background-color: #ABC3CB;">
<th align="center">User Name</th>
<th align="center">Approved</th>.....
but instead, it is returning directly to the Admin/ManagerUser view, thus displaying my original set of records again.
View 1 Replies
Mar 14, 2010
I have a dropdown list, and can select names to delete from db table user.
Just want to add a confirmation dialogue window before deleting the record.
I am using a simple function at js to confirm. Isn't that enough to go to btnDelete_click() if true? I am using LINQ to SQL.
I tried:
(code behind)
protected void Page_Load (object
sender, EventArgs e)
{
if(!IsPostBack)
btnDelete.Attributes.Add("onclick","return check();");
}......
View 6 Replies
Jun 4, 2012
I want to confirm from the user before deleting a record. I want to show a message box to confirm operation... How I do that.. I used query to delete a record on button's click event..
View 1 Replies
Dec 12, 2012
I have a web in asp.net+vb code and sql database
Protected Sub movebtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles movebtn.Click
Dim con As New SqlConnection
con.ConnectionString = ConfigurationManager.ConnectionStrings("26ConnectionString").ConnectionString
con.Open()
If persno.Text = "" Then
Page.ClientScript.RegisterStartupScript(Me.GetType, "Forms", "<script> alert('Enter Pers No of Offr ..........') </script>")
[Code] ....
I want to add a confirmation before deleting the data and popup message box...
View 1 Replies
Jan 11, 2013
I am using gridview,in that gridview i provide a link button as delete,if the user click the delete button,it will deleted properly no problem in my code,before delete i want to show an dialog box like, are you want to delete the employee details,,how can i do this in my code..
Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Handles GridView1.RowCommand
If (e.CommandName = "DELETE_Employeeid") Then
'Delete button is clicked
Dim empid = e.CommandArgument.ToString()
[Code] ....
View 1 Replies
Jan 21, 2010
how can i use the refreshing a part of the web-page without all the web-page am using c#.net, it will be great if there is an example to how you can do that also i need to know how can i use the iframe to do that, or a good way to do that
View 5 Replies
Feb 6, 2010
I have a gridview and a SQLDataSource control. In my gridview I have 2 commandfields "Edit" and "Delete"
The "Edit" command field works as expected. Using the "Delete" command field I get the error below.
Server Error in '/DataControls' Application.
The DELETE statement conflicted with the REFERENCE constraint "FK__titleauth__au_id__0CBAE877". The conflict occurred in database "pubs", table "dbo.titleauthor", column 'au_id'. The statement has been terminated.
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: The DELETE statement conflicted with the REFERENCE constraint "FK__titleauth__au_id__0CBAE877". The conflict occurred in database "pubs", table "dbo.titleauthor", column 'au_id'. The statement has been terminated.
Source Error:
[Code]....
Stack Trace:
[Code]....
View 1 Replies
Jul 13, 2010
I have two tables with one common field. The field is the primary key in one table, and just a plain field in another. When I delete a record in the table where the common field is the primary key, I want to automaticaly delete a record in the other table that has the same data in the common field.
What is the most effecient method of doign this..triggers?
View 4 Replies
Aug 5, 2010
I have a scenario in which the user can add a new option to appear in the list of available choices in a DDL contained in a detailsview when they select an option <Add New>. This displays an AJAX model popup which then allows the user to enter the new option text. Then they hit an Insert button which inserts that new option into the DDL's datasource and I call ddl.DataBind. Subsequently I want to close the modal popup and then display the newly created DDL option as selected.
When I step through the code, everything appears to be working as expected...i.e. the DDL's datasource now has 1 more record than before and the ddl.SelectedValue is the newly created record for its datasource. I can also query ddl.items(99) and see the new option is part of the ddl's items collection and the new record is Selected.
HOWEVER, once the screen comes back from the debugger, the DDL is now showing the newly created option, but still the prior selected option of "<Add New>". And if you pull the DDL down the newly created option is not in the list?
I cannot figure out how that happens...though I suspect it has something to do with the AJAX/Update panel. Here's some code:
[Code]....
[Code]....
[Code]....
[Code]....
[Code]....
[Code]....
View 1 Replies
May 11, 2010
I've been googling for 2 days for the solution, but I couldn't find something useful. The problem is that I have GridView that is connected to the SQL database and that is how it is being populated. I added EDIT and DELETE buttons in the columns, but as far as I can see the event which handles them is empty.
[Code]....
View 11 Replies
Apr 20, 2010
how can i retrieve the all foreign keys against a single primary key. i mean to say that if a table contain a primary key then it becomes as foreign keys in which tables.
i want to take that nam of that tables and on the base of that tables then i am to delete from all the entries. e.g: if a primary key's column entry deleted then all foreing key entries should also be deleted.
there are 988 tables in a single database. it can't be possible to go for each table to setup foreign key to ON DELETE CASCADE.
.can it have any way to delete against foreign key priority wise? mean to say that parent table contain primary key, child table contain foreign key , now there is another child table which dependent previous child table. then how can i delete all record against it?
i want to do it from programatically. i am using sql server 2005
i have completed this till to that , it retrieves all foreign keys but how to delete now on the base of priority.
[Code]....
View 1 Replies
Jul 11, 2010
I am working on a Webbased project, where we have a Master page with some child page. In the child page there is GridView control, Footer of this Gridview control have some TextBox control to get the input value from user and insert into database. Once the data is inserted into database. We are reloading the inserted data into the same Gridview control, But Gridview control is hot Binding/showing up the recently added record.
I debugged the code and seen the Dataset which is getting the data fron database have the updated row but after binding to Gridview control. The Gridview control not refreshing the data. This is happening while we have Master page and child page.
View 7 Replies
Apr 22, 2010
Using vb.net/asp.net 2005.I have an inner gridview.The outer gridview is "Authors" and in the inner gridview (GridView1 below) I have to set it up so that the user cannot delete the last book from the inner grid, if they try to delete the last book from that inner grid then I want to show the exception message below.
So I am checking the GridViewRows1.Rows.Count which works great when I have one record (one book) to start with. The problem is when I have 2 books (for example). I am writing out the test statement below and the RowCount is always 2 each time, never decremented, even after I rebind.Editing this now: i realize that my initial logic is faulty because when I rebind my inner gridview I am not specifying which inner gridview so the result is that only the last inner gridview is being re-bound, so I think that I need to get the selected inner gridview and then refresh that...
[Code]....
View 1 Replies
Feb 8, 2010
I have a DataGrid that I need to be able to use to delete records form a file
[Code]....
[Code]....
I use
((TextBox)GridMenuOptions.Rows[e.RowIndex].Cells[1].Controls[0]).Text;
To access the data in the Grid for updating, but it doesn't work for deleting
I can use
string id = GridMenuOptions.DataKeys[e.RowIndex].Value.ToString();
but that only returns the first key.
How do I access the rest of the keys?
View 9 Replies
Oct 19, 2010
I have a bound data field, a detailsview, one of the records I have formatted to currency in the item template. Yet when I go to delete a record, I get a error message "Input string was not in correct format". Take away the formatting and the page runs fine. I tried changing the datatype from int to money, it makes no difference.
View 3 Replies
Nov 16, 2010
I am using paging to my gridview (pagesize=4) . now i am in (X) page and i want to get (X+1) page top record or (X-1)page bottom record , how i can get .
View 2 Replies