<asp:GridView> Select a Column Value.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?R3JlZw==?=

    <asp:GridView> Select a Column Value.

    I have a <asp:GridViewco ntrol that is populated with records. The first
    column I display contains a "UserID" DataField. I've created my column using
    the following code:

    <asp:BoundFie ld DataField="User ID" />

    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?
  • =?Utf-8?B?T3BwZWlldHRyZQ==?=

    #2
    RE: &lt;asp:GridVie w&gt; Select a Column Value.



    "Greg" wrote:
    I have a <asp:GridViewco ntrol that is populated with records. The first
    column I display contains a "UserID" DataField. I've created my column using
    the following code:
    >
    <asp:BoundFie ld DataField="User ID" />
    >
    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="Grid View1_Sorting"

    <asp:boundfie ld datafield="some thing"

    headertext="Som ething"
    sortexpression= "something"

    in your.aspx.cs

    protected void GridView1_Sorti ng(object sender, GridViewSortEve ntArgs e)
    {
    string columnExpressio n = e.SortExpressio n;
    }

    you can of cause name the variable as you wish.

    Comment

    Working...