Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Selecting a column in a gridview

Reply
Thread Tools

Selecting a column in a gridview

 
 
David
Guest
Posts: n/a
 
      04-19-2009
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


 
Reply With Quote
 
 
 
 
Mr. Arnold
Guest
Posts: n/a
 
      04-19-2009
David wrote:
> 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();
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
gridview column values to another page via gridview hyperlink column Keith G Hicks ASP .Net 3 02-18-2008 06:17 AM
GridView - Setting the text of the 'select' column to the value of another column Greg Smith ASP .Net 0 04-12-2007 03:11 PM
Gridview header sorted column dimmed after selecting it Tony Girgenti ASP .Net Datagrid Control 0 03-21-2007 12:46 PM
Gridview header sorted column dimmed after selecting it Tony Girgenti ASP .Net Web Controls 0 03-13-2007 11:03 PM
How to hide a GridView column when the column's Visible property does not support databinding? Keithb ASP .Net 2 10-27-2006 05:02 AM



Advertisments