in
Forums
Blogs
Files
Devexpress.Com
ClientCenter
Support Center
DevExpress Channel

Access to a particular DetailRow Data when I click a custom buttom - Container.VisibleIndex

Last post 8/21/2008 1:00 PM by Rod Nav. 4 replies.
Page 1 of 1 (5 items)
Sort Posts:
Previous Next
  • 8/20/2008 8:06 AM

    Access to a particular DetailRow Data when I click a custom buttom - Container.VisibleIndex

    Hello!

    I'm currently evaluating your tools, i want to access a DetailRow Data when a click a buttom. I undestand that the way you can access the information is providing the visibleIndex to methods like "FindFooterCellTemplateControl", so i can get a specific detail Grid, and then access to its data.

    I saw an example in this post..:

    http://community.devexpress.com/forums/p/56589/190783.aspx#190783

    and i'm running into the following problem. If i do something like this: (into a DetailRow,..)

    <dxwgv:GridViewDataTextColumn FieldName="Color" VisibleIndex="1">

    <FooterTemplate>
    <asp:Button ID="btnSave" Style="float: right" CssClass="button" runat="server" Text="Save"  onClientclick=' masterGrid.PerformCallback(<%# Container.VisibleIndex%>)' />
     </FooterTemplate>

    </dxwgv:GridViewDataTextColumn>

    Then i get an error telling me that the FooterCellTemplate does not have a member called VisibleIndex... 

    But i dont know if i'm being pointed in the right direction..

     

    What i need is to access to a detailRow particular data when i Click on a custom button that is inside of the DetailRow.

     

    Thanks about any help!!

    -Rod

     

     

  • 8/20/2008 9:41 AM In reply to

    Re: Access to a particular DetailRow Data when I click a custom buttom - Container.VisibleIndex

     Hi Rod,

    You can do the following:

    protected void ASPxGridView1_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e) {

        if (e.RowType == GridViewRowType.Detail) {

            ASPxButton btn = ASPxGridView1.FindDetailRowTemplateControl(e.VisibleIndex, "ASPxButton3") as ASPxButton;

            btn.ClientSideEvents.Click = string.Format("function(s, e) {{ grid.PerformCallback({0});}}", e.VisibleIndex);

        }           

    }

    Thanks, Nathan.
    R&D, .NET Team, Developer Express Inc.
    P.S. If you wish to receive direct assistance from our Support Team, use Support Center at http://www.devexpress.com/Support/Center
  • 8/20/2008 2:01 PM In reply to

    Re: Access to a particular DetailRow Data when I click a custom buttom - Container.VisibleIndex

    Hi Nathan!!, how are you ? :)

    Thanks about the two time and quick help!! :)

    But i'm running into the following :(..

    If i Do the next call in the HTML_ROW_CREATED:

     Dim btn As ASPxButton = TryCast(ASPxGridView1.FindDetailRowTemplateControl(e.VisibleIndex, "ASPxButton1"), ASPxButton ) 'yes! The AspxButtonID is ASPxButton1 :)

    as you said..  then i get nothing..  

    If I do:

    Dim bx As ASPxButton = dg.FindFooterCellTemplateControl(dg.Columns("Total"), "ASPxButton1")

    Where DG is the detail row.. Then i get a pointer to the control! But with no success doing this:

    bx.ClientSideEvents.Click = String.Format("function(s, e) {{ grid.PerformCallback({0});}}", e.VisibleIndex)

    It's simply dont update the ClientSide Event.. and never fires the onCallBack event :(..

     

    Because the code worth more than 1000 words :), This's my code:

    VB-------------

    Protected Sub ASPxGridView1_HtmlRowCreated(ByVal sender As Object, ByVal e As ASPxGridViewTableRowEventArgs)

            If e.RowType = GridViewRowType.Detail Then
                Dim dg As ASPxGridView = ASPxGridView1.FindDetailRowTemplateControl(e.VisibleIndex, "detailGrid")

                Dim bx As ASPxButton = dg.FindFooterCellTemplateControl(dg.Columns("Total"), "ASPxButton1")

                bx.ClientSideEvents.Click = String.Format("function(s, e) {{ grid.PerformCallback({0});}}", e.VisibleIndex) 'works but, it didnt make the button perform any action..

                'Dim btn As ASPxButton = TryCast(ASPxGridView1.FindDetailRowTemplateControl(e.VisibleIndex, "ASPxButton1"), ASPxButton) 'returns me Nothing..
                'btn.ClientSideEvents.Click = String.Format("function(s, e) {{ grid.PerformCallback({0});}}", e.VisibleIndex) 'wont work if i get nothing from the previous...
            End If

        End Sub

     

    ASPX--------

    <dxwgv:ASPxGridView KeyFieldName="keyField" ID="ASPxGridView1" runat="server" AutoGenerateColumns="True"
                            Width="100%" ClientInstanceName="grid" SettingsPager-PageSize="100" DataSourceID="SqlDataSource1"
                            OnHtmlRowCreated = "ASPxGridView1_HtmlRowCreated"
                            OnCustomButtonCallback = "CustomCallBack"
                            >

    (...)

     <DetailRow>

     <dxwgv:ASPxGridView ID="detailGrid" runat="server" DataSourceID="detailDataSource"
                                         Style="border:1px solid black"
                                        KeyFieldName="keyField" Width="100%" AutoGenerateColumns="false"
                                        Settings-ShowFooter="true"
                                        OnBeforePerformDataSelect="detailGrid_DataSelect" >

    (...)

    <Columns>

    (....)

    <dxwgv:GridViewDataTextColumn FieldName="Total" VisibleIndex="5" FooterCellStyle-HorizontalAlign="right">
                                                <PropertiesTextEdit DisplayFormatString="c">
                                                </PropertiesTextEdit>
                                                <FooterTemplate>
                                                    
                                                    <dxe:ASPxButton id="ASPxButton1" runat="server" Text="Save2" ></dxe:ASPxButton>
     
                                                </FooterTemplate>
                                            </dxwgv:GridViewDataTextColumn>
                                        </Columns>

    <SettingsDetail AllowOnlyOneMasterRowExpanded="True" IsDetailGrid="True" ShowDetailButtons="False" />
                                    </dxwgv:ASPxGridView>
                                </DetailRow>

    (...)

     

    I'm I missing something?..

    Thank again Nathan.

     

     

     

     

  • 8/21/2008 1:31 AM In reply to

    Re: Access to a particular DetailRow Data when I click a custom buttom - Container.VisibleIndex

     Hi,

    It's better to handle the HtmlRowPrepared event. I've made a sample project for you. Please see it.

    Thanks, Nathan.
    R&D, .NET Team, Developer Express Inc.
    P.S. If you wish to receive direct assistance from our Support Team, use Support Center at http://www.devexpress.com/Support/Center
  • 8/21/2008 1:00 PM In reply to

    Re: Access to a particular DetailRow Data when I click a custom buttom - Container.VisibleIndex

    Hi Nathan!

    Thanks!, exellent way to sell your products :).

    Take Care.

    -Rod

     

Page 1 of 1 (5 items)
Copyright © 1998-2008 Developer Express Inc.
ALL RIGHTS RESERVED