Site Search:
Sign in | Join | Help
4Penny.net

ComponentArt

September 2007 - Posts

  • Example of a grid inside of a callback control, populated with a dropdown list

    This example shows a form with a callback control, dropdown and a grid. Changing the dropdown causes the grid to repopulate without posting back. First the frontside code:

    <script type="text/javascript">
            function renderControl(param) { 
                <%= Callback1.ClientObjectId %>.Callback(param); 
            } 
        </script>
    
    
    <br ID="ddlGroup" runat="server" />
        <ComponentArt:CallBack ID="Callback1" runat="server" Debug="false" >
    
    
        <LoadingPanelClientTemplate>
                  <table cellspacing="20" cellpadding="0" border="0" style="background-color: White; border:solid 1px black ">
                      <tr>
                          <td style="font-size: 10px;">
                              Loading...&nbsp;</td>
                          <td>
                              </td alt="loading..." src="../images/spinner.gif" width="16" height="16" border="0">
                      </tr>
                  </table>
        </LoadingPanelClientTemplate>
    
        </ComponentArt:CallBack>
    
    
    
        <ComponentArt:Grid id="Grid1" Visible="false"
            PreExpandOnGroup="true" 
            RunningMode="Callback"
            EnableViewState="false"
            EditOnClickSelectedItem="false"
            AllowEditing="true"
            AutoCallBackOnInsert="true"
            AutoCallBackOnUpdate="true"
            AutoCallBackOnDelete="true"
            ShowHeader="False"
            CssClass="Grid"
            LoadingPanelClientTemplateId="LoadingFeedbackTemplate"
            LoadingPanelPosition="MiddleCenter"
    
    
            ShowFooter="true" FooterCssClass="GridFooter2"
            IndentCellWidth="19"
            IndentCellCssClass="IndentCell"
            TreeLineImageWidth="22"
            TreeLineImageHeight="19"
            PageSize="15" 
            PagerStyle="Numbered" 
            PagerTextCssClass="PagerText"
            ImagesBaseUrl="~/images/"
            TreeLineImagesFolderUrl="~/images/lines/" 
            Width="500"
            runat="server" >
            <Levels>
              <ComponentArt:GridLevel
              
                ShowTableHeading="false"
                SortImageWidth="10"
                SortImageHeight="10"
                EditCellCssClass="EditDataCell"
                EditFieldCssClass="EditDataField"
    
    
                DataMember="Header"
                DataKeyField="lRowID" 
                SelectedRowCssClass="SelectedRow" 
                HeadingTextCssClass="HeadingText"
                HeadingCellCssClass="HeadingCell"
                RowCssClass="Row"
                HeadingRowCssClass="HeadingRow"
                TableHeadingCssClass="TableHeading"
                GroupHeadingCssClass="TableHeading"
                SortDescendingImageUrl="desc.gif"
                SortAscendingImageUrl="asc.gif"
                DataCellCssClass="DataCell"
                ShowSelectorCells="false">
                  <Columns>
                    <ComponentArt:GridColumn AllowEditing="false" DataField="lRowID" visible="false"  />
                    <ComponentArt:GridColumn AllowEditing="false" DataField="sObjectName"  />
                    <ComponentArt:GridColumn AllowEditing="false" DataField="fullPerms" HeadingText="Form Name"  />
                    <ComponentArt:GridColumn AllowEditing="false" DataField="readPerms" HeadingText="Form Name"  />
                  </Columns>
              </ComponentArt:GridLevel>
    
    
            </Levels>
        </ComponentArt:Grid>

    Then the code behind:

    Imports System.Data
    
    
    Partial Class utilities_test
        Inherits System.Web.UI.Page
        Dim ofacHierarchy As New dynDataOld.facHierarchy
        Dim ofacGroups As New dynDataOld.facGroups
        Dim mintGroupID As String
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    
    
            'set the connection string on the data factory
            ofacGroups.ConnectionString = Session("connect")
            ofacHierarchy.ConnectionString = Session("connect")
    
    
            mintGroupID = 23
    
    
    
            If Not Page.IsPostBack Then
                buildCombo()
                Me.ddlGroup.Attributes.Add("onchange", "renderControl(this.options[this.selectedIndex].value)")
            End If
        End Sub
        Sub buildCombo()
            Me.ddlGroup.DataSource = ofacGroups.OEDGroups_SEL
            Me.ddlGroup.DataValueField = "lRowID"
            Me.ddlGroup.DataTextField = "sGroupName"
            Me.ddlGroup.DataBind()
    
    
        End Sub
        Sub buildGrid(ByVal intGroupID As System.Int16)
            'bind the datagrid
            Dim oDT As DataTable
            Dim oTable1 As DataTable
            oDT = ofacHierarchy.OEDHierarchy_SEL_byGroupL2(intGroupID)
            oTable1 = oDT.Copy
            oTable1.TableName = "Header"
    
    
            Dim dsSrc As New DataSet
            dsSrc.Tables.Add(oTable1)
    
    
            Grid1.DataSource = dsSrc
            Grid1.DataBind()
        End Sub
        Public Sub CallBack1_Callback(ByVal sender As Object, ByVal e As ComponentArt.Web.UI.CallBackEventArgs) Handles Callback1.Callback
            Grid1.Visible = True
            buildGrid(e.Parameter)
            Grid1.RenderControl(e.Output)
    
    
        End Sub
    
    
    End Class
    
    
    
     

  • Example of a grid with a slider

     <componentart:grid 
        id="grid1"  AllowMultipleSelect="false" 
        RunningMode="Client" CssClass="Grid" 
        ShowHeader="false"
        SearchTextCssClass="GridHeaderText" 
        HeaderCssClass="GridHeader" 
        FooterCssClass="GridFooter"
        GroupByCssClass="GroupByCell" 
        GroupByTextCssClass="GroupByText" 
        PageSize="15"
        GroupingPageSize="5"
        PreExpandOnGroup="true" 
        ImagesBaseUrl="../images/" 
        TreeLineImagesFolderUrl="~/images/lines/"
        TreeLineImageWidth="22" 
        TreeLineImageHeight="19" 
        IndentCellWidth="22" 
        GroupingNotificationTextCssClass="GridHeaderText"
        GroupBySortAscendingImageUrl="group_asc.gif" 
        GroupBySortDescendingImageUrl="group_desc.gif"
        GroupBySortImageWidth="10" 
        GroupBySortImageHeight="10" 
    
    
        width="600px" 
    
    
        PagerStyle="Slider"
        PagerTextCssClass="GridFooterText"
        PagerButtonWidth="44"
        PagerButtonHeight="26"
        PagerButtonHoverEnabled="true"
        SliderHeight="26"
        SliderWidth="150"
        SliderGripWidth="9"
        SliderPopupOffsetX="80"
        SliderPopupClientTemplateId="SliderTemplate"
        SliderPopupCachedClientTemplateId="CachedSliderTemplate"
        PagerImagesFolderUrl="~/images/pager/"
      
        runat="server">
        <Levels>
            <ComponentArt:GridLevel 
                DataKeyField="itemnmbr"  
                ShowTableHeading="false" 
                ShowSelectorCells="false"
                ColumnReorderIndicatorImageUrl="reorder.gif" 
                AllowGrouping="false" 
                SortAscendingImageUrl="asc.gif" 
                SortDescendingImageUrl="desc.gif" 
                SortImageWidth="10"
                SelectorCellWidth="18" 
                SelectorImageUrl="selector.gif"
                SelectorImageWidth="17" 
                SelectorImageHeight="15" 
                EditCellCssClass="EditDataCell" 
                EditFieldCssClass="EditDataField" 
                EditCommandClientTemplateId="EditCommandTemplate"
                
                
                RowCssClass="Row" 
                DataCellCssClass="DataCell"
                HeadingCellCssClass="HeadingCell" 
                HeadingCellHoverCssClass="HeadingCellHover"
                HeadingCellActiveCssClass="HeadingCellActive" 
                HeadingRowCssClass="HeadingRow"
                HeadingTextCssClass="HeadingCellText" 
                SelectedRowCssClass="SelectedRow" 
                GroupHeadingCssClass="GroupHeading"
    
    
    
                SortImageHeight="19">
                <Columns>
                    <ComponentArt:GridColumn DataField="itemnmbr" AllowEditing="False" HeadingText="Item Number" />
                    <ComponentArt:GridColumn DataField="itemCount" AllowEditing="False" HeadingText="Item Count"  />
                    <ComponentArt:GridColumn DataField="SFHoldsCount" AllowEditing="False" HeadingText="SF Holds count"  />
                    <ComponentArt:GridColumn DataCellServerTemplateId="LinkButtonTemplate" />
                </Columns>
            </ComponentArt:GridLevel>
        </Levels>
    
    
        <ClientTemplates>
            <ComponentArt:ClientTemplate ID="ClientTemplate1" >
                <table class="SliderPopup" width="300px" style="background-color: #fffacd" cellspacing="10"
                    cellpadding="0" border="0">
                    <tr>
                        <td>
                            <nobr style="overflow:hidden;width:250px;">## DataItem.GetMember('itemnmbr').Value ##</div>
                        </td>
                    </tr>
                    <tr>
                        <td valign="middle" align="center">
                            Page <b>## DataItem.PageIndex + 1 ##</b> of <b>## gridex1.PageCount ##</b>
                        </td>
                    </tr>
                </table>
            </ComponentArt:ClientTemplate>
        </ClientTemplates>
        <ServerTemplates>
            <ComponentArt:GridServerTemplate Id="GridServerTemplate1">
                <template>
                    <asp:LinkButton ID="lbtnEdit" Runat="server" text="Edit" Visible='true' CommandName="edit" CommandArgument='<%# Container.DataItem("itemnmbr") %>' />
                </template>
            </ComponentArt:GridServerTemplate>
        </ServerTemplates>
    </componentart:grid>