Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
Custom bindings with DataSource
posted

 How make custom binding in UltraWeGrid (last version) like in this video http://www.asp.net/LEARN/3.5-videos/video-500.aspx

Thanks.

  • 175
    posted in reply to [Infragistics] Rumen Stankov

    Hi Rumen,

    I have also tried the ultrawebgrid + entitydatasource, I had no problem with them when performing basic bindings.

    Now I am experimenting the WebHierarchicalDatasource control, as I want to build a hierarchical gridview. I am facing a problem, the foreign keys in a table are not contained in the entity. This is an essential thing when configuring the WebHierarchicalDatasource control, when setting up the relatioships between the two datasources.

    For instance, being given two tables Customer (IDCustomer, CustomerName, IDOrder) and Orders (IDOrder, ProductName, Quantity, Date), the entities coresponding to these tables in the .edmx are Customer (IDCustomer, CustomerName) and Orders(IDOrder, ProductName, Quantity, Date). The IDOrder in Customer table is mapped at the entity model level as a Navigation Property for the Customer entity.

    With this example in mind, I want to ask you the following:

    1. can I setup a hierarchical gridview with the entitydatasource control? How?

    2. Does the latest Netadvantace for ASP.net libraries support the ado.net entity framework (entitydatasource control, linq queries etc.)?

     Thank you,

    C.

  • 28464
    posted

    Hello,

    This video features the newly introduce (in .NET SP1) EntityDataSource declarative datasource control. I played a bit with the control against UltraWebGrid and indeed, currently we do not support it out of the box.

    I played a bit with the new control and managed to make UltraWebGrid and EntityDataSource play nicely, you just need to disable to AllowPage and AllowSort properties of the EntityDataSource. This could either be a problem in the grid or most probably it is just me still trying to figure out how EntityDataSource works. In any case, I will talk to the development team and we willl make sure we fully support that.

    Here is my code - is this applicable in your case?

                <igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server"
                    Width="825px" oninitializedatasource="UltraWebGrid1_InitializeDataSource"
                    onpageindexchanged="UltraWebGrid1_PageIndexChanged"
                    DataSourceID="EntityDataSource1">
                    <Bands>
                        <igtbl:UltraGridBand>
                            <Columns>
                                <igtbl:UltraGridColumn BaseColumnName="Address" IsBound="True" Key="Address">
                                    <Header Caption="Address">
                                    </Header>
                                </igtbl:UltraGridColumn>
                                <igtbl:UltraGridColumn BaseColumnName="City" IsBound="True" Key="City">
                                    <Header Caption="City">
                                        <RowLayoutColumnInfo OriginX="1" />
                                    </Header>
                                    <Footer>
                                        <RowLayoutColumnInfo OriginX="1" />
                                    </Footer>
                                </igtbl:UltraGridColumn>
                                <igtbl:UltraGridColumn BaseColumnName="CompanyName" IsBound="True"
                                    Key="CompanyName">
                                    <Header Caption="CompanyName">
                                        <RowLayoutColumnInfo OriginX="2" />
                                    </Header>
                                    <Footer>
                                        <RowLayoutColumnInfo OriginX="2" />
                                    </Footer>
                                </igtbl:UltraGridColumn>
                                <igtbl:UltraGridColumn BaseColumnName="ContactName" IsBound="True"
                                    Key="ContactName">
                                    <Header Caption="ContactName">
                                        <RowLayoutColumnInfo OriginX="3" />
                                    </Header>
                                    <Footer>
                                        <RowLayoutColumnInfo OriginX="3" />
                                    </Footer>
                                </igtbl:UltraGridColumn>
                            </Columns>
                           
                            <RowTemplateStyle BackColor="White" BorderColor="White" BorderStyle="Ridge">
                                <BorderDetails WidthBottom="3px" WidthLeft="3px" WidthRight="3px"
                                    WidthTop="3px" />
                            </RowTemplateStyle>
                            <AddNewRow View="NotSet" Visible="NotSet">
                            </AddNewRow>
                        </igtbl:UltraGridBand>
                    </Bands>
                    <DisplayLayout BorderCollapseDefault="Separate" Name="UltraWebGrid1" AllowUpdateDefault="Yes"
                        RowHeightDefault="20px" Version="4.00">
                        <FrameStyle BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="8pt"
                            Width="825px">
                        </FrameStyle>
                        <ClientSideEvents  MouseDownHandler="AfterExitEditMode" />
                        <Pager>
                            <PagerStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px">
                                <BorderDetails ColorLeft="White" ColorTop="White" />
                            </PagerStyle>
                        </Pager>
                        <EditCellStyleDefault BorderStyle="None" BorderWidth="0px">
                        </EditCellStyleDefault>
                        <HeaderStyleDefault BackColor="LightGray" BorderStyle="Solid">
                            <BorderDetails ColorLeft="White" ColorTop="White" />
                        </HeaderStyleDefault>
                        <RowStyleDefault BackColor="White" BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px"
                            Font-Names="Verdana" Font-Size="8pt">
                            <Padding Left="3px" />
                            <BorderDetails ColorLeft="White" ColorTop="White" />
                        </RowStyleDefault>
                        <AddNewBox>
                            <BoxStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px">
                                <BorderDetails ColorLeft="White" ColorTop="White" />
                            </BoxStyle>
                        </AddNewBox>
                        <ActivationObject BorderColor="" BorderWidth="">
                        </ActivationObject>
                    </DisplayLayout>
                </igtbl:UltraWebGrid>


        <asp:EntityDataSource ID="EntityDataSource1" runat="server"
            AutoGenerateOrderByClause="True" AutoGenerateWhereClause="True"
            AutoPage="False" AutoSort="False" ConnectionString="name=NorthwindEntities"
            DefaultContainerName="NorthwindEntities" EntitySetName="Customers"
            Select="it.[Address], it.[City], it.[CompanyName], it.[ContactName]">
        </asp:EntityDataSource>