Helo,
first I build my RadGrids in a normal asp.net page, and it works all fine.
Now I will use this page as a userControl, but nmow the events ItemCreated and ItemDataBound doesn't fire.
What is the reason for this?
(I build the grid codebehind and we use the RadTab)
thanks
Christian
first I build my RadGrids in a normal asp.net page, and it works all fine.
Now I will use this page as a userControl, but nmow the events ItemCreated and ItemDataBound doesn't fire.
What is the reason for this?
(I build the grid codebehind and we use the RadTab)
thanks
Christian
9 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 23 Mar 2009, 10:43 AM
Hi Christian,
The ItemDataBound/ItemCreated event of the RadGrid will fire independent of whether the Grid is in aspx or ascx. I would suggest you to send your ascx code and ascx.cs code so that I can check how you are dynamically adding the Grid.
Princy.
The ItemDataBound/ItemCreated event of the RadGrid will fire independent of whether the Grid is in aspx or ascx. I would suggest you to send your ascx code and ascx.cs code so that I can check how you are dynamically adding the Grid.
Princy.
0
Christian
Top achievements
Rank 1
answered on 23 Mar 2009, 11:46 AM
This is th code:
Background
We work with RadTabs to build a workflow, the Radgrid must shown in the last, the 3. RadTab and shows the data which are selected in the RadTabs before.
This means, that I first can get the DataTable from the database iwehn I have all the data from the Tab one and Tab two, so I can't build the RadGrid in the Page_init Event of the page. And thats why the events ItemCreated and ItemDataBound doesn't fire when I call the Tab with the RadGrid for the first time.
None of the event fires :-(
Christian
Background
We work with RadTabs to build a workflow, the Radgrid must shown in the last, the 3. RadTab and shows the data which are selected in the RadTabs before.
This means, that I first can get the DataTable from the database iwehn I have all the data from the Tab one and Tab two, so I can't build the RadGrid in the Page_init Event of the page. And thats why the events ItemCreated and ItemDataBound doesn't fire when I call the Tab with the RadGrid for the first time.
Public Sub Fill() |
' get Data in Dataset: CursorData |
CreateGrid(0) |
CreateGrid(1) |
CreateGrid(3) |
CreateGrid(4) |
End Sub |
Private Sub CreateGrid(ByVal Index As Integer) |
Dim templateColumn As GridTemplateColumn |
Dim boundColumn As GridBoundColumn |
Dim boundColumnHyperLink As GridHyperLinkColumn |
Dim g As New com.regiocom.Web.UI.WebControls.TelerikGrid |
With g |
.AutoSave = False |
.ID = "RG" & CStr(Index).Trim |
.SkinID = "List" |
.DataSource = CursorData |
.MasterTableView.SortExpressions.AllowNaturalSort = False |
.AllowSorting = True |
.AllowFilteringByColumn = True |
.Width = Unit.Percentage(100) |
.AutoGenerateColumns = False |
.ShowGroupPanel = False |
.ShowFooter = False |
.AllowPaging = False |
.PageSize = 100000 '17 |
.HeaderStyle.Width = Unit.Pixel(1) |
.GroupingEnabled = True |
End With |
With g.ClientSettings |
.EnableRowHoverStyle = False |
.AllowDragToGroup = True |
.AllowExpandCollapse = True |
.AllowGroupExpandCollapse = True |
.Scrolling.ScrollHeight = Unit.Pixel(412) |
.Scrolling.SaveScrollPosition = True |
.Scrolling.AllowScroll = False |
.ClientEvents.OnGridCreated = "GridCreated" & CStr(Index).Trim |
.ClientEvents.OnMasterTableViewCreated = "hide_MasterApp_Updateprogress" |
.ClientEvents.OnScroll = "Scroll" & CStr(Index).Trim |
End With |
With g.HeaderStyle |
.Width = Unit.Pixel(170) |
End With |
With g.MasterTableView |
.CssClass = "MasterTable" |
.DataKeyNames = New String() {"DPU_ZEILENNR"} |
.CommandItemDisplay = GridCommandItemDisplay.None |
.GroupLoadMode = GridGroupLoadMode.Server |
End With |
With g.MasterTableView.RowIndicatorColumn |
.UniqueName = "RowIndicator" |
.Visible = False |
.HeaderStyle.Width = Unit.Pixel(20) |
End With |
If Index = 0 Then |
templateColumn = New GridTemplateColumn |
templateColumn.UniqueName = "Images" |
templateColumn.HeaderText = "" |
templateColumn.HeaderStyle.Width = Unit.Pixel(50) |
g.MasterTableView.Columns.Add(templateColumn) |
boundColumnHyperLink = New GridHyperLinkColumn |
boundColumnHyperLink.Target = "_blank" |
boundColumnHyperLink.Display = True |
boundColumnHyperLink.Text = "Details" |
boundColumnHyperLink.HeaderText = " " |
boundColumnHyperLink.UniqueName = "HyperlinkColumn" |
boundColumnHyperLink.HeaderStyle.Width = Unit.Pixel(50) |
g.MasterTableView.Columns.Add(boundColumnHyperLink) |
boundColumn = New GridBoundColumn |
boundColumn.DataField = "NEU_FLAG" |
boundColumn.UniqueName = "NEU_FLAG" |
boundColumn.Visible = False |
g.MasterTableView.Columns.Add(boundColumn) |
boundColumn = New GridBoundColumn |
boundColumn.DataField = "DIFF_FLAG" |
boundColumn.UniqueName = "DIFF_FLAG" |
boundColumn.Visible = False |
g.MasterTableView.Columns.Add(boundColumn) |
boundColumn = New GridBoundColumn |
boundColumn.DataField = "IMP_MATCHINGFELD_WERT" |
boundColumn.UniqueName = "IMP_MATCHINGFELD_WERT" |
boundColumn.HeaderText = "MatchingFeld" |
boundColumn.Visible = False |
g.MasterTableView.Columns.Add(boundColumn) |
End If |
If Index = 1 Then |
Dim spaltenNameFeld As String = "Feldname" |
Dim spaltenNameInDatatable As String = "" |
Dim spaltenName As String = "IMP_IMP_MATCHINGFELD" |
If m_FeldDictionary.ContainsKey(9999) Then |
spaltenName = m_FeldDictionary.Item(9999).impSpalteName |
End If |
Dim gridColumn As New RadGridDropDownFunctions.MyCustomFilteringColumn() |
gridColumn.DataField = "IMP_MATCHINGFELD_WERT" |
gridColumn.UniqueName = "IMP_MATCHINGFELD_WERT" |
gridColumn.HeaderText = spaltenName |
gridColumn.HeaderStyle.Width = Unit.Pixel(140) |
gridColumn.ListDataSource = GetDropDownListItems(CursorData, "IMP_MATCHINGFELD_WERT", Nothing, "IMP_MATCHINGFELD_WERT") |
g.MasterTableView.Columns.Add(gridColumn) |
AddHandler gridColumn.ClearFilter, AddressOf ClearFilter |
End If |
If Index = 4 Then |
Dim spaltenName As String = "Feldname" |
Dim spaltenNameInDatatable As String = "" |
If m_FeldDictionary.ContainsKey(CInt(m_P_fieldid)) Then |
spaltenName = m_FeldDictionary.Item(CInt(m_P_fieldid)).impSpalteName |
spaltenNameInDatatable = m_FeldDictionary.Item(CInt(m_P_fieldid)).impSpalteDatatable |
End If |
Dim gridColumn As New RadGridDropDownFunctions.MyCustomFilteringColumn() |
gridColumn.DataField = spaltenNameInDatatable |
gridColumn.UniqueName = spaltenNameInDatatable |
gridColumn.HeaderText = spaltenName |
gridColumn.HeaderStyle.Width = Unit.Pixel(140) |
gridColumn.ListDataSource = GetDropDownListItems(CursorData, spaltenNameInDatatable, Nothing, spaltenNameInDatatable) |
g.MasterTableView.Columns.Add(gridColumn) |
AddHandler gridColumn.ClearFilter, AddressOf ClearFilter |
templateColumn = New GridTemplateColumn |
templateColumn.UniqueName = "Auswahl" |
templateColumn.HeaderText = "Auswahl" |
templateColumn.HeaderStyle.Width = Unit.Pixel(91) |
g.MasterTableView.Columns.Add(templateColumn) |
boundColumn = New GridBoundColumn |
boundColumn.DataField = "Aenderung_flag" |
boundColumn.UniqueName = "Aenderung_flag" |
boundColumn.Visible = False |
g.MasterTableView.Columns.Add(boundColumn) |
boundColumn = New GridBoundColumn |
boundColumn.DataField = "NEU_FLAG" |
boundColumn.UniqueName = "NEU_FLAG" |
boundColumn.Visible = False |
g.MasterTableView.Columns.Add(boundColumn) |
spaltenName = "Feldname" |
spaltenNameInDatatable = "" |
If m_FeldDictionary.ContainsKey(CInt(m_P_fieldid)) Then |
spaltenName = m_FeldDictionary.Item(CInt(m_P_fieldid)).intSpaltenName |
spaltenNameInDatatable = m_FeldDictionary.Item(CInt(m_P_fieldid)).intSpalteDatatable |
End If |
Dim gridColumn2 As New RadGridDropDownFunctions.MyCustomFilteringColumn(True, spaltenNameInDatatable, spaltenName) |
gridColumn2.DataField = spaltenNameInDatatable |
gridColumn2.UniqueName = spaltenNameInDatatable |
gridColumn2.HeaderText = spaltenName |
gridColumn2.HeaderStyle.Width = Unit.Pixel(140) |
gridColumn2.ListDataSource = GetDropDownListItems(CursorData, spaltenNameInDatatable, Nothing, spaltenNameInDatatable) |
g.MasterTableView.Columns.Add(gridColumn2) |
AddHandler gridColumn2.ClearFilter, AddressOf ClearFilter |
End If |
If Index = 3 Then |
Dim spaltenName As String = "INT_IMP_MATCHINGFELD" |
If m_FeldDictionary.ContainsKey(9999) Then |
spaltenName = m_FeldDictionary.Item(9999).intSpaltenName |
End If |
Dim gridColumn As New RadGridDropDownFunctions.MyCustomFilteringColumn() |
gridColumn.DataField = "INT_MATCHINGFELD_WERT" |
gridColumn.UniqueName = "INT_MATCHINGFELD_WERT" |
gridColumn.HeaderText = spaltenName |
gridColumn.HeaderStyle.Width = Unit.Pixel(140) |
gridColumn.ListDataSource = GetDropDownListItems(CursorData, "INT_MATCHINGFELD_WERT", Nothing, "INT_MATCHINGFELD_WERT") |
g.MasterTableView.Columns.Add(gridColumn) |
AddHandler gridColumn.ClearFilter, AddressOf ClearFilter |
End If |
If Index = 0 Then |
Me.PlaceHolder0.Controls.Add(g) |
RadGrid0_ClientID = g.ClientID |
ElseIf Index = 1 Then |
Me.PlaceHolder1.Controls.Add(g) |
RadGrid1_ClientID = g.ClientID |
ElseIf Index = 3 Then |
Me.PlaceHolder3.Controls.Add(g) |
RadGrid3_ClientID = g.ClientID |
ElseIf Index = 4 Then |
Me.PlaceHolder4.Controls.Add(g) |
RadGrid4_ClientID = g.ClientID |
End If |
AddHandler g.ItemCreated, AddressOf RadGrid_ItemCreated |
AddHandler g.ItemDataBound, AddressOf RadGrid_ItemDataBound |
AddHandler g.SortCommand, AddressOf RadGrid_SortCommand |
AddHandler g.PreRender, AddressOf RadGrid_PreRender |
End Sub |
None of the event fires :-(
Christian
0
Christian
Top achievements
Rank 1
answered on 24 Mar 2009, 07:28 AM
I have found a workaround.
The events fires only after a postback, so I call the events ItemCreated and ItemDataBound at the first time manualy.
Not nice but it works.
Christian
The events fires only after a postback, so I call the events ItemCreated and ItemDataBound at the first time manualy.
Not nice but it works.
Christian
0
Christian
Top achievements
Rank 1
answered on 25 Mar 2009, 03:15 PM
It does not work correctly.
Is it possible to fire the event ItemCreated manualy?
Christian
Is it possible to fire the event ItemCreated manualy?
Christian
0
Christian
Top achievements
Rank 1
answered on 25 Mar 2009, 03:50 PM
Background:
We use RadTabs to build a workflow, the Radgrid must shown in the last, the 3. RadTab and shows the data which are selected in the RadTabs before.
This means, that I first can get the DataTable from the database when I have all the data from the Tab one and Tab two, so I can't build the RadGrid in the Page_init Event of the ascx-page. And thats why the events ItemCreated and ItemDataBound doesn't fire when I call the Tab with the RadGrid for the first time.
Thanks for any assistance!
Christian
We use RadTabs to build a workflow, the Radgrid must shown in the last, the 3. RadTab and shows the data which are selected in the RadTabs before.
This means, that I first can get the DataTable from the database when I have all the data from the Tab one and Tab two, so I can't build the RadGrid in the Page_init Event of the ascx-page. And thats why the events ItemCreated and ItemDataBound doesn't fire when I call the Tab with the RadGrid for the first time.
Thanks for any assistance!
Christian
0
Christian
Top achievements
Rank 1
answered on 26 Mar 2009, 07:58 AM
Has someone a solution?
Christian
Christian
0
Christian
Top achievements
Rank 1
answered on 26 Mar 2009, 10:00 AM
I have found a workarround:
We use a button_cklick method which calls the FireCommandEvent("sort",Fieldname), which fires the event SortCommand.
In the aspx page we click the buttin via Javascript.
The SortCommand builds the RadGrids again and calls the events ItemCreated etc.
Christian
We use a button_cklick method which calls the FireCommandEvent("sort",Fieldname), which fires the event SortCommand.
In the aspx page we click the buttin via Javascript.
The SortCommand builds the RadGrids again and calls the events ItemCreated etc.
Christian
0
Accepted
Hello Christian,
I am sending you a small runnable application with the implementation requested by you. Give it a try and see if it works for you or if I am leaving something out.
All the best,
Pavlina
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
I am sending you a small runnable application with the implementation requested by you. Give it a try and see if it works for you or if I am leaving something out.
All the best,
Pavlina
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Christian
Top achievements
Rank 1
answered on 27 Mar 2009, 06:59 AM
Thanks
I will have a look
I will have a look