Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Row Databound

Status
Not open for further replies.

nc297

Programmer
Apr 7, 2010
162
0
0
US
How do I find out the count of the underlined items. For instance which row and cell.

State TotPend PendnFO PendnDDS
MD 80 256 782
Area1 102 148 256
456 22 16 25
876 15 29 32

Is the underline row 3 and cell 1? I'm starting with 0 as the count for the row and the cells. Do I do that with Gridviews?
 
you can use the rowdatabound event to examine the data being rendered. I would recommend evaluating the data behind the rendered html, not trying to parse the values from the html itself.

there was a flag somewhere which informed webforms to render the text as underlined. use this same flag to determine if you should calculate get the count of these values. but get the values from the datasource, not the html.

all collections use a zero based index: 0,1,2,3...N

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Thanks Jmeckley for your reply.


Could you please help me again...

I'm looking for these...

When a manager logs in and he is from Area 1 his profile is H20 and so on...

Area 1 = H20

Area 2 = H21

How would I write in rowdatabound if you are in Area 1 and H20 then enable links?

This is what this person should see when they go to this page. Now when H21 goes to this page no links should be available.


State TotPend PendnFO PendnDDS
MD 80 256 782
Area1 102 148 256
456 22 16 25
876 15 29 32

If I go in as H20 profile then the following should be underlined. If I go in as H21 then nothing should be underlined.
 
1. in template columns add a label control bound to the value
2. in the same template column add a hyper link control bound to the value.
3. In the row data bound compare the area of the user to the area of row. show/hide appropiate the controls.
Code:
var row = e.Row;
var rows = new [] {RowType.Row, RowType.AlternateRow};

[COLOR=green]//ensure we are not in the header/footer/spacer...[/color]
if(rows.Contains(row.RowType) == false) return;

[COLOR=green]//get nested controls[/color]
var label = row.FindControl(id of label);
var hyperlink = row.FindControl(id of link);

[COLOR=green]//MyArea is your own logic to get the current user's area[/color]
var partOfArea = MyArea == row.DataItem["column"];

label.Visible = partOfArea == false;
hyperlink.Visible = partOfArea;


Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top