Questions tagged [rowdatabound]

Occurs when a data row is bound to data in a GridView control. Contained in the namespace System.Web.UI.WebControls

According to Microsoft Developer Network:

  • Detail of RowDataBound event

    The RowDataBound event is raised when a data row (represented by a GridViewRow object) is bound to data in the GridView control. This enables you to provide an event-handling method that performs a custom routine, such as modifying the values of the data bound to the row, whenever this event occurs.

  • Syntax (C#)

    public event GridViewRowEventHandler RowDataBound
    
  • See example here:

139 questions
11
votes
1 answer

How to get value of a cell in row data bound event? and how to check if a cell is empty?

I'm using sqldatasource and a GridView. I want to get the value of a cell from the GridView in the RowDataBound event?, Because I can't use e.RowIndex. How to check in the updatng event if a cell is empty? I used if != null, but it didn't worked so…
Alexander
  • 187
  • 2
  • 5
  • 15
10
votes
4 answers

What is difference between RowIndex and DataItemIndex?

In gridview’s RowDataBound event has e.Row.RowIndex and e.Row.DataItemIndex properties. Please tell me in easily understandable answer, what is difference between them? In which situation we should use which one?
Amit
  • 21,570
  • 27
  • 74
  • 94
7
votes
3 answers

How to access a gridview column on rowdatabound ?

I would like to change the value of my gridview column to active when the value is 1. I have gridview column like
rematnarab
  • 1,277
  • 4
  • 22
  • 42
6
votes
5 answers

How to programmatically replace an HyperLinkField in a ASP.NET GridView

I have an ASP.NET Web Forms application. In my application I have a GridView that works smoothly. I have several text fields and the last one is a . Now I would like to programmatically change the field by placing a simple link…
CiccioMiami
  • 8,028
  • 32
  • 90
  • 151
5
votes
4 answers

How to check if any row is selected from GridView?

I have a gridview in aspx page:
asma
  • 2,795
  • 13
  • 60
  • 87
5
votes
2 answers

e.Row.DataItem error in gridview rowdatabound event

I want to enable or disable a particular row according to the related user logined. So i use rowdatabound event but i have an error in this line: DataRow drv = ((DataRowView)e.Row.DataItem).Row; In here, e.Row.DataItem has related row…
rockenpeace
  • 1,011
  • 5
  • 18
  • 29
5
votes
2 answers

How to change in a Gridview on RowDataBound event the value of an Eval() field

I have a GridView: <%# Eval("Enabled")%>
CiccioMiami
  • 8,028
  • 32
  • 90
  • 151
4
votes
5 answers

How to avoid RowDataBound when GridView is edited?

Currently, I have the following code in the RowDataBound: protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label groupID =…
aleafonso
  • 2,244
  • 8
  • 38
  • 58
4
votes
3 answers

ASP.net Gridview highlight max values in multiple columns

I have a gridview that shows, for example, a baseball team's statistics. It's a standard sports stats grid - the rows show statistics for each player and the columns show the specific stat for the each player. Easy enough so far. But what I would…
IMAbev
  • 188
  • 1
  • 2
  • 18
4
votes
1 answer

Background color of Gridview row on RowDataBound is not working in IE11

I have Grd_RowDataBound and I am applying back color to my GridView Rows. I have used below code which is working fine in Crome and Mozilla ,but not working in IE11.In IE11 my Gridview row back color is not working. protected void…
Genish Parvadia
  • 1,437
  • 3
  • 17
  • 30
4
votes
3 answers

Adding Control to Gridview Cell

I want to add a button on GridView cell on certain condition. I did the following in RowDatabound event if( i==0) { Button btn= new Button(); btn.Text = "view more"; e.Row.Cells[7].Controls.Add(btn); } When this executes, the text…
Shanna
  • 753
  • 4
  • 14
  • 34
3
votes
4 answers

Displaying a image in grid view based on condition

I am trying to display 1. Red if the TimeReceived is Null, (or) 2. Amber when Time Received is not null and Time Read is Null (Or) 3. Green When Time read is not null It throws an error Input string was not in a correct format. Description: An…
Mark
  • 2,720
  • 15
  • 56
  • 87
3
votes
2 answers

Gridview RowDataBound show hide column for each row

I have a gridview where I only want to allow a textbox to be editable if a certain drop down list item is selected. In my RowDataBound, I get the value and decide if it should be edited but the .Visible attribute is not working as I expect it to.…
joerdie
  • 379
  • 1
  • 6
  • 18
3
votes
1 answer

Showing specific rows using GridView.RowDataBound Event

Problem I have a Gridview bounded to a project table having one of the attribute as clientid and other attributes. Now i want to show only specific rows where clientid is equals to a given id. What I have got Change GridView row color based on…
Ankush Dubey
  • 817
  • 1
  • 10
  • 19
2
votes
3 answers

Dynamically created rows disappear from Gridviews on update/delete

Situation: I have several Gridviews on one page, and each Gridview has a dynamically created row to display the totals at the bottom. In each case, the totals row is created on a RowDataBound event. The strategy that I am using is like the one…
Karl Wenzel
  • 2,412
  • 25
  • 24
1
2 3
9 10