.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Gridview update event not firing

Posted By:      Posted Date: October 06, 2010    Points: 0   Category :ASP.Net

Everything is working fine on my gridview except the Update.  When I click on the Update link, nothing happens.  I've researched the problem and tried various solutions I've seen, but no luck.  I'm hoping someone else can see something that I'm missing. 

<asp:GridView ID="grdAddInsured" runat="server" DataSourceID="dsUnitAdditionalInsured" DataKeyNames="AddInsuredID"

AutoGenerateColumns="False" ShowFooter="True" Width="

View Complete Post

More Related Resource Links

ASP.Net Gridview Edit Update Cancel Commands

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.

How to format and update GridView and DataGrid rows using JQuery

The behavior described in this question is as expected. When you set text of a cell in grid, it directly affects HTML that is going to be rendered. When you set text value of a cell, it means that you are setting innerText of the cell. The column that GridView creates for command fields (Edit, Delete and Select) are a (anchor) or button elements. So you can see what will happen if you set text value in that cell. It will wipe out those link or button controls and replace them with simple text string.

Add, Edit, update, Delete gridview

The article Add, Edit, update, Delete gridview was added by anjankant on Friday, July 09, 2010.

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

determine the best way to refresh a gridview when textchanged event occurs


Good afternoon.

I have the following gridview inside an updatepanel that makes the bind from a datatable:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <asp:Button ID="ButtonAdd" runat="server" OnClick="ButtonAdd_Click" Text="Novo Artigo" />
                <asp:GridView ID="Dados" runat="server" AutoGenerateColumns="False" 
                    CssClass="Grid" Width="100%" CellPadding="4" ForeColor="#333333" 
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        <asp:Button ID="AbrirModal" runat="server" Text="->" /> 
                                <asp:PopupControlExtender ID="PopupControlExtender1" runat="server"

update parentpage gridview with the values from child page?


hi   i am having a gridview on each row i am having a update and add button.

on click of either of the button i am opening a popup where the end user will enter data and on clck of ok button in the child page

based on the click ie

if i clicked update i need to update that particular row with the values from child page.

if i clicked on add i need to add a row below the row where i clicked add button .

can anyone help me with this?

Multiple update statements per row in Gridview Edit


I want to set up a gridview that will display data like this

WeekEndingDate Project Category Sun Mon Tues Wed Thu Fri Sat
8/14/2010      proj1   test     2   1   2    3   2   1   0
8/21/2010      proj1   test     0   2   2    2   2   1   0
8/28/2010      proj1   test     0   1  

Custom Grid View Header - Grid view Row Created event vs Gridview row databound events ?


Hi Gurus ,

It happened to add an extra Gridveiw Header in row_databound event , It did worked fine on !Postback but disappered on Page.Postback . Quick google search guided me to move the event to Row_Created event and every thing is okay .

Can any expert post some pointers , differnces between grid row_created vs row_databount with some sample table data created dynamically  behaviour of both the events in !Postback and page.Postback .

Thanks a tonne in Advance and  any inputs will be valued and appreciated .

Event Hanlder to update other SQL tables



I'm writing a small app to allow viewing and editing of a single SQL table (the _Assets table).

I have a form-view that allows the data to be viewed (ItemTemplate) and edited (EditItemTemplate).

Everything works well. All the SQL editing is done in the Mark-Up using a simple SqlDataSource, asp:Parameters and data-binding, (ie. there is no VB code behind).

However, I need to write an event-handler which updates other tables when the EditItemTemplate INSERT button is used.

This event handler needs to update OTHER SQL tables.

The idea is to create a HISTORY of changes (Updates) made to my _Assets table.

It would look something like this:

IF the value of the _Assets.Comments field is changed by the formview, then:

Open SQL connection to _CommentsHistory table

Update _CommentsHistory

SET CountrySerial = asp:Parameter Name "CountrySerial" from SqlDataSource ID="FindAsset"

SET OldComment = [the original Comment] asp:Parameter Name "Comments" from SqlDataSource ID="FindAsset"

SET NewComment = [the New Comment inserted in the formview] TextBox ID="CommentsTextBox" from FormView ID="FormView1"

SET ChangeDate = { fn (now)}

Set ChangedBy =

gridview tablecell text emptystring in RowDataBound event when editing


HI and thanks in advance.  asp.net using vb, using a codebehind page.

I have a relatively simple gridview bound to an product table that displays great.  The problem comes when I choose to edit a row.  When I do so, the gridviews' RowDataBound event fires and the values of the text properties of the tablecells in the row evaluate to "" emptystring. 

