Access datagrid's selected row on client side

Discussion in 'ASP .Net Web Controls' started by Calvin KD, Nov 18, 2004.

  1. Calvin KD

    Calvin KD Guest

    Hi everyone,
    I've got a search screen displayed as a modal dialog screen. On the search
    screen I have fields for specifying search criteria and a datagrid for search
    results. I'm just looking for a way of returning the selected row's details,
    such as an ID, back to the parent window but I don't know how.
    Can someone out there show me how or suggest where I can find such
    information.
    Any suggestion is greatly appreciated.
    KD
     
    Calvin KD, Nov 18, 2004
    #1
    1. Advertising

  2. Hi Calvin,

    For ur need, create an onclick attribute in the datagrid item which fires a
    javascript function.
    while creating attribute bind the datakey in the js function

    Rgds,
    Thiruppathi S
    "Calvin KD" <> wrote in message
    news:...
    > Hi everyone,
    > I've got a search screen displayed as a modal dialog screen. On the search
    > screen I have fields for specifying search criteria and a datagrid for

    search
    > results. I'm just looking for a way of returning the selected row's

    details,
    > such as an ID, back to the parent window but I don't know how.
    > Can someone out there show me how or suggest where I can find such
    > information.
    > Any suggestion is greatly appreciated.
    > KD
     
    Thiruppathi S, Nov 18, 2004
    #2
    1. Advertising

  3. Calvin KD

    Barry Guest

    Hi Calvin,

    Maybe this will help:
    Create a sub for the IndexChanged event of your datagrid then select the
    contents of any cell in that row and assign to data variables.

    For example:
    Private Sub dgCollection_SelectedIndexChanged(ByVal sender As System.Object,
    ByVal e As System.EventArgs) Handles dgCollection.SelectedIndexChanged
    Session("GridKey") = dgCollection.SelectedItem.Cells(1).Text
    BindDgMapsMines()

    End Sub

    Good luck.

    Barry

    "Calvin KD" wrote:

    > Hi everyone,
    > I've got a search screen displayed as a modal dialog screen. On the search
    > screen I have fields for specifying search criteria and a datagrid for search
    > results. I'm just looking for a way of returning the selected row's details,
    > such as an ID, back to the parent window but I don't know how.
    > Can someone out there show me how or suggest where I can find such
    > information.
    > Any suggestion is greatly appreciated.
    > KD
     
    Barry, Nov 18, 2004
    #3
  4. Calvin KD

    m11533 Guest

    I'll answer my own question. The result of lots of experimentation indicated
    the magic incantation is:

    LinkButton lb =
    (LinkButton)SiteDataGrid.SelectedItem.FindControl("SiteIDLabel");

    -M
     
    m11533, Nov 18, 2004
    #4
  5. Calvin KD

    m11533 Guest

    I'm having a related problem...

    I am using a DataGrid with the following column definition:

    <asp:TemplateColumn HeaderText="SiteID">
    <ItemTemplate>
    <asp:LinkButton ID=SiteIDLabel Runat="server" CommandName=Select
    Text='<%# DataBinder.Eval(Container, "DataItem.SiteID") %>'>
    </asp:LinkButton>
    </ItemTemplate>
    </asp:TemplateColumn>

    My handler gets called, but every attempt I've made to extract the Text
    value of this column in the grid has failed to yield anything useful. I also
    am seeing some of the generated HTML (such as a <td> tag) in some of my
    attempts.

    This is really holding me up, so I appreciate any help you can offer.

    -M
     
    m11533, Nov 18, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U3VyZXNo?=
    Replies:
    1
    Views:
    484
    Saravana
    Nov 22, 2004
  2. Charles Shao
    Replies:
    1
    Views:
    411
    Eliyahu Goldin
    Apr 18, 2005
  3. Boss302
    Replies:
    0
    Views:
    1,098
    Boss302
    Nov 21, 2006
  4. Want to add row under selected row of gridview

    , Feb 16, 2007, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    340
  5. Selected Row Only GridView Row Visible?

    , Oct 17, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    320
Loading...

Share This Page