| private RadFileExplorer CreateAndInitializeExplorer() |
| { |
| RadFileExplorer explorer = new RadFileExplorer() |
| { |
| EnableViewState = true, |
| VisibleControls = FileExplorerControls.All ^ FileExplorerControls.AddressBox, // only disable AddressBox. show everything else |
| Width = 900.Pixel(), |
| EnableCreateNewFolder = true, |
| EnableCopy = false |
| }; |
| explorer.Load += Explorer_OnLoad; |
| explorer.PreRender += Explorer_PreRender; |
| explorer.Configuration.ContentProviderTypeName = typeof(MyContentProvider).AssemblyQualifiedName; |
| string[] basePath = MyContentProvider.GetRootsPaths(); |
| explorer.Configuration.ViewPaths = basePath; |
| explorer.Configuration.UploadPaths = basePath; |
| explorer.Configuration.DeletePaths = basePath; |
| return explorer; |
| } |
| private const PathPermissions FULL_PERMISSIONS = PathPermissions.Read | PathPermissions.Delete | PathPermissions.Upload; |

Hello
I am trying to add dock control to my web page.My web page has a vald asp.net 3.5 scriptmanager. but it has started to give this error :
The control with ID 'RadDockZone1' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.
I am pretty sure there is a scriptmanager on the page.I tired to set RegisterWithScriptManager="false" property and try again.But after that ,it throwed that error
Unable to cast object of type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection' to type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection'.
I searched internet ,it was suggested to change webconfig ajax part like this to solve this problem :
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
I did it ,but it did not work still same error given ,any idea ?
Thanks in advance
public
void LinkButtonExportToExcel_click(object sender, EventArgs e)
{
int rowCount = RadGridProduct.Items.Count;
if (rowCount <= 0) { return; }
RadGridProduct.ExportSettings.ExportOnlyData =
true;
RadGridProduct.ExportSettings.IgnorePaging =
false;
RadGridProduct.ExportSettings.OpenInNewWindow =
true;
RadGridProduct.MasterTableView.ExportToExcel();
}
It worked fine before but not now. After I clicked the LinkButton, no Excel opened in the new window and my RadGid had lost all of Filter controls and other controls inside ItemTemplates. Am I missing something?
Thanks,
Enoch
| Private _conn As New SqlConnection(ConfigurationManager.ConnectionStrings("myConnectionString").ConnectionString) |
| Private ReadOnly Property CurrentDockStates() As List(Of DockState) |
| Get |
| 'Get saved state string from the database - set it to dockState variable for example |
| Dim dockStatesFromDB As String = "" |
| _conn.Open() |
| Dim command As New SqlCommand("select State from States where id='" + Me.DropDownList1.SelectedValue.ToString + "'", _conn) |
| dockStatesFromDB = command.ExecuteScalar().ToString() |
| _conn.Close() |
| Dim _currentDockStates As New List(Of DockState)() |
| Dim stringStates As String() = dockStatesFromDB.Split("|"c) |
| For Each stringState As String In stringStates |
| If stringState.Trim() <> String.Empty Then |
| _currentDockStates.Add(DockState.Deserialize(stringState)) |
| End If |
| Next |
| Return _currentDockStates |
| End Get |
| End Property |
| Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Init |
| 'Recreate the docks in order to ensure their proper operation |
| Dim i As Integer = 0 |
| While i < CurrentDockStates.Count |
| If CurrentDockStates(i).Closed = False Then |
| Dim dock As RadDock = CreateRadDockFromState(CurrentDockStates(i)) |
| 'We will just add the RadDock control to the RadDockLayout. |
| ' You could use any other control for that purpose, just ensure |
| ' that it is inside the RadDockLayout control. |
| ' The RadDockLayout control will automatically move the RadDock |
| ' controls to their corresponding zone in the LoadDockLayout |
| ' event (see below). |
| 'We want to save the dock state every time a dock is moved. |
| CreateSaveStateTrigger(dock) |
| 'Load the selected widget |
| LoadWidget(dock) |
| RadDockLayout1.Controls.Add(dock) |
| End If |
| System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1) |
| End While |
| End Sub |
| Protected Sub RadDockLayout1_LoadDockLayout(ByVal sender As Object, ByVal e As DockLayoutEventArgs) |
| 'Populate the event args with the state information. The RadDockLayout control |
| ' will automatically move the docks according that information. |
| For Each state As DockState In CurrentDockStates |
| e.Positions(state.UniqueName) = state.DockZoneID |
| e.Indices(state.UniqueName) = state.Index |
| Next |
| End Sub |
| Protected Sub RadDockLayout1_SaveDockLayout(ByVal sender As Object, ByVal e As DockLayoutEventArgs) |
| Dim stateList As List(Of DockState) = Me.RadDockLayout1.GetRegisteredDocksState() |
| Dim serializedList As New StringBuilder() |
| Dim i As Integer = 0 |
| While i < stateList.Count |
| serializedList.Append(stateList(i).ToString()) |
| serializedList.Append("|") |
| System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1) |
| End While |
| Dim dockState As String = serializedList.ToString() |
| If dockState.Trim() <> [String].Empty Then |
| _conn.Open() |
| Dim command As New SqlCommand([String].Format("update States set State='{0}' where id='" + Me.DropDownList1.SelectedValue.ToString + "'", dockState), _conn) |
| command.ExecuteNonQuery() |
| _conn.Close() |
| End If |
| End Sub |
| Private Function CreateRadDockFromState(ByVal state As DockState) As RadDock |
| Dim dock As New RadDock() |
| dock.DockMode = DockMode.Docked |
| dock.ID = String.Format("RadDock{0}", state.UniqueName) |
| dock.ApplyState(state) |
| dock.EnableAnimation = True |
| dock.Commands.Add(New DockCloseCommand) |
| dock.Commands.Add(New DockExpandCollapseCommand()) |
| Return dock |
| End Function |
| Private Function CreateRadDock() As RadDock |
| Dim docksCount As Integer = CurrentDockStates.Count |
| Dim dock As New RadDock() |
| dock.DockMode = DockMode.Docked |
| dock.UniqueName = Guid.NewGuid().ToString() |
| dock.ID = String.Format("RadDock{0}", dock.UniqueName) |
| dock.Title = Replace(Replace(DroptDownWidget.SelectedItem.Text, ".ascx", ""), "_", " ") |
| dock.EnableAnimation = True |
| dock.Text = String.Format("Added at {0}", DateTime.Now) |
| dock.Width = Unit.Pixel(386) |
| dock.Commands.Add(New DockCloseCommand()) |
| dock.Commands.Add(New DockExpandCollapseCommand()) |
| dock.CommandsAutoPostBack = True |
| Return dock |
| End Function |
| Private Sub CreateSaveStateTrigger(ByVal dock As RadDock) |
| 'Ensure that the RadDock control will initiate postback |
| ' when its position changes on the client or any of the commands is clicked. |
| 'Using the trigger we will "ajaxify" that postback. |
| dock.AutoPostBack = True |
| dock.CommandsAutoPostBack = True |
| Dim updatedControl As New AjaxUpdatedControl() |
| updatedControl.ControlID = "Panel1" |
| Dim setting1 As New AjaxSetting(dock.ID) |
| setting1.EventName = "DockPositionChanged" |
| setting1.UpdatedControls.Add(updatedControl) |
| Dim setting2 As New AjaxSetting(dock.ID) |
| setting2.EventName = "Command" |
| setting2.UpdatedControls.Add(updatedControl) |
| RadAjaxManager1.AjaxSettings.Add(setting1) |
| RadAjaxManager1.AjaxSettings.Add(setting2) |
| End Sub |
| Private Sub LoadWidget(ByVal dock As RadDock) |
| If String.IsNullOrEmpty(dock.Tag) Then |
| Return |
| End If |
| Dim widget As Control = LoadControl(dock.Tag) |
| dock.ContentContainer.Controls.Add(widget) |
| End Sub |
| Protected Sub ButtonAddDock_Click(ByVal sender As Object, ByVal e As EventArgs) |
| Dim dock As RadDock = CreateRadDock() |
| 'find the target zone and add the new dock there |
| Dim dz As RadDockZone = DirectCast(XMLUtilities.FindControlRecursive(Master, "RadDockZone1"), RadDockZone) |
| dz.Controls.Add(dock) |
| CreateSaveStateTrigger(dock) |
| 'Load the selected widget in the RadDock control |
| dock.Tag = DroptDownWidget.SelectedValue |
| LoadWidget(dock) |
| ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "MoveDock", String.Format("function _moveDock() {{" & vbCr & vbLf & vbTab & vbTab & vbTab & " " & vbTab & "Sys.Application.remove_load(_moveDock);" & vbCr & vbLf & vbTab & vbTab & vbTab & vbTab & " $find('{1}').dock($find('{0}'),{2});" & vbCr & vbLf & vbTab & vbTab & vbTab & " }};" & vbCr & vbLf & vbTab & vbTab & vbTab & " Sys.Application.add_load(_moveDock);", "$find('<%= RadDock1.ClientID %>');", "RadDockZone1", dz.Docks.Count), True) |
| End Sub |
Hi Team,
I am not able to retain value of combobox when i click on "Click Me" in my code. Please help me. My code as below.
Code Behind Code:-
| Partial Class _Default |
| Inherits System.Web.UI.Page |
| Protected Sub rcbSections_ItemDataBound(ByVal sender As Object, ByVal e As RadComboBoxItemEventArgs) Handles rcbCat.ItemDataBound |
| Dim CustomExamID As String = CType(e.Item.FindControl("chk"), CheckBox).Attributes("CategoryID") |
| If ViewState("CategoryID") <> CustomExamID Then |
| ViewState("CategoryID") = CustomExamID |
| Dim CustomExamTitle As String = CType(e.Item.FindControl("chk"), CheckBox).Attributes("CategoryName") |
| Dim objSectionItem As New RadComboBoxItem |
| objSectionItem.Value = CustomExamID |
| objSectionItem.Text = CustomExamTitle |
| objSectionItem.IsSeparator = True |
| rcbCat.Items.Insert(e.Item.Index, objSectionItem) |
| rcbCat.Items(e.Item.Index - 1).Controls.Remove(rcbCat.Items(e.Item.Index - 1).FindControl("chk")) |
| Dim objTitle As New LiteralControl() |
| objTitle.ID = "lcCategoryName" |
| objTitle.Text = CustomExamTitle |
| rcbCat.Items(e.Item.Index - 1).Controls.Add(objTitle) |
| End If |
| End Sub |
| Private Sub FillCategory() |
| Dim dtMaster As New DataTable("Item") |
| dtMaster.Columns.Add("CategoryID") |
| dtMaster.Columns.Add("CategoryName") |
| dtMaster.Columns.Add("SubCategoryID") |
| dtMaster.Columns.Add("SubCategoryName") |
| For index As Integer = 1 To 10 |
| For index1 As Integer = 1 To 3 |
| Dim drNew As DataRow |
| drNew = dtMaster.NewRow() |
| drNew("CategoryID") = index |
| drNew("CategoryName") = "CategoryName" + index.ToString |
| drNew("SubCategoryID") = index1 |
| drNew("SubCategoryName") = "SubCategoryName" + index1.ToString |
| dtMaster.Rows.Add(drNew) |
| Next |
| Next |
| rcbCat.DataSource = dtMaster |
| rcbCat.DataTextField = "SubCategoryName" |
| rcbCat.DataValueField = "SubCategoryID" |
| rcbCat.DataBind() |
| End Sub |
| Protected Sub btnFillCat_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnFillCat.Click |
| FillCategory() |
| End Sub |
| End Class |
Design Code :-
| <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head runat="server"> |
| <title></title> |
| </head> |
| <telerik:radscriptblock runat="server" id="scriptBlock"> |
| <script type="text/javascript"> |
| var cancelDropDownClosing = false; |
| function onDropDownClosing() { |
| cancelDropDownClosing = false; |
| } |
| function onSectionCheckBoxClick() { |
| var combo = $find("<%= rcbCat.ClientID %>"); |
| //prevent second combo from closing |
| cancelDropDownClosing = true; |
| //holds the text of all checked items |
| var text = ""; |
| //holds the values of all checked items |
| var values = ""; |
| //get the collection of all items |
| var items = combo.get_items(); |
| //enumerate all items |
| for (var i = 0; i < items.get_count(); i++) { |
| var item = items.getItem(i); |
| //get the checkbox element of the current item |
| var chk1 = $get(combo.get_id() + "_i" + i + "_chk"); |
| if (chk1) { |
| if (chk1.checked) { |
| text += item.get_text() + ","; |
| values += item.get_value() + ","; |
| } |
| } |
| } |
| //remove the last comma from the string |
| text = removeLastComma(text); |
| values = removeLastComma(values); |
| if (text.length > 0) { |
| //set the text of the combobox |
| combo.set_text(text); |
| combo.set_value(values); |
| } |
| else { |
| //all checkboxes are unchecked |
| //so reset the controls |
| combo.set_text("All Category"); |
| combo.set_value("All"); |
| } |
| } |
| function StopPropagation(e) { |
| if (!e) { |
| e = window.event; |
| } |
| e.cancelBubble = true; |
| } |
| //this method removes the ending comma from a string |
| function removeLastComma(str) { |
| return str.replace(/,$/, ""); |
| } |
| </script> |
| </telerik:radscriptblock> |
| <body> |
| <form id="form1" runat="server"> |
| <div> |
| <div style="color: Red;width:500px;text-align:justify;"> |
| <b>Note:- </b> First Fill the Combobox by clicking on "Fill Category" then select calegories |
| from combobox using checkbox. After this click on "Click Me". Then open the combobox |
| you will see the Separator have checkbox and category name will disapper. |
| </div> |
| <br /> |
| <asp:Button runat="server" Text="Fill Category" ID="btnFillCat" /><br /><br /> |
| <asp:Button runat="server" Text="Click Me" ID="btnClick" /> |
| <br /> |
| <br /> |
| <br /> |
| <telerik:radcombobox id="rcbCat" runat="server" height="140px" showtoggleimage="True" |
| highlighttemplateditems="true" onclientload="onSectionCheckBoxClick" width="290px" |
| style="vertical-align: middle;" expandanimation-type="None" collapseanimation-type="None" |
| allowcustomtext="false" onclientdropdownclosed="onDropDownClosing"> |
| <ItemTemplate> |
| <div onclick="StopPropagation(event)"> |
| <asp:CheckBox runat="server" ID="chk" Text='<%# Eval("SubCategoryName") %>' Value='<%# Eval("SubCategoryID") %>' |
| CategoryID='<%# Eval("CategoryID") %>' CategoryName='<%# Eval("CategoryName") %>' |
| TextAlign="right" onclick="onSectionCheckBoxClick()" /> |
| </div> |
| </ItemTemplate> |
| </telerik:radcombobox> |
| </div> |
| <telerik:radajaxmanager runat="server" id="ramTest"> |
| <AjaxSettings> |
| <telerik:AjaxSetting AjaxControlID="rcbCat"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="rcbCat" LoadingPanelID="rlpCR" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| </AjaxSettings> |
| </telerik:radajaxmanager> |
| </form> |
| </body> |
| </html> |
I am waiting for you reply.
Thanks
Chirag Patel
| // Find the RadControl client object, if null then exit the function |
| sb.Append(String.Format("var co = $find(\"{0}\");", c.ClientID)); |
| sb.Append("if (co == null) return;"); |