Selecting a column in a gridview

D

David

Hi all,

I am setting up a datatable (DT) that has something like 3 queries and lots
of calculations to give me the desired result.

When I have the results, I am then rotating that datatable 90 degrees (i.e.
rows become columns, columns become rows). This works well.

Now, when I bind the DT to a gridview, I want to have a linkbutton at the
bottom of the calculated column(s). This linkbutton actually will go and get
some PDF files, combine them and create a download. (The PDF stuff works
well). What I need to do is to pass specific information from the column, so
I know which PDF files to get.

So, in normal circumstances, I would select a row (use a gridview select
button), and use the selectedindex of the row (in fact, I am doing this
elsewhere). So, how I would I do it for a column?

Thanks for your help.

--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
 
M

Mr. Arnold

David said:
Hi all,

I am setting up a datatable (DT) that has something like 3 queries and lots
of calculations to give me the desired result.

When I have the results, I am then rotating that datatable 90 degrees (i.e.
rows become columns, columns become rows). This works well.

Now, when I bind the DT to a gridview, I want to have a linkbutton at the
bottom of the calculated column(s). This linkbutton actually will go and get
some PDF files, combine them and create a download. (The PDF stuff works
well). What I need to do is to pass specific information from the column, so
I know which PDF files to get.

So, in normal circumstances, I would select a row (use a gridview select
button), and use the selectedindex of the row (in fact, I am doing this
elsewhere). So, how I would I do it for a column?

Thanks for your help.

Below is how you address a cell on a row.

protected void gvDepartment_RowUpdating(object sender,
GridViewUpdateEventArgs e)
{
TblContext = (DataTable)Session["TblContext"];

GridViewRow row = gvDepartment.Rows[e.RowIndex];

TblContext.Rows[row.DataItemIndex]["Name"] =
((TextBox)(row.Cells[2].Controls)[0]).Text.Trim();
TblContext.Rows[row.DataItemIndex]["GroupName"] =
((TextBox)(row.Cells[3].Controls)[0]).Text.Trim();
TblContext.Rows[row.DataItemIndex]["Delete"] =
((CheckBox)(row.Cells[4].Controls)[0]).Checked;

((CheckBox)(row.Cells[5].Controls)[0]).Checked = true;
TblContext.Rows[row.DataItemIndex]["IsDirty"] =
((CheckBox)(row.Cells[5].Controls)[0]).Checked;

TblContext.Rows[row.DataItemIndex]["IsNew"] =
((CheckBox)(row.Cells[6].Controls)[0]).Checked;

gvDepartment.EditIndex = -1;

BindData();
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top