Questions tagged [rowdatabound]

1

votes
1

answer
58

Views

unable to find edit template control checkbox in row command

I tried to get the control of edit template which is checkbox in row command event but I am unable to get it, but I am getting label control which is in row index. I tried the above below code to get the control: protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { GridVi...
Flash
1

votes
2

answer
45

Views

cannot find controls in GridView1_RowDataBound

I have a grid view on edit I run GridView1_RowDataBound in which I need to retrieve the values for drop-down list in the edit template and when user changes the values I post back and fill the following drop-down lists but I am getting null, and this code was working fine before I am not sure what w...
GeekSeek Fun
1

votes
1

answer
3.7k

Views

Handling RowDataBound causes dynamically-bound GridView to show only first record

I have a GridView control which I am dynamically binding to a DataTable which is populated by a query built based on a set of selected options. What I am trying to do is simply handle the RowDataBound event in order to format specific rows based on the value of a database field. The code in this ev...
Zogglet
1

votes
2

answer
842

Views

Bind two Attributes[“onclick”]

I got a GridView where I want to bind two events(?) when I click the first cell. Both events/onclick are in RowDataBound. First one gives me selectedindex so I can use SelectedIndexChanged and save row in Session. e.Row.Cells[1].Attributes['onClick'] = ClientScript.GetPostBackClientHyperlink(this.g...
user3033046
1

votes
2

answer
1.7k

Views

Maximum value in a gridview column

I have a gridview which is databound to a sql datasource and displays data as it should but now I want to display the highest value in a column in a textbox. I have assigned the column to a literal called litPathwayDays. The column displays a cumulative total as an Integer and obviously the last val...
Paul Stevens
1

votes
2

answer
1.5k

Views

Populate DropDownList inside Grid Template Column

I have a dropdownlist inside a template column on a obout grid. Currently i am populating the dropdownlist on page load with a sqldatasource. However, i now have to load the dropdownlist dependent on the value of a certain column. For example: If status = 1, i populate the dropdownlist with a li...
Alex
1

votes
2

answer
3.4k

Views

Can't Find Hyperlink of Cell during Gridview RowDatabound

I have a gridview that lists rows of information from SQL. If the late column is set to 1 it should display the text of the row in red. This works, however the hyperlink text will not be displayed in red. So I'm trying to a) change the forecolor of the hyperlink element or b) apply a class to the el...
Charles Rutherford
1

votes
1

answer
594

Views

How to mark records in gridview as read and unread

This is my GridView1. I want the latest record to be highlighted and after user click the authorization no(which user viewed the record in next page), the row will not be highlighted (means after the user view the record, the row is back to normal, no highlight no bold font). My current progress is,...
user3431310
1

votes
2

answer
0

Views

Accessing another row while in Gridview RowDataBound?

Is there a way to access elements that are in another row, while you're in a RowDataBound event? public void gridview1_RowDataBound(object sender, GridViewRowEventArgs e) { // how to compare e.Row with row above or row below? }
Pupper
1

votes
2

answer
4.9k

Views

gridview id in rowdatabound

I have an rowdatabound method that is common for two gridviews. Part of the task for this method, is to asign values to last column of the gridview. The gridviews are the same, but the values are different from the two gridviews. So i need to check if i'm asigning vaules to the first gridview or th...
Ruben Ravnå
1

votes
2

answer
1k

Views

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 horizontal gridlines only. When I change the color o...
Freakishly
1

votes
1

answer
753

Views

Adding cells at specific index

I have gridview with autogenerated columns.I have added a column dynamically in the row databound event. if (e.Row.RowType == DataControlRowType.DataRow) { TableCell cell1 = new TableCell(); e.Row.Cells.Add(cell1); } // to add header else { TableCell cell1 = new TableCell(); cell1.Text = 'NAME'; e.R...
Shanna
1

votes
1

answer
3.7k

Views

Gridview CommandField validation works, but not firing Delete method

I have a gridview that I'm trying to validate from code behind. In this case, to confirm a record deletion. My deletion method works fine until I add the validation which, when I implement it, it doesn't fire the deletion. To be clear, the deletion methods work correctly until I add the RowDataBoun...
John Kinane
1

votes
1

answer
11.1k

Views

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 grdFeatured_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row...
sajanyamaha
1

votes
2

answer
1.2k

Views

Hiding dropdownlist in templatefield in gridview asp.net C# after insert into the database

I have a problem, I would like after the value from the dropdown list is picked up, inserted into the db I would like it to hide the dropdown list and just show the grade of the product that the user rated, as on the two following pictures: This is the first picture showing how the user needs to i...
perkes456
5

votes
1

answer
6.9k

Views

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 Grd_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row....
Genish Parvadia
5

votes
4

answer
19.3k

Views

How to check if any row is selected from GridView?

I have a gridview in aspx page: --- No Consumer Exists --- The rowDataBound Method is: protected void gdvMainList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes['onclick'] = ClientScript.GetPostBackClientHyperlink(this.gdvMai...
asma
5

votes
3

answer
35.5k

Views

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 and cs code protected void gvCategory_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.Cells[5].Text=='0') { e.Row.Cell...
rematnarab
6

votes
5

answer
20.2k

Views

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 instead of the hyperlinkfield if a specific condition is fulfilled. Ther...
CiccioMiami
3

votes
3

answer
16.6k

Views

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 in the cell which is bound is lost and only the button appear...
Shanna
5

votes
2

answer
14.6k

Views

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

I have a GridView: The Enabled property is a boolean. Now I would like to display Enabled/Disabled based on True/False of the Enabled property. Therefore I use: Sub gvDownloads_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles gvDownloads.RowDataBound If e.Row.RowType = D...
CiccioMiami
3

votes
2

answer
4.1k

Views

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. Using my sample data, I would expect the first and se...
joerdie
4

votes
5

answer
12.6k

Views

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 = (Label)e.Row.FindControl('idgroup'); LinkButton myLink = (LinkButton)e.Row.FindControl('groupLin...
aleafonso
2

votes
3

answer
325

Views

Show only the footer for inserting new row in Gridview in .Net 3.5

When my Gridview is bound with 'few rows' of data, my current approach for adding a new row is an adequate design and works 'well'. However, if bound with 'many rows' of data, my current approach for adding a new row is flawed: the EmptyDataTemplate I am using is exposed using the FooterTemplate. Th...
John Adams
3

votes
4

answer
15k

Views

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 unhandled exception occurred during the execution of...
Mark
3

votes
1

answer
1.3k

Views

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 condition 2.http://msdn.microsoft.com/en-us/library/syst...
Ankush Dubey
4

votes
3

answer
1.7k

Views

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 then like to do is style (highlight or bold) the Max...
IMAbev
2

votes
3

answer
2.7k

Views

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 provided by Mike Dugan on his Blog. The following is t...
Karl Wenzel
2

votes
1

answer
12.4k

Views

How to loop through specific columns in gridview?

I need to loop thru particualr columns in a gridview. For example, I need to loop every '%' columns and then assign colors according to their values, is there a simple way to achieve it? Thanks. Gridview table RowDataBound event Protected Sub gv_ssi_rzli_data_1_RowDataBound(sender As Object, e As E...
user1672932
5

votes
2

answer
20.3k

Views

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 information. I have controlled and it has values of row. But whe...
rockenpeace