Gridview interaction with Detailsview

Discussion in 'ASP .Net' started by nolan@easy.com, Aug 7, 2006.

  1. Guest

    I have an asp.net 2.0 page with a gridview and detailsview on the same
    page set up in a master-details scenario. The gridview and detailsview
    have separate SQL data sources. The user enters search criteria in a
    text box and clicks a find button to initially populate the gridview
    with items of interest. I have added a select button to my gridview
    and when the user clicks the button the detailsview is populated
    perfectly. However, I also want the detailsview to be automatically
    populated with the first item in the gridview after the user clicks the
    find button. I have programatically set the SelectedIndex for the
    gridview to zero in the Selected event for the SQL datasource that
    drives my gridview, but this doesn't update the detailsview until I
    execute another postback. How can I make this work?

    Thanks!

    Jeff
    , Aug 7, 2006
    #1
    1. Advertising

  2. set the SelectedIndex of your GridView in the DataBound Event of your GridView
    It shoud work

    Regards,
    --
    Muhammad Mosa
    Software Engineer & Solution Developer
    MCT/MCSD.NET
    MCTS: .Net 2.0 Web Applications
    MCTS: .Net 2.0 Windows Applications


    "" wrote:

    > I have an asp.net 2.0 page with a gridview and detailsview on the same
    > page set up in a master-details scenario. The gridview and detailsview
    > have separate SQL data sources. The user enters search criteria in a
    > text box and clicks a find button to initially populate the gridview
    > with items of interest. I have added a select button to my gridview
    > and when the user clicks the button the detailsview is populated
    > perfectly. However, I also want the detailsview to be automatically
    > populated with the first item in the gridview after the user clicks the
    > find button. I have programatically set the SelectedIndex for the
    > gridview to zero in the Selected event for the SQL datasource that
    > drives my gridview, but this doesn't update the detailsview until I
    > execute another postback. How can I make this work?
    >
    > Thanks!
    >
    > Jeff
    >
    >
    =?Utf-8?B?TXVoYW1tYWQgTW9zYQ==?=, Aug 7, 2006
    #2
    1. Advertising

  3. Guest

    Thansk for the reply. Your suggestion got me on the right track. I
    also had to databind my DetailsView after settings the SelectedIndex in
    the DataBound Event of the GridView to get this to work. I appreciate
    the help!


    Muhammad Mosa wrote:
    > set the SelectedIndex of your GridView in the DataBound Event of your GridView
    > It shoud work
    >
    > Regards,
    > --
    > Muhammad Mosa
    > Software Engineer & Solution Developer
    > MCT/MCSD.NET
    > MCTS: .Net 2.0 Web Applications
    > MCTS: .Net 2.0 Windows Applications
    >
    >
    > "" wrote:
    >
    > > I have an asp.net 2.0 page with a gridview and detailsview on the same
    > > page set up in a master-details scenario. The gridview and detailsview
    > > have separate SQL data sources. The user enters search criteria in a
    > > text box and clicks a find button to initially populate the gridview
    > > with items of interest. I have added a select button to my gridview
    > > and when the user clicks the button the detailsview is populated
    > > perfectly. However, I also want the detailsview to be automatically
    > > populated with the first item in the gridview after the user clicks the
    > > find button. I have programatically set the SelectedIndex for the
    > > gridview to zero in the Selected event for the SQL datasource that
    > > drives my gridview, but this doesn't update the detailsview until I
    > > execute another postback. How can I make this work?
    > >
    > > Thanks!
    > >
    > > Jeff
    > >
    > >
    , Aug 7, 2006
    #3
    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. RCS
    Replies:
    3
    Views:
    2,811
    Jeff User
    Dec 2, 2005
  2. ottawa111

    Gridview inside Detailsview?

    ottawa111, Jan 20, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    2,703
    ottawa111
    Jan 20, 2006
  3. P. Yanzick
    Replies:
    5
    Views:
    15,677
    visj4u
    Apr 27, 2007
  4. davidd
    Replies:
    0
    Views:
    815
    davidd
    Sep 5, 2006
  5. Feege
    Replies:
    0
    Views:
    444
    Feege
    Dec 20, 2005
Loading...

Share This Page