I would like Image Manager to display a list of images from a database so that they can be inserted into the editor.
I am using asp.net 3.5, Visual Web Developer 2008 Express and VB.
I understand that to do this I need to build a Custom FileBrowserContent Provider as described in:
http://www.telerik.com/help/aspnet-ajax/customfilebrowsercontentprovider.html
I have created MyContentProvider class in MyCustomProvider namespace as per the above help page and added:
<%@ Register Namespace = "MyCustomProvider" TagPrefix = "MyCp" Assembly="App_Code" %>
But when I add:
RadEditor1.ImageManager.ContentProviderTypeName = "ContentProviders.RadEditor.MyContentProvider, App_Code" to my code behind, the Image Manager page has the following error:
Value cannot be null.
Parameter name: type
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: type
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentNullException: Value cannot be null.
Parameter name: type]
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +7679178
Telerik.Web.UI.RadFileExplorer.InitContentProvider(String selectedUrl) +226
Telerik.Web.UI.RadFileExplorer.InitContentProvider() +138
Telerik.Web.UI.RadFileExplorer.BindExplorer() +48
Telerik.Web.UI.RadFileExplorer.OnLoad(EventArgs e) +139
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Control.LoadRecursive() +141
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
I've also tried setting it with the example (from the Help page above):
RadEditor1.FileBrowserContentProviderTypeName = typeof(DatabaseContentProvider).AssemblyQualifiedName
but I don't know the VB syntax for this.
Your help would be much appreciated.
Thanking you in anticipation.
Roger

<telerik:RadEditor ID="BodyEditor" Runat="server" Width="600px" Height="255px" EditModes="Design, Preview" EnableResize="false" StripFormattingOnPaste="All" SkinID="DefaultSetOfTools" MaxTextLength="4000" OnClientCommandExecuting="OnClientCommandExecuting" > <Tools> <telerik:EditorToolGroup Tag="toolBar"> <telerik:EditorDropDown Name="FormatBlock" Text="Normal" /> <telerik:EditorDropDown Name="FontName" Text="Font" Width="125" /> <telerik:EditorDropDown Name="RealFontSize" Text="Size" /> <telerik:EditorSeparator Visible="true" /> <telerik:EditorDropDown Name="ddnFieldSelect_WO" Text="Add Work Order Field" Width="125" /> <telerik:EditorDropDown Name="ddnFieldSelect_EV" Text="Add Event Field" Width="125" /> </telerik:EditorToolGroup> <telerik:EditorToolGroup> <telerik:EditorTool Name="Bold" Text="Bold" /> <telerik:EditorTool Name="Italic" Text="Italic" /> <telerik:EditorTool Name="Underline" Text="Underline" /> <telerik:EditorSeparator Visible="true" /> <telerik:EditorTool Name="JustifyLeft" Text="Align Left" /> <telerik:EditorTool Name="JustifyCenter" Text="Center" /> <telerik:EditorTool Name="JustifyRight" Text="Align Right" /> <telerik:EditorTool Name="JustifyFull" Text="Justify Full" /> <telerik:EditorSeparator Visible="true" /> <telerik:EditorTool Name="InsertOrderedList" Text="Ordered List" /> <telerik:EditorTool Name="InsertUnorderedList" Text="Unordered List" /> <telerik:EditorSeparator Visible="true" /> <telerik:EditorTool Name="Outdent" Text="Outdent" /> <telerik:EditorTool Name="Indent" Text="Indent" /> <telerik:EditorTool Name="ForeColor" Text="Text Color" /> <telerik:EditorTool Name="BackColor" Text="Background Color" /> <telerik:EditorSeparator Visible="true" /> <telerik:EditorTool Name="InsertLink" Text="Insert Link" /> <telerik:EditorSeparator Visible="true" /> <telerik:EditorTool Name="Cut" Text="Cut" /> <telerik:EditorTool Name="Copy" Text="Copy" /> <telerik:EditorTool Name="Paste" Text="Paste" /> <telerik:EditorSeparator Visible="true" /> <telerik:EditorTool Name="Undo" Text="Undo" /> <telerik:EditorTool Name="Redo" Text="Redo" /> <telerik:EditorSeparator Visible="true" /> <telerik:EditorTool Name="AjaxSpellCheck" Text="Spell Checker" /> </telerik:EditorToolGroup> </Tools> <Modules> <telerik:EditorModule Name="RadEditorStatistics" Visible="true" /> </Modules> <RealFontSizes> <telerik:EditorRealFontSize Value="8pt" /> <telerik:EditorRealFontSize Value="9pt" /> <telerik:EditorRealFontSize Value="10pt" /> <telerik:EditorRealFontSize Value="11pt" /> <telerik:EditorRealFontSize Value="12pt" /> <telerik:EditorRealFontSize Value="14pt" /> <telerik:EditorRealFontSize Value="16pt" /> <telerik:EditorRealFontSize Value="18pt" /> <telerik:EditorRealFontSize Value="20pt" /> <telerik:EditorRealFontSize Value="22pt" /> <telerik:EditorRealFontSize Value="24pt" /> <telerik:EditorRealFontSize Value="26pt" /> <telerik:EditorRealFontSize Value="28pt" /> <telerik:EditorRealFontSize Value="36pt" /> <telerik:EditorRealFontSize Value="48pt" /> <telerik:EditorRealFontSize Value="72pt" /> </RealFontSizes> </telerik:RadEditor> 

