Binding data to grid

Posts   
 
    
Rishi
User
Posts: 69
Joined: 31-Oct-2011
# Posted on: 09-Dec-2011 20:47:08   

Hi,

I wanted to know how i can bind data from two separate entities into LLBLGen data source. essentially, i need to bind data to grid.

Thanks in advance

Rishi

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 09-Dec-2011 22:17:39   

You can only bind a LLBLGenProDataSource to one factory. So, if you want to make something more complex you can design a TypedList and then use that typedList in the LLBLGenProDS.

David Elizondo | LLBLGen Support Team
Rishi
User
Posts: 69
Joined: 31-Oct-2011
# Posted on: 09-Dec-2011 23:40:43   

Hi,

 I have created TypedList and bind to LLBLGenPro Datasource, but grid is not displaying any data? does column Name/number of grid and typedlist should match? any other things cause this issue?

Well i am not getting any error, data is populating fine from database.

Rishi

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 10-Dec-2011 01:10:45   

It should work just fine. Please post the declarative aspx for the LLBLGenProDataSource and the grid, and any relevant code behind.

David Elizondo | LLBLGen Support Team
Rishi
User
Posts: 69
Joined: 31-Oct-2011
# Posted on: 12-Dec-2011 16:29:16   

Please find enclosed code for your review..

ASCX Code:

<llblgenpro:LLBLGenProDataSource2 ID="LLBLGenProDataSource1" runat="server" AdapterTypeName="Grb.Framework.Business.Lower.DatabaseSpecific.DataAccessAdapter, Grb.Framework.Business.LowerDBSpecific, Version=1.2.1.18, Culture=neutral, PublicKeyToken=9194599970cc4016" DataContainerType="EntityCollection" EntityFactoryTypeName="Grb.Framework.Business.Lower.FactoryClasses.EmpFormXfdfEntityFactory, Grb.Framework.Business.Lower, Version=1.2.1.18, Culture=neutral, PublicKeyToken=9194599970cc4016" LivePersistence="False"> </llblgenpro:LLBLGenProDataSource2>

<igtbl:UltraWebGrid ID="ListUltraWebGrid" runat="server" Width="746px" Height="271px" Caption="Forms" CaptionAlign="Top" TabIndex="4" Browser="Xml" EnableViewState="False"> <DisplayLayout ColWidthDefault="30px" LoadOnDemand="Xml" RowHeightDefault="20px" Version="4.00" SelectTypeRowDefault="Single" BorderCollapseDefault="Separate" RowSelectorsDefault="No" Name="ctl00xListUltraWebGrid" AutoGenerateColumns="False" GridLinesDefault="Horizontal" ExpandableDefault="No" ScrollBar="Never" CellClickActionDefault="Edit" NoDataMessage="No Rows To Display" TableLayout="Fixed" Section508Compliant="True" SelectTypeCellDefault="Single"> <ActivationObject BorderColor="" BorderWidth="0px"> <BorderDetails ColorBottom="197, 210, 219" StyleBottom="Solid" WidthBottom="1px" /> </ActivationObject> <RowStyleDefault CssClass="griddefaultrow"> </RowStyleDefault> <FilterOptionsDefault> <FilterDropDownStyle BackColor="White" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px" CustomRules="overflow:auto;" Font-Names="Verdana,Arial,Helvetica,sans-serif" Font-Size="11px" Width="200px"> <Padding Left="2px" /> </FilterDropDownStyle> <FilterHighlightRowStyle BackColor="#151C55" ForeColor="White"> </FilterHighlightRowStyle> </FilterOptionsDefault> <ClientSideEvents CellClickHandler="ListUltraWebGrid_CellClickHandler" InitializeLayoutHandler="ListUltraWebGrid_InitializeLayoutHandler" AfterXmlHttpResponseProcessed="ListUltraWebGrid_AfterXmlHttpResponseProcessed" BeforeXmlHttpRequest="ListUltraWebGrid_BeforeXmlHttpRequest" XmlHTTPResponseHandler="ListUltraWebGrid_XmlHTTPResponseHandler" AfterCellUpdateHandler="ListUltraWebGrid_AfterCellUpdateHandler" /> <HeaderStyleDefault CssClass="gridheader" CustomRules="font-weight: bold;"> </HeaderStyleDefault> <FrameStyle Width="746px" Height="271px" CssClass="gridframes"> </FrameStyle> <Pager PageSize="12" AllowPaging="True" Pattern=" "> </Pager> </DisplayLayout> <Bands> <igtbl:UltraGridBand> <Columns> <igtbl:UltraGridColumn BaseColumnName="ID" DataType="System.Int32" Hidden="True" Key="ID"> <Header Caption=""> </Header> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="Guid" DataType="System.Guid" Hidden="True" Key="Guid"> <Header Caption=""> <RowLayoutColumnInfo OriginX="1" /> </Header> <CellStyle CssClass="griddefaultrow" /> <Footer> <RowLayoutColumnInfo OriginX="1" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn Key="Status" Width="0px"> <Header> <RowLayoutColumnInfo OriginX="2" /> </Header> <CellStyle CssClass="griddefaultrow" /> <Footer> <RowLayoutColumnInfo OriginX="2" /> </Footer> </igtbl:UltraGridColumn> <igtbl:TemplatedColumn AllowUpdate="Yes" DataType="" Key="Delete" Type="CheckBox" Width="30px"> <HeaderTemplate> <input id="DeleteCheckBox" style="text-align: left;" onclick="SetAllDeleteCheckBoxes(null);" type="checkbox" /> </HeaderTemplate> <Header> <RowLayoutColumnInfo OriginX="3" /> </Header> <CellStyle CssClass="griddefaultrow" /> <Footer> <RowLayoutColumnInfo OriginX="3" /> </Footer> </igtbl:TemplatedColumn> <igtbl:UltraGridColumn BaseColumnName="LastUpdatedTimestamp" Format="MM/dd/yyyy hh:mm:ss tt" Key="LastUpdatedTimestamp" Width="146px"> <Header Caption="Date/Time Modified"> <RowLayoutColumnInfo OriginX="4" /> </Header> <CellStyle TextOverflow="Ellipsis" CssClass="griddefaultrow" /> <Footer> <RowLayoutColumnInfo OriginX="4" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="Type" Key="Type" Width="236px"> <Header Caption="Form Type"> <RowLayoutColumnInfo OriginX="5" /> </Header> <CellStyle TextOverflow="Ellipsis" CssClass="griddefaultrow" /> <Footer> <RowLayoutColumnInfo OriginX="5" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="TypeName" Key="TypeName" Hidden="True"> <Header Caption=""> <RowLayoutColumnInfo OriginX="6" /> </Header> <CellStyle TextOverflow="Ellipsis" CssClass="griddefaultrow" /> <Footer> <RowLayoutColumnInfo OriginX="6" /> </Footer> </igtbl:UltraGridColumn> <igtbl:UltraGridColumn BaseColumnName="Name" Key="Name" Width="325px" AllowUpdate ="Yes" EditorControlID = "DescriptionEdit" Type="Custom"> <SelectedCellStyle BackColor="White"> </SelectedCellStyle> <Header Caption="Description"> <RowLayoutColumnInfo OriginX="7" /> </Header> <CellStyle TextOverflow="Ellipsis" CssClass="griddefaultrow" /> <Footer> <RowLayoutColumnInfo OriginX="7" /> </Footer> </igtbl:UltraGridColumn> </Columns> <AddNewRow View="NotSet" Visible="NotSet"> </AddNewRow> <RowEditTemplate> </RowEditTemplate> <FilterOptions AllString="" EmptyString="" NonEmptyString=""> <FilterDropDownStyle BorderWidth="1px" BorderColor="Silver" BorderStyle="Solid" Font-Size="11px" Font-Names="Verdana,Arial,Helvetica,sans-serif" BackColor="White" Width="200px" CustomRules="overflow:auto;"> <Padding Left="2px"></Padding> </FilterDropDownStyle> <FilterHighlightRowStyle ForeColor="White" BackColor="#151C55"> </FilterHighlightRowStyle> </FilterOptions> <RowTemplateStyle BorderColor="White" BorderStyle="Ridge" BackColor="White"> <BorderDetails WidthRight="3px" WidthLeft="3px" WidthTop="3px" WidthBottom="3px"> </BorderDetails> </RowTemplateStyle> </igtbl:UltraGridBand> </Bands> </igtbl:UltraWebGrid>

vb Code

Private Sub UltraWebGrid1_InitializeDataSource(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.UltraGridEventArgs) _ Handles ListUltraWebGrid.InitializeDataSource

  Me.ListUltraWebGrid.DataSourceID = Me.LLBLGenProDataSource1.ID

End Sub

Protected Sub LLBLGenProDataSource1_PerformSelect(ByVal sender As Object, ByVal e As SD.LLBLGen.Pro.ORMSupportClasses.PerformSelectEventArgs2) Handles LLBLGenProDataSource1.PerformSelect

Dim formList As Grb.Framework.Business.Lower.TypedListClasses.TestTypedList = GetEmpFormXfdTypedView(m_EmployeeId)

Me.LLBLGenProDataSource1.TypedList = formList

End Sub

Public Function GetEmpFormXfdTypedView(ByVal employeeId As Integer) As Grb.Framework.Business.Lower.TypedListClasses.TestTypedList

Dim empFormXfdfTemplete As New Grb.Framework.Business.Lower.TypedListClasses.TestTypedList
Try

  Dim bucket As SD.LLBLGen.Pro.ORMSupportClasses.IRelationPredicateBucket = empFormXfdfTemplete.GetRelationInfo()
  bucket.PredicateExpression.AddWithAnd(Grb.Framework.Business.Lower.HelperClasses.EmpFormXfdf_Fields.EmployeeId = employeeId)

  Using adapter As New Grb.Framework.Business.Lower.DatabaseSpecific.DataAccessAdapter(m_DataManager.ConnectionString)
    adapter.FetchTypedList(empFormXfdfTemplete)
    adapter.CloseConnection()
  End Using

Catch ex As Exception
  Throw New Grb.Framework.Core.Exceptions.PlugInBusinessException(Resources.ExceptionMessages.GetEmployeeReport, ex)
End Try

Return empFormXfdfTemplete

End Function

Let me know if you have any questions...

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 12-Dec-2011 17:01:39   

You have defined the DataContainerType of the DataSOurce to be a "EntityCollection". But you are fetching data into the DataSource's TypedList, that why nothing gets bound.

Rishi
User
Posts: 69
Joined: 31-Oct-2011
# Posted on: 12-Dec-2011 19:57:51   

ok my bad, Thanks for catching that...