How to populate data to a grid from another grid in same wab page

Last post 10-28-2008 5:29 AM by manoj0682. 4 replies.

Sort Posts:

  • How to populate data to a grid from another grid in same wab page

    10-28-2008, 3:42 AM
    • Member
      1 point Member
    • aromsheik
    • Member since 02-17-2007, 10:25 AM
    • Abdulla
    • Posts 32

    Hi friend

     

    I would like to populate data to a datagrid which get one data from another grid in a same page. For Example I have 2 grids one product category (grdCat) another one is product (grdProduct). At that time of page load I bind grdcat and shows its contents to the users. Once the user clicks any one of the category in that grdcat, then i wolud like to populate the data in grdprd according tothe  product category the user clicks. Can anyone help me.

     

    Thanks in Advance

     

    Filed under:
  • Re: How to populate data to a grid from another grid in same wab page

    10-28-2008, 4:58 AM

    Make the ProductCategory column a hyperlink, and pass the category id to a querystring value.  Then on page load, test to see if there is a querystring value.  If there is, fetch and bind the relevant data to the second grid.

     

    Regards Mike
    [MVP - ASP/ASP.NET]
    My site    Please help - URGENT!!!    What ASP.NET can and can't do
  • Re: How to populate data to a grid from another grid in same wab page

    10-28-2008, 5:12 AM
    • Contributor
      6,552 point Contributor
    • manoj0682
    • Member since 10-22-2007, 7:16 AM
    • Bangalore,India
    • Posts 1,183

    if you want to add Product Grid inside Category Grid, what you can do is you can add Product Grid  inside Category Grid in _ItemDataBound  event, where you can add product grid inside that.

    eg:-

    e.Item.Cells(1).Controls.Add(grdProduct) 

    where cell 1 is link button on Onclick event of this you have to pass its id and fill the product grid.

    eg :- Cell 1 is

    <asp:TemplateColumn>
                 <ItemTemplate>
                        <asp:LinkButton ID="btnChild" Text="ProductID" runat="server" OnClick="ShowProduct" Width="15px"></asp:LinkButton>
                </ItemTemplate>
    </asp:TemplateColumn>

     onclick event have ShowProduct where you pass productid and get you details in child grid depend on what you click in parent grid.

     

     

    hope this will help you 


    Manoj Karkera
    Zenith Software LTD 



    Please remember to click “Mark as Answer” on the post that helps you, it will help other(s) to get there answer.
  • Re: How to populate data to a grid from another grid in same wab page

    10-28-2008, 5:23 AM
    • Member
      1 point Member
    • aromsheik
    • Member since 02-17-2007, 10:25 AM
    • Abdulla
    • Posts 32

    Thanks Its working

  • Re: How to populate data to a grid from another grid in same wab page

    10-28-2008, 5:29 AM
    • Contributor
      6,552 point Contributor
    • manoj0682
    • Member since 10-22-2007, 7:16 AM
    • Bangalore,India
    • Posts 1,183

    Please remember to click “Mark as Answer” on the post that helps you, so that it will help other also Big Smile


    Manoj Karkera
    Zenith Software LTD 



    Please remember to click “Mark as Answer” on the post that helps you, it will help other(s) to get there answer.
Page 1 of 1 (5 items)