There doesn't seem to be a good solution for printing the control itself.
So, one solution would just be to show a pop-up and write the contents of the control out to html. I would need to do this for Day, Week, Month and Multi-Day views available in the control. It's not a difficult task but time consuming if you figure in formatting etc.
By any chance did anyone do this already and what to share the code?
Can someone suggest a better solution?
<
rad:RadAjaxManager ID="RadAjaxManager1" runat="server"></rad:RadAjaxManager>
<
rad:RadAjaxPanel ID="RadAjaxPanel" runat="server" HorizontalAlign="NotSet" LoadingPanelID="AjaxLoadingPanel1" ScrollBars="None">
<div style="display:none;">
<asp:Button ID="btnRebind" runat="server" onclick="btnRebind_Click" />
</div>
<asp:Repeater ID="lstRefs" runat="server" OnItemDataBound="lstRefs_ItemDataBound" OnItemCreated="lstRefs_ItemCreated"></asp:Repeater>
<asp:PlaceHolder ID="ph" runat="server"></asp:PlaceHolder>
<uc:SubWin ID="winRefEdit" runat="server" TargetPage="RefEdit.aspx" />
</
rad:RadAjaxPanel>
<
rad:AjaxLoadingPanel ID="AjaxLoadingPanel1" runat="server" Transparency="0">
<table style="height:100%;width:100%;" border="0">
<tr style="vertical-align:middle">
<td style="text-align:center;">
<img src='timer.gif' alt='Timer' />
</td>
</tr>
</table>
</
rad:AjaxLoadingPanel>
When I define ItemTemplate inside component - everything works well. However, there is a special requirement to make template editable by simple tools (texteditor). That is why I am defining template as ITemplate control in code and assign it to Repeater. In aspx page user places something like:
<table>
<uc:SpecialCompoment ID="sp1" runat="server>
<MyItemTemplate>
<tr>
<td>Name:<ItemData Field="Name"></td><td style="font-weight:bold">Last name:<ItemData Field="Surname"></td>
</tr>
</MyItemTemplate>
</uc:SpecialCompoment>
</table>
Then I am parsing the content of template at ItemDataBound event and replacing artificial tags <ItemData> with real values.
Now I need to add controls to issue command to update/delete records. I am catching ItemCreated event and parsing the template for <ItemAction Action="Edit"> and <ItemAction Action="Delete"> and replacing them by Button controls, settings unique ID, and CommandName.
Without RadAjaxManager everything works.
With RadAjaxManager it work but result it strange. When loaded it looks like that:
Name:John Last name:Doe Edit Delete
Name:Bill Last name:Smith Edit Delete
Name:Erik Last name:Peters Edit Delete
After editing (by command a subwindow opens and after completion of edit javascript call server to rebind repeater) it looks following:
Name:Joanna Last name:Doe Edit Delete
Name:Bill Last name:Smith Edit Delete
Name:Erik Last name:Peters Edit Delete
Name:John Last name:Doe Edit Delete
Name:Bill Last name:Smith Edit Delete
Name:Erik Last name:Peters Edit Delete
As you can see, it replicated the content (except HTML) of edited repeater ABOVE the original, that stays untouched.
Any idea why it is and how to fix it ?
<Products> <Product ProductID="1"> <Item ItemID="1"> <ProductNo>1234</ProductNo> <Description> <ManufacDate>20100526T12:00:01.012</ManufacDate> <ManufacID>72</ManufacID> </Description> </Item> <Item ItemID="2"> <ProductNo>1235</ProductNo> <Description> <ManufacDate>20100527T12:00:01.012</ManufacDate> <ManufacID>72</ManufacID> </Description> </Item> <Item ItemID="3"> <ProductNo>1236</ProductNo> <Description> <ManufacDate>20100528T12:00:01.012</ManufacDate> <ManufacID>66</ManufacID> </Description> </Item> </Product>
<Product ProductID="2">
<Item ItemID="1">
<ProductNo>1254</ProductNo>
<Description>
<ManufacDate>20101226T12:00:01.012</ManufacDate>
<ManufacID>1232</ManufacID>
</Description>
</Item>
<Item ItemID="2">
<ProductNo>1T#2345</ProductNo>
<Description>
<ManufacDate>20100520T12:00:01.012</ManufacDate>
<ManufacID>474#</ManufacID>
</Description>
</Item>
<Item ItemID="3">
<ProductNo>124576</ProductNo>
<Description>
<ManufacDate>20010518T12:00:01.012</ManufacDate>
<ManufacID>T3455</ManufacID>
</Description>
</Item>
</Product>
</Products>
Private Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Init
DefineGridStructure()
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim Grid1 As RadGrid = CType(PlaceHolder1.FindControl("RadGrid1"), RadGrid)
RadAjaxManager1.AjaxSettings.AddAjaxSetting(Grid1, Grid1)
If Not IsPostBack Then
Grid1.SelectedIndexes.Add(1, 0, 1)
'Grid1.MasterTableView.Items(0).Expanded = True
'Grid1.MasterTableView.Items(0).ChildItem.NestedTableViews(0).Items(0).Expanded = True
End If
End Sub
Public Sub DefineGridStructure() 'Handles RadGrid1.NeedDataSource
Dim RadGrid1 As RadGrid = New RadGrid
Dim xmlDoc As New System.Xml.XmlDocument()
xmlDoc.Load(Server.MapPath("OutTypeID6.xml"))
Dim ndList As System.Xml.XmlNodeList = xmlDoc.SelectNodes("//Product/node()[descendant::node()]")
Dim nd As System.Xml.XmlNode = xmlDoc.SelectSingleNode("//Product/node()[descendant::node()]")
Dim ds As New DataSet()
ds.ReadXml(New StringReader(nd.OuterXml))
RadGrid1.ID = "RadGrid1"
RadGrid1.DataSource = ds
RadGrid1.Width = Unit.Percentage(98)
RadGrid1.AllowPaging = True
RadGrid1.AllowSorting = True
RadGrid1.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric
RadGrid1.AutoGenerateColumns = False
RadGrid1.ShowStatusBar = True
RadGrid1.MasterTableView.DataKeyNames = New String() {nd.Name}
Dim boundColumn As GridBoundColumn
Dim tableView As New GridTableView(RadGrid1)
Dim relationFields As GridRelationFields = New GridRelationFields()
For Each xmlnode As System.Xml.XmlNode In ndList
For Each XNode As System.Xml.XmlNode In xmlnode.ChildNodes
boundColumn = New GridBoundColumn
boundColumn.DataField = XNode.Name 'XNode.FirstChild.Value
boundColumn.HeaderText = XNode.Name
RadGrid1.MasterTableView.Columns.Add(boundColumn)
If XNode.FirstChild.ChildNodes.Count > 0 Then
tableView.DataSource = ds.Tables(1)
For Each chNode As System.Xml.XmlNode In XNode.ChildNodes
tableView.DataKeyNames = New String() {chNode.Name}
tableView.Width = Unit.Percentage(100)
relationFields.MasterKeyField = XNode.ParentNode.Name 'chNode.ParentNode.Name
relationFields.DetailKeyField = XNode.ParentNode.Name 'chNode.ParentNode.Name
tableView.ParentTableRelation.Add(relationFields)
RadGrid1.MasterTableView.DetailTables.Add(tableView)
boundColumn = New GridBoundColumn
boundColumn.DataField = chNode.Name 'XNode.FirstChild.InnerText
boundColumn.HeaderText = chNode.Name
tableView.Columns.Add(boundColumn)
Next
tableView.Caption = XNode.Name
tableView.DataBind()
End If
tableView.Width = Unit.Percentage(100)
Next
Next
RadGrid1.DataSource = ds
RadGrid1.Rebind()
Me.PlaceHolder1.Controls.Add(RadGrid1)

var masterTable = RadGridRPjs.get_masterTableView();
masterTable.rebind();
[DataContract][Serializable] public class FileHandlerDTO{ [DataMember] public int Id { get; set; } [DataMember] public string Name { get; set; } [DataMember] public string Description { get; set; } [DataMember] public List<FileHandlerDTO> Children;}