Selecting a column in a gridview

  • Thread starter Thread starter David
  • Start date Start date
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
 
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();
}
 
Back
Top