PC Review


Reply
Thread Tools Rating: Thread Rating: 5 votes, 1.00 average.

<asp:GridView> Select a Column Value.

 
 
Greg
Guest
Posts: n/a
 
      9th Oct 2008
I have a <asp:GridView> control that is populated with records. The first
column I display contains a "UserID" DataField. I've created my column using
the following code:

<asp:BoundField DataField="UserID" />

When the user clicks on a row, I'd like to get the current value of the
UserID column for the current row, as I want to use this value to populate
another GridView control. How can I achieve this?
 
Reply With Quote
 
 
 
 
Oppeiettre
Guest
Posts: n/a
 
      30th Oct 2008


"Greg" wrote:

> I have a <asp:GridView> control that is populated with records. The first
> column I display contains a "UserID" DataField. I've created my column using
> the following code:
>
> <asp:BoundField DataField="UserID" />
>
> When the user clicks on a row, I'd like to get the current value of the
> UserID column for the current row, as I want to use this value to populate
> another GridView control. How can I achieve this?


Try this:
your.aspx file :

<asp:GridView ID="GridView1" runat="server"
onsorting="GridView1_Sorting"

<asp:boundfield datafield="something"

headertext="Something"
sortexpression="something"

in your.aspx.cs

protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
{
string columnExpression = e.SortExpression;
}

you can of cause name the variable as you wish.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 - hide select column Iain Microsoft ASP .NET 0 14th Oct 2009 08:32 AM
How select row in gridview based on value of a column? Bobby Edward Microsoft ASP .NET 0 9th Oct 2008 04:41 AM
gridview column values to another page via gridview hyperlink column Keith G Hicks Microsoft ASP .NET 3 18th Feb 2008 06:17 AM
Conditionally Hide Select Column of GridView ? Luqman Microsoft ASP .NET 4 13th Aug 2007 06:50 AM
GridView - Setting the text of the 'select' column to the value of another column Greg Smith Microsoft ASP .NET 0 12th Apr 2007 04:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:18 AM.