| public class TextBoxTemplate : ITemplate |
| { |
| protected RadNumericTextBox textBox; |
| public void InstantiateIn(System.Web.UI.Control container) |
| { |
| textBox = new RadNumericTextBox(); |
| textBox.ID = "txtTest"; |
| textBox.Skin = "Telerik"; |
| textBox.Width = Unit.Pixel(100); |
| container.Controls.Add(textBox); |
| } |
| } |
| protected void DefineGrid(); |
| { grdData.MasterTableView.Columns.Clear(); |
| grdData.Height = Unit.Pixel(300); |
| grdData.Width = Unit.Percentage(100); |
| grdData.AutoGenerateColumns = false; |
| grdData.AllowMultiRowSelection = false; |
| grdData.AllowPaging = false; |
| grdData.ClientSettings.Scrolling.AllowScroll = true; |
| grdData.MasterTableView.DataKeyNames = new string[] { "ID" }; |
| GridTemplateColumn templateColumn = new GridTemplateColumn(); |
| templateColumn.ItemTemplate = new TextBoxTemplate(); |
| templateColumn.UniqueName = templateColumn.HeaderText = "Some Text Here"; |
| grdData.MasterTableView.Columns.Add(templateColumn); |
| } |
| protected void rpv4_Init(object sender, EventArgs e) |
| { |
| DefineGrid(); |
| } |
| DefineGrid(); |
| grdData.DataSource = DataStoredInSessionVariable; |
| grdData.DataBind(); |
| <div><img title="testImage" alt="testImage" src="/images/testImage.png" border="0" /></div> |

