GridView's selection isn't causing other GridView's to load data asexpected

Discussion in 'ASP .Net' started by Rasika WIJAYARATNE, Dec 14, 2007.

  1. Hi everyone,

    I have two grid-views and I am trying to populate the data on gv2
    based on the selection in gv1. However when a row is selected in gv1,
    it doesn't populate the gv2 with data. I have ensured that the
    ObjectDataSource (ods2) for gv2 works and load data correctly by
    specifying hardcoded primary key value within a Paramater.

    Anyone know what is a miss here to prevent gv2 from loading it's
    data???


    [Grid where rows are selected from.]
    <asp:GridView ID="gv1" runat="server" AllowPaging="True"
    AllowSorting="True"
    AutoGenerateColumns="False" DataSourceID="ods1"
    DataKeyNames="myID">
    <Columns>
    <asp:CommandField ShowSelectButton="True" />
    ...
    </Columns>
    </asp:GridView>


    [Grid where sub-details rows are displayed based on above
    selection.]
    <asp:GridView ID="gv2" runat="server" AutoGenerateColumns="False"
    DataSourceID="ods2">
    <Columns>
    ...
    </Columns>
    </asp:GridView>


    [Data source for getting the sub-details for gv2, based on
    selection in gv1.]
    <asp:ObjectDataSource ID="ods2" runat="server"
    OldValuesParameterFormatString="original_{0}"
    SelectMethod="GetData"
    TypeName="MyTableAdapters.MyTableAdapter">
    <SelectParameters>
    <asp:ControlParameter ControlID="gv1" Name="myID"
    PropertyName="SelectedValue" Type="Int32" />
    </SelectParameters>
    </asp:ObjectDataSource>
    Rasika WIJAYARATNE, Dec 14, 2007
    #1
    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. tacmec
    Replies:
    2
    Views:
    2,431
  2. Simon Niederberger
    Replies:
    2
    Views:
    16,426
    Christian Kaufhold
    Jan 7, 2005
  3. Andrew Crowe
    Replies:
    1
    Views:
    4,438
    Andrew Crowe
    Sep 13, 2004
  4. curiousity

    HOWTO autopost the selection list upon selection

    curiousity, Nov 21, 2003, in forum: ASP .Net Mobile
    Replies:
    0
    Views:
    257
    curiousity
    Nov 21, 2003
  5. Alexey Verkhovsky
    Replies:
    8
    Views:
    145
    Hal Fulton
    Jul 18, 2004
Loading...

Share This Page