.rsTimelineView .rsAllDayRow { height: 25px !important; }<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" 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>RadAsyncUpload in UpdatePanel on Windows XP Test</title></head><body> <form runat="server" enctype="multipart/form-data"> <asp:ScriptManager runat="server" /> <asp:UpdatePanel ID="UpdatePanel" runat="server"><ContentTemplate> <rad:RadAsyncUpload runat="server" MultipleFileSelection="Automatic" /> <asp:Button runat="server" OnClick="OnClick" Text="Run Test" /> </ContentTemplate></asp:UpdatePanel> </form></body></html>using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;public partial class _Default : System.Web.UI.Page{ protected void OnClick(object sender, EventArgs e) { System.Web.UI.ScriptManager.RegisterStartupScript(UpdatePanel, typeof(string), Guid.NewGuid().ToString(), "alert('Successful');", true); }}Protected
Sub cEventTypesGrid_InsertCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles cEventTypesGrid.InsertCommand
Dim editedItem As GridEditableItem = TryCast(e.Item, GridEditableItem)
Dim vLogin As TableCell = editedItem("Name")
Dim vTxtLogin As String = (CType(vLogin.Controls(0), RadComboBox)).SelectedValue
If vTxtLogin = "" Then
Throw New Exception("Name cannot be blank.")
End If
Hello everybody i am a little bit stuck and unable to figure aout the problem i am having.... my buttun in bellow form doesn't do anything, this example is guided from http://demos.telerik.com/aspnet-ajax/editor/examples/saveindatabase/defaultcs.aspx only differnce is that i use sql database, here is my example:
this is cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using Telerik.Web.UI;
public partial class editVijesti_vijesti : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
ReadAllRecords();
}
}
public void btnSpremi_Click(object sender, EventArgs e)
{
SqlConnection connection = CreateConnection();
SqlCommand command= null;
if (uredeneVijesti.Value != string.Empty)
{
command = new SqlCommand("UPDATE Vijesti SET Datum = Now(), TijeloVijesti = @content WHERE vijestiID= @nid", connection);
command.Parameters.AddWithValue("content", EditorVijesti.Content);
command.Parameters.AddWithValue("nid", Convert.ToInt32(uredeneVijesti.Value));
}
else
{
command = new SqlCommand("INSERT INTO Vijesti (Datum, TijeloVijesti) VALUES (Now(), @content)", connection);
command.Parameters.AddWithValue("content", EditorVijesti.Content);
}
try
{
command.ExecuteNonQuery();
}
catch (Exception)
{ }
connection.Close();
this.Response.Redirect(this.Request.Url.PathAndQuery);
}
protected SqlConnection CreateConnection()
{
SqlConnection connection = new SqlConnection();
connection.ConnectionString = "Data Source=mssql3.mojsite.com,1555;Initial Catalog=iskratrade_hai;Persist Security Info=True;User ID=iskratrade_hai;Password=091011br"; connection.Open();
return connection;
}
protected void gridVijesti_ItemCommand(object sender, DataGridCommandEventArgs args)
{
SqlConnection connection = CreateConnection();
if (args.CommandName == "Delete")
{
SqlCommand com = new SqlCommand("DELETE FROM Vijesti WHERE vijestiID =@nid", connection);
com.Parameters.AddWithValue("nid", args.Item.Cells[0].Text);
com.ExecuteNonQuery();
connection.Close();
}
else if (args.CommandName == "Edit")
{
SqlCommand command = new SqlCommand("SELECT TijeloVijesti FROM Vijesti WHERE vijestiID= @nid", connection);
command.Parameters.AddWithValue("nid", args.Item.Cells[0].Text);
SqlDataReader record = command.ExecuteReader();
if (record.Read())
{
EditorVijesti.Content = record.GetString(0);
uredeneVijesti.Value = args.Item.Cells[0].Text;
}
else
{
EditorVijesti.Content = "";
uredeneVijesti.Value = "";
}
record.Close();
}
connection.Close();
ReadAllRecords();
}
private void ReadAllRecords()
{
SqlConnection connection = CreateConnection();
SqlCommand command2 = new SqlCommand("SELECT vijestiID, Datum, TijeloVijesti FROM Vijesti", connection);
gridVijesti.DataSource = command2.ExecuteReader();
gridVijesti.DataBind();
connection.Close();
}
}
and this is aspx page:
<asp:ScriptManager ID="scriptmanager" runat="server"/>
<div>
<input type="hidden" name="uredeneVijesti" runat="server" id="uredeneVijesti" />
<telerik:RadEditor ID="EditorVijesti" runat="server" SkinID="DefaultSetOfTools"
height="500px" Width="800px">
<Modules>
<telerik:EditorModule Name="RadEditorStatistics" Visible="false" Enabled="true" />
<telerik:EditorModule Name="RadEditorDomInspector" Visible="false" Enabled="true" />
<telerik:EditorModule Name="RadEditorNodeInspector" Visible="false" Enabled="true" />
<telerik:EditorModule Name="RadEditorHtmlInspector" Visible="false" Enabled="true" />
</Modules>
<ImageManager ViewPaths="~/editVijesti" UploadPaths="~/editVijesti/slike/novo" DeletePaths="~/editVijesti/slike/obrisano" />
<FlashManager DeletePaths="editVijesti/slike/obrisano" UploadPaths="~/editVijesti/slike/novo" ViewPaths="~/editVijesti/slike" />
<DocumentManager DeletePaths="editVijesti/slike/obrisano" UploadPaths="~/editVijesti/slike/novo" ViewPaths="~/editVijesti/slike" />
<MediaManager DeletePaths="editVijesti/slike/obrisano" UploadPaths="~/editVijesti/slike/novo" ViewPaths="~/editVijesti/slike" />
<TemplateManager DeletePaths="editVijesti/slike/obrisano" UploadPaths="~/editVijesti/slike/novo" ViewPaths="~/editVijesti/slike" />
</telerik:RadEditor>
<br />
<asp:Button ID="btnSpremi" runat="server" Text="Spremi u bazu" OnClick="btnSpremi_Click" />
<br />
<br />
<asp:DataGrid ID="gridVijesti" runat="server" BorderWidth="1px" CellPadding="3"
AutoGenerateColumns="False" Width="620px"
OnItemCommand="gridVijesti_ItemCommand">
<HeaderStyle Font-Names="Verdana" ForeColor="Black" BackColor="#d3e5fa" />
<Columns>
<asp:BoundColumn DataField="vijestiID"></asp:BoundColumn>
<asp:ButtonColumn CommandName="Delete" ButtonType="LinkButton"
HeaderText="Obriši" Text="Delete"></asp:ButtonColumn>
<asp:ButtonColumn ButtonType="LinkButton" CommandName="Edit" HeaderText="Uredi" Text="Uredi"></asp:ButtonColumn>
<asp:BoundColumn DataField="Datum" HeaderText="Datum"></asp:BoundColumn>
<asp:BoundColumn DataField="TijeloVijesti" HeaderText="Tekst"></asp:BoundColumn>
</Columns>
</asp:DataGrid>
</div>
problem is with the button btnSpremi no insert to database, tables are set to Datum-- datetame (data type) , vijestiID----int -is identity incremenet seed, and TijeloVijesti --nvarchar(MAX) .. .. unable to insert to database read from databse is working good delete also but insert nothing... please if you can look at the code,.. regards
