Gridview refresh after edit?

this one is cracking my brain.I have a gridview and a formview on one page.When a row of the gridview is selected, the details will load in the formview.When i edit the details (f.e. change a name) in that formview and save them, the gridview will just show the old data (=old name).

I have to reload/F5 the page to see the changes in the gridview.
Why isn't the GV updated when i do a databind() in the onclick-event of the update-button in the edittemplate of the formview?

More Related Resource Links

In this article I am presenting a different way to look at EditItemTemplate, using which user navigation for editing is reduced and . it looks very different (see screeen shots) then regular implementation of GridView.

The ASP.NET GridView allows for a row of data to be edited by setting the EditIndex property of the GridView, placing the entire row in edit mode.

You may not want the entire row in edit mode if you are using DropDownList controls for several columns in the EditItemTemplate. If each DropDownList has many options then loading them all at once may result in a sluggish page. Also, if your data structure is more like a 2 dimensional array rather than a set of rows, you may want to edit each cell individually.

Here I will demonstrate how to achieve this and also how to deal with event validation without disabling it.

In ASP.Net 2.0, GridView Control also provides the functionality to edit and update the data retrieved from the database using CommandField template. You can cancel the action using Cancel Command of the CommandField. GridView consists of events that can be used to perform the actions like edit, update and cancel upon the Data items displayed in the ASP.Net GridView Data Control.

The ASP.NET GridView allows for a row of data to be edited by setting the EditIndex property of the GridView, placing the entire row in edit mode.

You may not want the entire row in edit mode if you are using DropDownList controls for several columns in the EditItemTemplate. If each DropDownList has many options, then loading them all at once may result in a sluggish page. Also, if your data structure is more like a 2 dimensional array rather than a set of rows, you may want to edit each cell individually.

There are many ways in which you could modify modular data in Grid View:1. Inline by making rows editable when u click on Edit2. By using separate pages for Edit3. By using popups/dialogs for adding/editing

My project includes a grid view which displays information of inventory items (Assets), data is quried from AssetTable. The GridView has a command field to allow editing, below is a description of the tables and how data is displayed

Tables

BuildingTable: (BuildingID, BuildingName)

AssetTable: (BuildingID,..,....,....)

ItemTemplate: Using a LINQ query I join the two table and displays in a label control a string which includes BuildingID and BuildingName (5 North Building)

EditItemTemplate: Using a LINQ query I populate a DropDownList with strings of BuildingID and BuildingName same as above.

Here issue which I need to resolve:

1. ItemTemplate display the correct information (BuildingID BuildingName) but when I switch to EditItemTemplate the pair that is

displayed is the first one on the list, how do I make is scroll to the item which was displayed in the label ?

Thousandas operation we can do on Gridview control. Here I as explaining how we can add new recored and edit of existing record and delete a record in Gridview. Step1 : You can add this gridview in your aspx form. Here some events of Gridview are fired

I have a gridview that I can't for the life of me get the datepicker calender to pop up for. I've been using the datepicker for months very successfully for a variety of textboxes on the page and inside of formviews but this is the first time I've tried using with gridview. I didn't expect any issues however can't seem to find anything to work. I have searched the forums for 2 days and attempted any suggestions found within the solutions to no avail. I've tried using the CSS to link the datepicker but everything stopped working when I changed the code and my page which uses a css style already got all distorted looking. Please help!

Here is my gridview (only included a part b/c it is large and am only having problem with the datepicker for the date completed text box)

Hi there, I am not sure this can be done, and if not I am looking for an alternative. Before I start I am using VB.Net and ASP.Net.What I would like to do, is when the edit button is pressed on a Gridview row, I want the TextBox under the ClockOut column, to automatically have the selected value of a dropdown list at the top of the page. Basically so a list of users times will come up in the grid view, and as a fast way to insert a clock out time, the user will have to change the drop down list at the top of the ASP.Net page to the clock out time they want, then when pressing Edit on the row, the time from the Dropdown list will be in the ClockOut textbox, and pressing update will post this. Any help will be great! Thanks, Hope it can be done.

Hi everyone. I have problem with the buttons Edit and Delete in Gridview for very long time and i really need help about it. So i have gridview and sqldatasource. First i try to make this buttons manually and as you will see in sqldatasource 5 and 6 i have these buttons my records show up but the buttons not working. After that i was advised to do it automatically with gridview smart tag options and Generate columns - this is what i did in sqldatasource7 and gridview7. But both ways i need to change the statements with my own because that what they create not works. So select statement works. Now the error that i get in both ways is the same:The GridView 'GridView(the number could be 5,6 or 7)' fired event RowEditing which wasn't handled.See how looks my page:Now here's my code in aspx:<%@ Page Language="C#" Title="Specific Search in Phone Directory" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="serv

Hello,
I have a gridview control. When it goes into Edit mode, there are 3 dropdownlists in one cell that are populated by separate stored procedures during the RowDataBound event. The 1st dropdownlist's value is used as a parameter to determine what the 2nd dropdownlist is populated with. The 2nd dropdownlist's value is used as a parameter to determine what the 3rd dropdownlist is populated with. Everything works fine when the row is first put into Edit mode.
While I'm in Edit mode and I change the selection in the 1st dropdownlist, how do I access the control so I can feed this new parameter to the 2nd dropdownlist? I have the first 2 dropdownlists set for AutoPostBack so that the Page_Load event is fired when the user changes a value. I know how to get access to these controls via the FindControl method when the row is being databound but how do I find the control during the Page_Load event?
Thanks for any help!!!
Penny

Here's my problem:
Different agencies are submitting projects to us, but I only want them to be able to edit their specific project (in addition, when they submit a project, they can only submit on behalf of their agency - but that may be a separate issue).
Anyway, I can use the codebehind to show/hide the edit/delete/details buttons based on whether or not the user is authenticated using the following simple code in the Page_Init event:
If User.Identity.IsAuthenticated Then
GridView1.Columns(0).Visible = True
Else
GridView1.Columns(0).Visible = False
End If
To get what I want, though, I need to check each row (RowDataBound Event?). The "SponsoringAgency" field will need to be validated against the user's credentials, and then the Edit button will be visible/invisible based on the result.
Here's what I don't know how to do:
1. When the user registers, have an additional field that asks and stores their agency information.
2. I can't quite figure out how to get the SponsoringAgency value from the gridview. I've tried a few tests using:
If e.Row.Cells(11).Text = "AgencyA" Then
e.Row.Cells(11).Text = "TEST"
End If
This does not work - the text isn't changed. One of the possible problems is that I'm not sure I'm getting the right column in my grid