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
1
vote
2 answers

How do I avoid a GridView's Gridlines changing color when applying a class to a cell on the RowDataBound event?

In my website, I have a page with a Gridview that I use to display some data. I capture the RowDataBound event, to find out if certain text is present in a cell. If it is, I color it green, else I color it red. Here's the problem: the Gridview has…
Freakishly
  • 1,533
  • 5
  • 32
  • 61
1
vote
1 answer

Remove Gridview row in rowDataBound event asp.net c#

I have a gridview which checks some values on rowDataBound event.I want to remove some rows based on conditions checked in rowDataBound.I tried putting all controls in a Panel and hiding that panel ie, TRY 1 : protected void…
sajanyamaha
  • 3,119
  • 2
  • 26
  • 44
1
vote
2 answers

How to change URL of hyperlink in gridview on RowDataBound

I have gridview with template field that contains a hypelink. I'd like to change the URL of the hyperlink based on some logic in a specific field of my SQL data (data table bound to grid). I'm thinking I need to use the RowDataBound event, check the…
RichP
  • 525
  • 1
  • 10
  • 25
1
vote
1 answer

InvalidCastExceptions when setting GridViewRow attributes

I'm working on a context menu for items in my GridView, but there's one major snag. I can't seem to figure out how to send the PK value for the row that is right-clicked on to the JQuery that interacts with my HTTP Handler to update the…
Ortund
  • 8,095
  • 18
  • 71
  • 139
1
vote
1 answer

One line in the RowDataBound event conflicts with the Gridview's paging mechanism

Here is how I'm populating my GridView control. I'm doing this from the code-behind, and not from the .aspx front end. The following is an extremely abbreviated version of what I have: private void UpdateGridView() { DataTable temptable = new…
CptSupermrkt
  • 6,844
  • 12
  • 56
  • 87
1
vote
0 answers

Binding datasource to dropdownlist in edititemtemplate creates Databinding methods such as Eval(), XPath(), and Bind() error

My gridview contains a column called SubPlot. In Edit mode, this column is supposed to show a dropdownlist that binds to a datasource. This datasource takes a parameter called @100mPlotName. This is the error I get when I click on…
dam
  • 171
  • 1
  • 6
  • 17
0
votes
1 answer

Get SelectedDataKey in RowDataBound

this code is returning a NullReferenceException since the SelectedDataKey is not selected yet. How can I check if the the DataKey is selected or not.. protected void grdRoles_RowDataBound1(object sender, GridViewRowEventArgs e) { …
xupla
  • 29
  • 2
  • 3
  • 7
0
votes
2 answers

ASP.NET GridView RowDataBound with CheckBox clickable

I use this code for gridview: protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("style",…
SYSMAN
  • 3
  • 1
  • 8
0
votes
1 answer

How can I conditionally bind a gridview row inside the RowDataBound event?

I have a Gridview, for displaying customer payment data. By default, I alter the display of any rows containing past due customers, using some checks that are only easily available in the RowDataBound event. I would like to add the option to filter…
Jeffrey Blake
  • 9,659
  • 6
  • 43
  • 65
0
votes
2 answers

How can I modify a value before it is shown in a databound Repeater?

I am databinding a repeater some text and a datetime(Respond By).
Mark
  • 2,720
  • 15
  • 56
  • 87
0
votes
2 answers

How to change gridview row color in c# / asp.net

I want to change my grid view row/cell background color depend on grid view cell or column value. I have a gridview asp.net (WebForms), one column which has quantity (int). depend on this value, every row background color should be change…
arbabu
  • 17
  • 4
0
votes
1 answer

How can i make a column from GridView(without datasource) readOnly through code? (asp.net C#)

I'm trying to make some columns readonly for not being able to edit them. I have tried a lot of solutions but none of them worked.I am using a gridview without datasource.( I have more tables and i'm displaying them using a dropdownlist).Anyway i…
0
votes
0 answers

show textbox on click in button inside gridview

I want to show a textbox inside the cell of a gridview, when clicking on a button inside another cell of the same gridview and replace button for checkbox. like this: before click edit button: and after click button like this: this is the html of…
0
votes
1 answer

How can I add image into Gridview Databound dynamically using ASP.NET C#

I need to add an image icon to gridview databound at runtime in a specific cell. I started code already but i'm not sure how to accomplish it because using this code the image don't showing in gridview... See below: if (e.Row.RowType ==…