"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.
|