Highlighted
Absent Member.
Absent Member.
2369 views

GridView

Jump to solution

Hi Everyone,
I have created a gridview with 3 cols successfully. 1st is the S.no and 2,3 contains Dates. It has 12 rows. Now i want to highlight a cell in the 2nd column which satisfies a cond. This is my Code

if e::Row::Cells[1]::Text = "mycondvar"
then 
  set e::Row::font::Bold to false
else
  set e::Row::font::Bold to true.

It is always setting to True. Even when I set a breakpoint i am not able to view the value in Cells[1]. I am totally stuck, is my syntax correct ?
Kindly help me with this . Thanks

0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.

Hello Pradeep!

Try do implement a new method using RowDataBound event this way:

method-id GridViewListar_RowDataBound protected.
procedure division using by value sender as object e as type System.Web.UI.WebControls.GridViewRowEventArgs.
  if e::Row::Cells[3]::Text equal "Masculino"
  then
    set e::Row::Cells[3]::Font::Bold to false
  else
    set e::Row::Cells[3]::Font::Bold to true
  end-if
end method.

Cells[3] means you are comparing the value of the fourth column.

This method will run automatically when a new row is inserted into the gridview.

Hope this helps.

View solution in original post

0 Likes
4 Replies
Highlighted
Absent Member.
Absent Member.

Hi, are you using WPF or WFA or Asp.net?

I can tell you that using WFA you can check the value using this statement:

GridListar::Rows::Item(lo-ind)::Cells::Item(0)::Value

GridListar = Name of the object

lo-ind = index of the line you want

item(0) = index of the column (0 = first column)

Using WPF you can check the samples I had uploaded here:

community.microfocus.com/.../13057.aspx

community.microfocus.com/.../13059.aspx

Hope this helps...

0 Likes
Highlighted
Absent Member.
Absent Member.

Thanks Coral. But I need it for asp.net

0 Likes
Highlighted
Absent Member.
Absent Member.

Hi Coral,

I want to highlight any cell in the 2nd column which satisfies my cond. I did not convey it properly in my question, sorry.

0 Likes
Highlighted
Absent Member.
Absent Member.

Hello Pradeep!

Try do implement a new method using RowDataBound event this way:

method-id GridViewListar_RowDataBound protected.
procedure division using by value sender as object e as type System.Web.UI.WebControls.GridViewRowEventArgs.
  if e::Row::Cells[3]::Text equal "Masculino"
  then
    set e::Row::Cells[3]::Font::Bold to false
  else
    set e::Row::Cells[3]::Font::Bold to true
  end-if
end method.

Cells[3] means you are comparing the value of the fourth column.

This method will run automatically when a new row is inserted into the gridview.

Hope this helps.

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.