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

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

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

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:
    597
    Saravana
    Nov 22, 2004
  2. =?Utf-8?B?YWRvbGYgZ2FybGlj?=

    How to access client side XML data island from server side?

    =?Utf-8?B?YWRvbGYgZ2FybGlj?=, Nov 23, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,352
    aa7im
    Nov 23, 2004
  3. =?Utf-8?B?Sm9u?=

    DataGrid Add Row Client Side

    =?Utf-8?B?Sm9u?=, May 19, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    784
    Eliyahu Goldin
    May 19, 2005
  4. =?Utf-8?B?QmlkYXJrb3Rh?=

    DataGrid Client Side row selection

    =?Utf-8?B?QmlkYXJrb3Rh?=, May 23, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    627
    =?Utf-8?B?QmlkYXJrb3Rh?=
    May 23, 2005
  5. Boss302
    Replies:
    0
    Views:
    1,359
    Boss302
    Nov 21, 2006
  6. Bogdan
    Replies:
    2
    Views:
    870
    Bogdan
    Jun 9, 2008
  7. John Smith

    datagrid and client side scripts to add row

    John Smith, Sep 30, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    169
    John Smith
    Sep 30, 2004
  8. Zoe Hart
    Replies:
    1
    Views:
    592
    Scott Wisniewski
    Jan 8, 2004
Loading...