This is a migrated thread and some comments may be shown as answers.

expand/collapse image button and DetailTableDataBind event

6 Answers 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
BSFLASHER
Top achievements
Rank 1
BSFLASHER asked on 09 Oct 2010, 08:25 PM
Hi Everybody
I'm using hierarchy radgrid with xml data binding. The child is binding dynamically with parent ID from a web service.

Now, I want to use expand/collapse image button , but when I changed my expand/collapse button the DetailTableDataBind event has not fired!  What I must do ?

If I use ItemCommand event, how can I find that my parent table expand/collapse image button is clicked ?

THANKS

P.S. : I need Telerik.Web.UI.GridDetailTableDataBindEventArgs in my code for binding child.



6 Answers, 1 is accepted

Sort by
0
BSFLASHER
Top achievements
Rank 1
answered on 11 Oct 2010, 09:37 AM
Is this a bug in radgrid? 
I read this posts :
http://www.telerik.com/community/code-library/aspnet-ajax/grid/custom-expand-collapse-column-with-expandall-collapseall-image-button-in-the-header.aspx

and

http://www.telerik.com/community/forums/aspnet-ajax/grid/change-expand-collapse-image-of-radgrid.aspx


but no one in these post answered my questions.

My question in one line :

How can we change the expand/collapse image button and firing DetailTableDataBind event ?
0
illumination
Top achievements
Rank 2
answered on 12 Oct 2010, 07:17 PM
Have you tried this code to bind the image button?
<telerik:GridEditCommandColumn ButtonType="ImageButton" EditText="Update" UpdateImageUrl="images/edit.gif" UniqueName="EditCommandColumn1">
</telerik:GridEditCommandColumn>   
  
<EditFormSettings EditFormType="WebUserControl" UserControlName="web.ascx">
                <EditColumn UniqueName="EditCommandColumn1" ></EditColumn>
</EditFormSettings
  
Protected Sub RadGridSearch_PreRender(ByVal sender As Object, ByVal e As EventArgs)
        For Each col As GridColumn In RadGridSearch.MasterTableView.RenderColumns
            If col.ColumnType = "GridEditCommandColumn" Then
                Dim editcol As GridEditCommandColumn = DirectCast(col, GridEditCommandColumn)
                editcol.EditImageUrl = "Images/edit.gif"
                editcol.UpdateImageUrl = "Images/edit.gif"
            End If
        Next
End Sub
Thanks.
0
BSFLASHER
Top achievements
Rank 1
answered on 13 Oct 2010, 07:15 AM
Thanks illumination

And Where is DetailTableDataBind event ??? :-(
0
illumination
Top achievements
Rank 2
answered on 13 Oct 2010, 01:26 PM
For DetailTableDataBind, you can see it here: Hierarchical data-binding using DetailTableDataBind event 
or if you are looking for specific control to search:
Private Sub RadGridSearchEmpID_DetailTableDataBind(ByVal source As Object, ByVal e As GridDetailTableDataBindEventArgs) Handles RadGridSearchEmpID.DetailTableDataBind
    Dim dataItem As GridDataItem = CType(e.DetailTableView.ParentItem, GridDataItem)
    Select Case e.DetailTableView.Name
        Case "Detail"
            If cboBYear.SelectedValue = 0 And cboDept.SelectedValue = 0 And cboCat.SelectedValue = 0 And cboRadSearch.SelectedItem.Text.ToString = "Employee ID" Then
                'Open the SqlConnection
                If SqlConnection.State <> ConnectionState.Open Then
                    SqlConnection.Open()
                End If
                Try
                    Dim EmpID As String = dataItem.GetDataKeyValue("EmployeeID").ToString()
                    e.DetailTableView.DataSource = SqlDsAllEmpID
                    RadGridSearchEmpID.Visible = True
                Finally
                    'Close the SqlConnection
                    If SqlConnection.State <> ConnectionState.Open Then
                        SqlConnection.Close()
                    End If
                End Try
         End If
    End Select
End Sub
Thanks.
0
BSFLASHER
Top achievements
Rank 1
answered on 13 Oct 2010, 05:53 PM
Thanks Again illumination !

But I must mention that I need both expand/collapse image button and DetailTableDataBind event in a sample!!! I created a grid with expand/collapse image button and also a grid with Hierarchical data-binding using DetailTableDataBind event .

NOW : I need a grid that has both of them! A grid with expand/collapse image button with DetailTableDataBind event !
Again I mention that  when you use an expand/collapse image button in a grid DetailTableDataBind event will not fire ! I think it is a telerik radgrid bug!

THANKS
0
BSFLASHER
Top achievements
Rank 1
answered on 19 Oct 2010, 11:33 AM
THANKS for great response from TELERIK SUPORT GROUP !!!
Tags
Grid
Asked by
BSFLASHER
Top achievements
Rank 1
Answers by
BSFLASHER
Top achievements
Rank 1
illumination
Top achievements
Rank 2
Share this question
or