I do notice that if I break within the GridView1_RowDataBound event during a refresh of the page, the values are there.  But again, when I hit the "Edit" button in the first column (the CommandField column) .  Text properties of the cells resolve to ""

 Here is the code for the event, followed by the gridview in the form (inside an updatepanel)

Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then  ' not a header, footer row.. etc.
            Dim cellProductNumber As TableCell = e.Row.Cells(3) ' ProductNumber column

'>>>>> after clicking "update", even though a value displays in the gridview,
' the cellProductNumber.Te

Gridview Update outside of SqlDatasource


Is it possible to use a SQLDataSource to populate a gridview but not use the SQLDataSource for Updating?

I wanted to add the update code in the Gridview_RowUpdating event since it is a complex update I need to do.

I get this message when i click the update button

Updating is not supported by data source 'SqlDataSource1' unless UpdateCommand is specified.

How to get object from the gridview selectindex changing Event.


I have a grid view which is populating with a data source through databind. And the Datasource is list of objects.Now when the user selected a row I want to get the object of that row.

I'm trying to get the row like this.


r = gvTruckCarrier.Rows[e.NewSelectedIndex];


drv = r.DataItem as DataRowView




but the drv value is

Changing a textbox's readonly property right before update on a gridview


I have a gridview with a date field. I don't want the user to be able to type in their own date and mess up the format so I made the property readonly. That date is then set by a point and click interface. This is all working fine but when the user clicks update this field doesn't update because it's readonly. If i turn readonly off it works so is there a way to turn off the readonly property right before submit?

Can't change Gridview row colors or styles in the DataBound event


I was highlighting certain rows in my gridview using code like this in the DataBound event:

        if (e.Row.RowType == DataControlRowType.DataRow)
            int vendorCheck = 0;
            //TODO make this shorter
            if (DataBinder.Eval(e.Row.DataItem, "vendorId") != System.DBNull.Value)

GridView RowUpdating event

Hi,I have a gridview. In the rowupdating event, the txtbox returns null. I have enabled viewstate for the gridview. But still it does not work. I have made this in Kentico. Please help.<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"        AutoGenerateColumns="False" DataKeyNames="id" DataSourceID="SqlDataSource1" EnableModelValidation="True"        OnRowUpdating="GridView1_RowUpdating" >        <Columns>            <asp:CommandField ShowDeleteButton="True" CausesValidation="false" ShowEditButton="True"                ControlStyle-Width="100px" />            <asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="Name" SortExpression="name">                <ItemTemplate>                    <as

Textchange Event in Gridview

frends, <asp:GridView ID="grideviewsasmple" runat ="server" AutoGenerateColumns ="false" AutoGenerateEditButton ="true" OnPageIndexChanging ="PageChange" OnRowEditing ="Edit" CellSpacing ="2" OnRowUpdating ="Update" OnRowCancelingEdit ="Cancel" DataKeyNames ="Sno" > <Columns > <asp:TemplateField > <HeaderTemplate > <asp:Button ID="buttonDelete" runat ="server" Text ="Delete" onclick="buttonDelete_Click" /> </HeaderTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Roles"> <HeaderTemplate> <asp:CheckBox ID="chkAll" OnClick="javascript:SelectAllCheckboxesSpecific(this);" runat="server" /> </HeaderTemplate> <ItemTemplate>

MouseUp event not firing on ActivityDesigner class?

I have a custom control derived from ActivityDesigner.  I'm basically retemplating the contol to give it a stylized look and feel ... I want to add the ability to change the Display Name by swapping out the TextBlock with a TextBox on MouseUP - but this event is not firing. I can handle the MouseDown event and it works OK, except it enters the Edit mode when dragging the activity around.  Is the MouseUp handled at the base level?  Is there a way to work around this? 

I need to set the value of a gridview cell during update.

Hi,  I've been reading the posts here and I'm not finding, or maybe just not understanding, the answer I need so here's my problem. I have a small gridview and the update works very well. The issue is I need to have one of the fields set to a value from my code either when the record is open for undating or when the update runs.  Here is my gridview and the datasource info:<asp:GridView ID="GridViewItemLog" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" BackColor="White" BorderColor="#999999" CellPadding="3" DataKeyNames="LogID" DataSourceID="SqlDataSourceItemLogEntries" GridLines="Vertical" onrowdatabound="GridViewItemLog_RowDataBound" onrowupdating="GridViewItemLog_RowUpdating" onrowediting="GridViewItemLog_RowEditing"><AlternatingRowStyle BackColor="Gainsboro" /><Columns><asp:CommandField ButtonType="Image" CancelImageUrl="~/Resources/StopSmall.png" EditImageUrl="~/Resources/EditSmall.png" ShowEditButton="True" UpdateImageUrl="~/Resources/Save.png" /><asp:Boun
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend