GridView Inside Repeater

Last post 10-14-2009 3:31 PM by rakesh188. 12 replies.
Page 1 of 1 (13 items)
Sort Posts: Previous Next
  • 10-13-2009 4:00 PM

    GridView Inside Repeater

    Hi

    I want to show multiple master detail records on the page. I am returing a List of Master/ Detail record from the webservice and trying to bind it to a repeater control.

    Can I put a ADC GridView inside a Repeater Control item template and bind the Detail record of each master to this grid view?

    Can I have nested Repeater Controls and bind the child repeater to the detail records?

    Thanks

    Rakesh

     

  •  Advertisement

    Featured Advertisement

     
  • 10-13-2009 7:46 PM In reply to

    • Sonu
    • Top 10 Contributor
    • Joined on 05-22-2006
    • Montreal / Canada
    • Slacker
    • Points 12,183
    • MVP

    Re: GridView Inside Repeater

    Yes, its possible. Checkout this sample:

    http://ajaxdatacontrols.codeplex.com/SourceControl/changeset/view/32283#183643

    [MVP since 2005] [MCAD]
    Webmaster of DotNetSlackers
    Question or Suggestion?
    Feel free to ask my any .NET question
    Our Posting FAQ
  • 10-14-2009 11:29 AM In reply to

    Re: GridView Inside Repeater

     Thanks Sonu,

    I am trying to put a GridView instead of childRepeater as it becomes easy to bind the data. I am able to bind the data if I don't define the columns when creating the child grid view.

    When I try to do this it gives me an error. Can you tell me what is wrong in this.

    Note: I have copied this from what is generated if I put the same grid view in design time.

    childRepeater = $create(AjaxDataControls.GridView, {

     

    "columns":[$create(AjaxDataControls.GridViewButtonColumn, {"allowDragAndDrop":false,"buttonType":AjaxDataControls.GridViewColumnButtonType.Image,"columnID":1,"commandName":"linetext","headerText":"T","imageUrl":"Images/txt.gif"}, null, null), $create(AjaxDataControls.GridViewBoundColumn, {"allowDragAndDrop":true,"columnID":2,"dataField":"Pos","headerText":"Pos"}, null, null), $create(AjaxDataControls.GridViewBoundColumn, {"allowDragAndDrop":true,"columnID":5,"dataField":"Item","headerText":"Item"}, null, null), $create(AjaxDataControls.GridViewBoundColumn, {"allowDragAndDrop":true,"columnID":6,"dataField":"Description","headerText":"Description"}, null, null), $create(AjaxDataControls.GridViewBoundColumn, {"allowDragAndDrop":true,"columnID":3,"dataField":"Qty","headerText":"Qty"}, null, null), $create(AjaxDataControls.GridViewBoundColumn, {"allowDragAndDrop":true,"columnID":4,"dataField":"Amount","headerText":"Amount"}, null, null), $create(AjaxDataControls.GridViewBoundColumn, {"allowDragAndDrop":true,"columnID":9,"dataField":"InvoiceStat","headerText":"Status#"}, null, null), $create(AjaxDataControls.GridViewHyperLinkColumn, {"allowDragAndDrop":true,"columnID":8,"controlStyle":new AjaxDataControls.Style('', '', '', '', 'asphyperlink', new AjaxDataControls.FontInfo('', '', '', '', ''), '', '', ''),"dataNavigateUrlFields":"Invoice,FinanceCompany,TransactionType","dataNavigateUrlFormatString":"BLOCKED SCRIPTReprintInv(\u0027{0}\u0027);","dataTextField":"Invoice","headerText":"Invoice#","sortField":"Invoice"}, null, null), $create(AjaxDataControls.GridViewBoundColumn, {"allowDragAndDrop":true,"columnID":5,"dataField":"DelQty","headerText":"Del Qty"}, null, null), $create(AjaxDataControls.GridViewBoundColumn, {"allowDragAndDrop":true,"columnID":5,"dataField":"DelDate","headerText":"Shipped Date"}, null, null), $create(AjaxDataControls.GridViewBoundColumn, {"allowDragAndDrop":true,"columnID":8,"dataField":"warehouse","headerText":"Warehouse"}, null, null), $create(AjaxDataControls.GridViewHyperLinkColumn, {"allowDragAndDrop":true,"columnID":7,"controlStyle":new AjaxDataControls.Style('', '', '', '', 'asphyperlink', new AjaxDataControls.FontInfo('', '', '', '', ''), '', '', ''),"dataNavigateUrlFields":"URL","dataNavigateUrlFormatString":"{0}","dataTextField":"TrackNo","headerText":"Tracking","target":"_blank"}, null, null), $create(AjaxDataControls.GridViewBoundColumn, {"allowDragAndDrop":true,"columnID":8,"dataField":"Carrier","headerText":"Carrier"}, null, null), $create(AjaxDataControls.GridViewBoundColumn, {"allowDragAndDrop":true,"columnID":10,"dataField":"Loadid","headerText":"LOD Id"}, null, null), $create(AjaxDataControls.GridViewBoundColumn, {"allowDragAndDrop":true,"columnID":10,"dataField":"Shipment","headerText":"Shipment#"}, null, null)],"emptyDataTemplate":" No Data Found For Order Number ","headerStyle":new AjaxDataControls.TableItemStyle('', '', '', '', 'HeaderStyle', new AjaxDataControls.FontInfo('', '', '', '', ''), '', '', '', '', '', true),"rowStyle":new AjaxDataControls.TableItemStyle('', '', '', '', 'RowStyle', new AjaxDataControls.FontInfo('', '', '', '', ''), '', '', '', '', '', true),"sortOrderAscendingImageUrl":"Images/up.gif","sortOrderDescendingImageUrl":"Images/dn.gif"}, {"rowCommand":grdShipmentTrackRowCommand,"rowDataBound":grdShipmentTrackRowDataBound,"sortCommand":onSHTSortCommand}, null

  • 10-14-2009 11:36 AM In reply to

    • Sonu
    • Top 10 Contributor
    • Joined on 05-22-2006
    • Montreal / Canada
    • Slacker
    • Points 12,183
    • MVP

    Re: GridView Inside Repeater

    The best to get this working is to create a test page with just the gridview from the html markup, not using javascript. Then bind the grid using javascript with the data using the same array. Also make sure that the the column names match (they are case-sensitive). Once you are able to see the data, view the source from your browser to find the $create statement and you are ready to go.

    Let me know how it goes.

    [MVP since 2005] [MCAD]
    Webmaster of DotNetSlackers
    Question or Suggestion?
    Feel free to ask my any .NET question
    Our Posting FAQ
  • 10-14-2009 11:42 AM In reply to

    Re: GridView Inside Repeater

    That's exactly what I have done. The code that I have pasted is from the view source.

    Thanks.

    Rakesh

  • 10-14-2009 11:55 AM In reply to

    • Sonu
    • Top 10 Contributor
    • Joined on 05-22-2006
    • Montreal / Canada
    • Slacker
    • Points 12,183
    • MVP

    Re: GridView Inside Repeater

    And you dont see any errors in firebug? Have you defined all events that you have declared in the js?

    [MVP since 2005] [MCAD]
    Webmaster of DotNetSlackers
    Question or Suggestion?
    Feel free to ask my any .NET question
    Our Posting FAQ
  • 10-14-2009 2:34 PM In reply to

    Re: GridView Inside Repeater

     Yes I have defined all events. I tried removing all events from the $create() function. In firebug its giving me a "TypeError: h is not a constructor" error. It does not go thru the $create() i.e function (h,f,d,c,g)...

    Am I missing something?

    Thanks

    Rakesh

     

  • 10-14-2009 2:41 PM In reply to

    • Sonu
    • Top 10 Contributor
    • Joined on 05-22-2006
    • Montreal / Canada
    • Slacker
    • Points 12,183
    • MVP

    Re: GridView Inside Repeater

    Your best bet is to remove one column at a time and go through the trial/error process.

    [MVP since 2005] [MCAD]
    Webmaster of DotNetSlackers
    Question or Suggestion?
    Feel free to ask my any .NET question
    Our Posting FAQ
  • 10-14-2009 2:51 PM In reply to

    Re: GridView Inside Repeater

    Yes you right. The problem is with the

    $create(AjaxDataControls.GridViewButtonColumn... here GridViewButtonColumn = undefined, its not able to find the class name.

    For all other column types, if I hover my mouse in FireBug it shows me the function(...) details.

    I removed this column from the script and it worked.

    Is there a workaround for this? I need to add a button in the grid.

    Thanks

    Rakesh

  • 10-14-2009 2:53 PM In reply to

    • Sonu
    • Top 10 Contributor
    • Joined on 05-22-2006
    • Montreal / Canada
    • Slacker
    • Points 12,183
    • MVP

    Re: GridView Inside Repeater

    Its missing the gridview js files, which is why it cant see the GridViewButtonColumn. Can you add an empty Gridview to the page (hide it using css)?

    [MVP since 2005] [MCAD]
    Webmaster of DotNetSlackers
    Question or Suggestion?
    Feel free to ask my any .NET question
    Our Posting FAQ
  • 10-14-2009 3:11 PM In reply to

    Re: GridView Inside Repeater

    I do have multiple GridViews defined in design time on the page and they all work perfect.

    From where can I get the gridview.js file? I can attach the file to the page.

    Thanks

    Rakesh

  • 10-14-2009 3:19 PM In reply to

    • Sonu
    • Top 10 Contributor
    • Joined on 05-22-2006
    • Montreal / Canada
    • Slacker
    • Points 12,183
    • MVP

    Re: GridView Inside Repeater

    Do any of them contain the GridViewButton? Every column has a seperate js file. For test purpose can you re-create the same grid and hide it?

    You can find the source here:

    http://ajaxdatacontrols.codeplex.com/SourceControl/changeset/view/32283#177906

    [MVP since 2005] [MCAD]
    Webmaster of DotNetSlackers
    Question or Suggestion?
    Feel free to ask my any .NET question
    Our Posting FAQ
  • 10-14-2009 3:31 PM In reply to

    Re: GridView Inside Repeater

     Great. It worked.

    Thanks

    Rakesh

     

Page 1 of 1 (13 items)