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

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

GridView RowDataBound not firing

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :ASP.Net
Hi I have GridView with a buttonfield. Whenever I click on the button I call a stored proc and then the GridView is displayed again. After the stored proc is called and the GridView is displaying again, the RowDataBound is not firing. Im using the RowDataBound to hide some of the other fields in the GridView, so after I click the buttons all the fields are visible because it is not firing the RowDataBound event. Has anyone had a similar issue? Any help would be appreciated. Frankie

View Complete Post

More Related Resource Links

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

RowCommand not firing inside a GridView

Hello,  I'm trying to fire the RowCommand event on a DataGrid control.  I've previously done that, but not in this precise case.  Actually I'm working on someone else code so I can't really change the structure of his page excepted if it's really necessary. The code of the page is heavy, so I've summarized the problem in a small project and the page behaves the same way too.   Basically I have a GridView which I bind to a DataSet.  According to those data, I sometimes need to add, at the end of a row, a "Details" button (a LinkButton).  By pushing this button, I want to show a second GridView containing those details.  Let's add to this that the columns number of the first GridView is variable, those LinkButton need to be added dynamically.   The first GridView is generated without any problem and when my mouse is over one of the LinkButton, I can see that the link is something like "javascript:__doPostBack('dataGridView$ctl02$lnkDetail','')".  When I click on this link and debug step by step : Page_Init, Page_Load, OnPrerender, RowDataBound but no RowCommand, and I don't know why!   In the exemple, I've explicitly set the EnableViewState to true from what I've read here and there, but nothing's changed.   Here's my summarized problem and

Gridview update event not firing


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="

inner gridview in nested gridview not firing onRowCommand


 i have the following nested gridview

i could get the inner gridview onRowDataBound working by setting that directly in the gridview

but i cannot get the linkbutton's onrowCommad inside the inner gridview working!!!

it does not fire the event even i have set it directly in the gridview

here is the code in my app_code page

 Protected Sub deleteSubComment_RowCommand(ByVal sender As Object, ByVal E As GridViewCommandEventArgs)
            If E.CommandName = "deleteSubComment" Then
                Dim ID As Integer = Convert.ToInt32(E.CommandArgument)
            End If
        End Sub


<asp:GridView ID="userComments" runat="server" AutoGenerateColumns="False" EnableViewState="False"

GridView RowDataBound and Edit mode


I have a gridview and a template column:

<asp:TemplateField HeaderText="Active">
                            <asp:CheckBox ID="chkbxActive" runat="server" Checked ='<%# Bind("Active") %>'  />
                            <asp:Label ID="lblActive" runat="server" Text='<%# Bind("Active") %>'></asp:Label>

GridView PageIndexChanging not firing !


I cant for the life of me get the PageIndexChanging event to fire. Please advice.

<asp:GridView ID="gridViewTransactionList" runat="server" AutoGenerateColumns="False"
                AllowPaging="True" BackColor="White" BorderColor="#3366CC" BorderStyle="Solid"
                BorderWidth="1px" CellPadding="4" PageSize="10"
               <asp:BoundField ItemStyle-Width = "150px" DataField = "RowNumber" H

GridView is firing RowDeleting but I don't want it to


I have a Gridview where I'm doing my delete with the OnRowCommand. After I have the database perform the delete I get an error saying the gridview fired the rowdeleting event and it wasn't handled. Do you know why that would happen? This is my gridview;

<asp:GridView ID="favoritesList" 
                                  Style="z-index: 100; left: 0px; position: relative; width: 100%; " 
                                  CellPadding="4" GridLines="Horizontal" 
                                  ForeColor="#333333" onclick="showBusyBox();" 
                                  AutoGenerateColumns="False" OnRowCommand="favoritesList_RowCommand">
                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                        <EditRowStyle BackCo

RowDatabound event tips and tricks in Gridview control

In this article, I will describe about few tips and tricks in rowdatabound event which is available in asp.net gridview control and these tips will provide the solution for all possible requirements when working with rowdatabound event in gridview control.

Inplace Edit in GridView

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.

GridView Confirmation Box Using JQuery BlockUI in asp.net

JQuery is the most popular JavaScript library. One of the main reasons for its fame is the plugin architecture. Anyone can create a separate library that leverage the JQuery library. In this article we are going to look at the BlockUI library which is used to block the user screen while performing a task.

Textbox Editable GridView in ASP.NET

This article describes how I made a fully editable gridview in C# using ASP.NET 2. The idea is that the GridView looks and works like an Excel spreadsheet. You see all the cells in the table, and you can edit any of the cells you like, and they are automatically updated (i.e. saved to the database). This is very often how people expect data tables to work in web pages, and I've often seen people clicking in vain on un-editable gridview cells, somehow expecting to edit them, and not understanding that they need to click an Edit button at the end of the row.

Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.

AJAX GridView Checkbox Select All in ASP.Net

In the previous article GridView Select Multiple Rows you learnt the multiple row selection in GridView control. Here you will get the C# code sample to select all the gridview rows using single checkbox server control. You can highlight the selected rows with different color and Font state Bold. If you want to use the selection values on different ASP.Net

AJAX GridView Paging and Sorting using C# in ASP.Net

To enable the GridView Paging and Sorting to update the GridView Data without refreshing the ASP.Net web page AJAX Extension controls are used. UpdatePanel is used to hold the GridView control that triggers the events for the controls placed inside it. By Default UpdatePanel triggers the asynchronous postbacks for its child controls.

GridView Paging Using Ajax in ASP.Net

To enable the GridView Paging and Sorting to update the GridView Data without refreshing the ASP.Net web page AJAX Extension controls are used. UpdatePanel is used to hold the GridView control that triggers the events for the controls placed inside it. By Default UpdatePanel triggers the asynchronous postbacks for its child controls.

Displaying Row Details Tooltip on GridView using JQuery

Continuing exploring JQuery! I decided to implement a feature to display some kind of details related to a row displayed on GridView. For example when displaying employees details on GridView some information might not fit in the GridView because it will make it huge and wide. These infomration can be diplayed as Tooltip. Or when you want to display a picture and some kind of formated text to be diplayed as tooltip when mouse hover on the image.

jQuery: Highlight Gridview Rows with Checkbox

Im learning and experimenting with jQuery and ASP.NET. Below is a simple solution I created to highlight rows in a gridview by clicking on a checkbox next to the row.

Gridview setup:
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