| <telerik:RadDockLayout ID="RadDockLayout1" runat="server" OnLoadDockLayout="RadDockLayout1_LoadDockLayout" |
| OnSaveDockLayout="RadDockLayout1_SaveDockLayout" Skin="Vista"> |
| <div style="float:left;"> |
| <telerik:RadDockZone ID="rdZone" runat="server" Height="100%" Skin="Vista" Width="500px"> |
| </telerik:RadDockZone> |
| </div> |
| </telerik:RadDockLayout> |
| protected void Page_Init(object sender, EventArgs e) |
| { |
| if (!IsPostBack) |
| { |
| //data - this is DataSet; da - this is DataAdapter |
| da.Fill(data); |
| for (int i = 0; i < data.Rows.Count; i++) |
| { |
| RadDock dock = CreateRadDock(data[i].Title, data[i].Text, data[i].Id, data[i].Position-1); |
| rdZone.Controls.Add(dock); |
| ScriptManager.RegisterStartupScript( |
| dock, |
| this.GetType(), |
| "AddDock", |
| string.Format(@"function _addDock() {{ |
| Sys.Application.remove_load(_addDock); |
| $find('{1}').dock($find('{0}')); |
| $find('{0}').doPostBack('DockPositionChanged'); |
| }}; |
| Sys.Application.add_load(_addDock);", dock.ClientID, rdZone.ClientID), |
| true); |
| } |
| else |
| for (int i = 0; i < CurrentDockStates.Count; i++) |
| { |
| RadDock dock = CreateRadDockFromState(CurrentDockStates[i]); |
| RadDockLayout1.Controls.Add(dock); |
| } |
| } |
| private List<DockState> CurrentDockStates |
| { |
| get |
| { |
| List<DockState> _currentDockStates = (List<DockState>)Session["CurrentDockStatesDynamicDocks"]; |
| if (Object.Equals(_currentDockStates, null)) |
| { |
| _currentDockStates = new List<DockState>(); |
| Session["CurrentDockStatesDynamicDocks"] = _currentDockStates; |
| } |
| return _currentDockStates; |
| } |
| set |
| { |
| Session["CurrentDockStatesDynamicDocks"] = value; |
| } |
| } |
| private RadDock CreateRadDockFromState(DockState state) |
| { |
| RadDock dock = new RadDock(); |
| dock.ID = string.Format("RadDock{0}", state.UniqueName); |
| dock.DefaultCommands = Telerik.Web.UI.Dock.DefaultCommands.ExpandCollapse; |
| dock.Style.Add("padding-bottom", "10px"); |
| dock.ApplyState(state); |
| return dock; |
| } |
| private RadDock CreateRadDock(string title, string text, int id, int position) |
| { |
| int docksCount = CurrentDockStates.Count; |
| RadDock dock = new RadDock(); |
| dock.UniqueName = Guid.NewGuid().ToString(); |
| dock.ID = string.Format("RadDock{0}", dock.UniqueName); |
| dock.Title = title; |
| dock.Text = text; |
| dock.Skin = "Vista"; |
| dock.Style.Add("padding-bottom", "10px"); |
| dock.Collapsed = true; |
| dock.DefaultCommands = Telerik.Web.UI.Dock.DefaultCommands.ExpandCollapse; |
| dock.Attributes.Add("id", id.ToString()); |
| return dock; |
| } |
| protected void RadDockLayout1_LoadDockLayout(object sender, DockLayoutEventArgs e) |
| { |
| foreach (DockState state in CurrentDockStates) |
| { |
| e.Positions[state.UniqueName] = state.DockZoneID; |
| e.Indices[state.UniqueName] = state.Index; |
| } |
| } |
| protected void RadDockLayout1_SaveDockLayout(object sender, DockLayoutEventArgs e) |
| { |
| CurrentDockStates = RadDockLayout1.GetRegisteredDocksState(); |
| } |
private
DataTable ErrorDataTable = new DataTable();
ErrorDataTable.Clear();
//-- Add columns to the data table
ErrorDataTable.Columns.Add(
"TemplateLineID", typeof(int));
ErrorDataTable.Columns.Add(
"TemplateControlID", typeof(int));
ErrorDataTable.Columns.Add(
"ParentControlID", typeof(int));
ErrorDataTable.Columns.Add(
"ToggledControlID", typeof(int));
ErrorDataTable.Columns.Add(
"Section", typeof(string));
ErrorDataTable.Columns.Add(
"Page", typeof(string));
ErrorDataTable.Columns.Add(
"ErrorMsg", typeof(string));
// Now Test the binding
ErrorDataTable.Rows.Add(-1, -1, -1, -1,
"", "", "No Errors Found");
gridErrors2.DataSource = ErrorDataTable;
gridErrors2.DataBind();
<
telerik:RadSlidingPane ID="ErrorSlidingPane" runat="server"
iconurl="Images/Toolbar/AttachBtn.gif" tabview="ImageOnly" title="Errors" width="460px">
<telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server">
<asp:Panel ID="Panel2" runat="server" Height="200px" style="OVERFLOW: auto"
Width="440px">
<telerik:RadGrid ID="gridErrors2" runat="server" AutoGenerateColumns="False"
ClientSettings-Selecting-AllowRowSelect="true" CssClass="gridText"
Skin="Vista" Width="420px">
<headercontextmenu enabletheming="True">
<collapseanimation duration="200" type="OutQuint" />
</headercontextmenu>
<MasterTableView ClientDataKeyNames="TemplateLineID,TemplateControlID,Page">
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="TemplateLineID" HeaderText="Node ID"
ReadOnly="true" UniqueName="TemplateLineID" Visible="False">
<HeaderStyle Width="50px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="TemplateControlID" HeaderText="Control ID"
ReadOnly="true" UniqueName="TemplateControlID" Visible="False">
<HeaderStyle Width="50px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ParentControlID" HeaderText="Parent Control ID"
ReadOnly="true" UniqueName="ParentControlID" Visible="False">
<HeaderStyle Width="50px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ToggledControlID" HeaderText="Toggled Control ID"
ReadOnly="true" UniqueName="ToggledControlID" Visible="False">
<HeaderStyle Width="50px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Section" HeaderText="Section"
ReadOnly="true" UniqueName="Section" Visible="True">
<HeaderStyle Width="70px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Page" HeaderText="Page"
ReadOnly="true" UniqueName="Page" Visible="True">
<HeaderStyle Width="50px" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ErrorMsg" HeaderText="Please Correct the Following Errors" ItemStyle-CssClass="gridTextRequired"
ReadOnly="True" UniqueName="ErrorMsg" HeaderStyle-ForeColor="Red">
<HeaderStyle Width="220px" />
<ItemStyle CssClass="gridTextRequired" />
</telerik:GridBoundColumn>
<telerik:GridButtonColumn ButtonType="LinkButton" CommandName="Select" HeaderText="Select" ItemStyle-CssClass="gridTextRequired" Text="Go To Page"
UniqueName="column">
</telerik:GridButtonColumn>
</Columns>
</mastertableview>
<clientsettings enablepostbackonrowclick="True">
<selecting allowrowselect="True" />
</clientsettings>
<filtermenu enabletheming="True">
<collapseanimation duration="200" type="OutQuint" />
</filtermenu>
</telerik:RadGrid>
</asp:Panel>
</telerik:RadAjaxPanel>
</telerik:RadSlidingPane>
I have two exact same grids one in the sliding pane and one outside of the sliding pane.
System.Web.HttpException: Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.