Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
182 views
I have radUpload control in my page from which users can only upload images.

<telerik:RadUpload ID="ruImage" runat="server" InitialFileInputsCount="1" ControlObjectsVisibility="None" AllowedMimeTypes="image/bmp,image/gif,image/jpeg,image/pjpeg,image/tiff,image/x-png" />  

I am using the following code in my codebehind to upload the images to the database.
if (ruImage.UploadedFiles.Count > 0) 
    AppImages oImage = null
 
    foreach (UploadedFile theFile in ruImage.UploadedFiles) 
    { 
        string fileName = theFile.FileName; 
        fileName = fileName.Substring(fileName.LastIndexOf(@"\")).Replace(@"\"""); 
 
        byte[] myBytes = new byte[theFile.ContentLength]; 
        theFile.InputStream.Read(myBytes, 0, theFile.ContentLength); 
 
 
        oImage = new AppImages(); 
 
        oImage.AppId = appId; 
        oImage.FileName = fileName; 
        oImage.FileSize = theFile.ContentLength; 
        oImage.FileType = theFile.ContentType; 
        oImage.Attachment = myBytes; 
        oImage.LastUpdatedBy = UserName; 
        oImage.Insert(); 
 
        oImage = null
    } 

The column Attachment in the AppImages table is of type IMAGE. When I debug the code, everything is good as it should be except the content of myBytes. every single element of the array will have 0 as its value. Even when I check the database (I'm using SQL Server 2008), the content of the Attachment column will be 0x000...

Now when I try to load the images to the grid (I have GridBinaryImageColumn), I get the following error from the IE8 debugger:
Error: Sys.WebForms.PageRequestManagerServerErrorException: The provided binary data may not be valid image or may contains unknown header

When I force the page to load, I get the following error:
Parameter is not valid.  
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.ArgumentException: Parameter is not valid. 
 
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:  
 
 
[ArgumentException: Parameter is not valid.] 
   System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData) +430 
   System.Drawing.Image.FromStream(Stream stream) +14 
   Telerik.Web.UI.ImageFilterHelper.CreateImgFromBytes(Byte[] image) +77 
 
[ArgumentException: The provided binary data may not be valid image or may contains unknown header] 
   Telerik.Web.UI.ImageFilterHelper.CreateImgFromBytes(Byte[] image) +219 
   Telerik.Web.UI.RadBinaryImage.AutoAdjustImageElementSize(Byte[] dataValue) +26 
   Telerik.Web.UI.RadBinaryImage.ProcessImageData() +106 
   Telerik.Web.UI.RadBinaryImage.OnPreRender(EventArgs e) +27 
   System.Web.UI.Control.PreRenderRecursiveInternal() +108 
   System.Web.UI.Control.PreRenderRecursiveInternal() +224 
   System.Web.UI.Control.PreRenderRecursiveInternal() +224 
   System.Web.UI.Control.PreRenderRecursiveInternal() +224 
   System.Web.UI.Control.PreRenderRecursiveInternal() +224 
   System.Web.UI.Control.PreRenderRecursiveInternal() +224 
   System.Web.UI.Control.PreRenderRecursiveInternal() +224 
   System.Web.UI.Control.PreRenderRecursiveInternal() +224 
   System.Web.UI.Control.PreRenderRecursiveInternal() +224 
   System.Web.UI.Control.PreRenderRecursiveInternal() +224 
   System.Web.UI.Control.PreRenderRecursiveInternal() +224 
   System.Web.UI.Control.PreRenderRecursiveInternal() +224 
   System.Web.UI.Control.PreRenderRecursiveInternal() +224 
   System.Web.UI.Control.PreRenderRecursiveInternal() +224 
   System.Web.UI.Control.PreRenderRecursiveInternal() +224 
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394 
 
  
 
 
-------------------------------------------------------------------------------- 
Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927  

I've searched the net for this error but coulnd't find any help. Have you guys seen anything like this?

Thanks.



Baal
Top achievements
Rank 1
 answered on 21 May 2010
6 answers
253 views
Good Afternoon,

I'm trying to do something a bit tricky: Embed input controls within the content area.

This is a big problem in Firefox and Opera. Other browsers can handle it.

Here's what I've found:

  • Firefox and Opera: Content within <textarea> is simply not selectable or editable. Additionally, in Firefox, buttons don't fire their onclick event.
  • Internet Explorer: Clicking once selects the control. Clicking again allows you to edit or manipulate. This is acceptable.
  • WebKit: Works beautifully. Click inside a textarea to edit. Click a button to fire the onclick event. This is how I wish the rest worked.

I have tried all kinds of Mozilla extensions to no avail, including: -moz-user-modify: read-write; -moz-user-focus: normal; -moz-user-input: enabled; -moz-user-select: text.

Is there a way to get input controls working Firefox and Opera?

Here's some sample code:
<%@ Page Language="C#" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<!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 id="Head1" runat="server"
    <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server"
        <asp:ScriptManager ID="ScriptManager" runat="server"></asp:ScriptManager> 
        <telerik:RadEditor runat="server" ID="RadEditor" Width="100%" 
            Height="350px" EditModes="Design" Enabled="true"
            <Content> 
                <p>Some text</p> 
                <textarea rows="5" cols="40">Text area text</textarea> 
                <input type="button" onclick="alert('button clicked');" value="Press Me" /> 
                <input type="checkbox" /> 
                <p>More text</p> 
            </Content> 
        </telerik:RadEditor> 
        <input type="button" onclick="alert($find('<%=RadEditor.ClientID%>').get_html(true))" value="Show HTML" /> 
    </form> 
</body> 
</html> 
 

Jeff
Top achievements
Rank 1
 answered on 21 May 2010
2 answers
94 views
Hi dear Telerik.

when i use RadInput  with right to left text box, i have a bad problem: 
Warning icone is in the right side and this image conflict with text.

please see attached image : 
Pouya ir
Top achievements
Rank 1
 answered on 21 May 2010
3 answers
95 views
I'm trying to take a recurrence rule string that the scheduler put in my DB, and extract a list of dates from it. I found an example, but it doesn't work. rrule always returns null. Ultimately I just need a list of dates. Thanks

//this was generated by the scheduler, and I coped it to here from the DB 
string ruleString = "DTSTART:20100504T000000Z  DTEND:20100505T000000Z  RRULE:FREQ=WEEKLY;COUNT=2;INTERVAL=1;BYDAY=TU";  
 
RecurrenceRule rrule; 
RecurrenceRule.TryParse(ruleString, out rrule); 
if (rrule == null
    return
 
DateTime test; 
foreach (DateTime occurrence in rrule.Occurrences) 
    //do something with each date... 
 
 

Paul Nascimento
Top achievements
Rank 1
 answered on 21 May 2010
1 answer
178 views
Greetings,

We've encountered a problem when trying to export grid data in Excel format.
The error we get is always:

 

Error: 'this.ColGroup.Cols' is null or not an object 
This is what we get when we enable the ShowExportToExcelButton.

Just for testing purposes, we created a button OUTSIDE the grid and placed this code in the CodeFile:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click  
        RadGrid1.MasterTableView.ExportToExcel()  
End Sub 
This works without a problem.

Any clue?

Chanan Zass
Top achievements
Rank 1
 answered on 21 May 2010
5 answers
176 views
Hi,

I have a request whereby the combo box should not have an error on the select item.

I have managed to find the class

.rcbArrowCellRight


and I can see that this is a table cell (for which there are two, 1 for the text and one for the arrow handle)

I want to get rid of this extra cell as we do not require it - is there any way to do this. If not, could you suggest a better control from the suite to achieve this.

Thanks
Kamen Bundev
Telerik team
 answered on 21 May 2010
1 answer
56 views
I've been using Q2 07 RadControls for Asp.Net for a while. Now I've upgraded it to Asp.net for Ajax Q1 2010. But the style is not the same. I like the old style of RadTabStrip Web2.0 in Q2 07 better. How can deploy that into my new Q1 2010?
Kamen Bundev
Telerik team
 answered on 21 May 2010
0 answers
68 views

 

Here's how to spell check a textbox in a Detailview:

<script type="text/javascript">   
   
function startSpell() {   
 var sources = document.getElementById('<%=DetailsView1.FindControl("CommentTextBox").ClientID %>');   
   
var spell = $find("<%=RadSpell1.ClientID%>");   
   
spell.set_textSource(new Telerik.Web.UI.Spell.HtmlElementTextSource(sources));   
 
spell.startSpellCheck();  
 
}   
</script>   
 
<telerik:RadSpell ID="RadSpell1" Runat="server" ControlToCheck="DetailsView1"   
 ButtonType="None" Height="28px" />   
   
<input type="button" onclick="startSpell();" value="Check all"/>   
 

 

 

Tim
Top achievements
Rank 1
 asked on 21 May 2010
4 answers
255 views
All of the buttons in my image manager are disabled and it doesntshow any of the images in the folder.  I have used the radeditor image manager several times before and never run into this issue before.  Any Ideas?


<telerik:RadEditor ID="txtContent" runat="server" 
    Width="100%"  
    Height="650px" 
    ImageManager-UploadPaths="~/img/"  
    ImageManager-ViewPaths="~/img/"  
    ImageManager-DeletePaths="~/img/" 
    ImageManager-EnableImageEditor="True"  
    ImageManager-MaxUploadFileSize="2097152"
</telerik:RadEditor> 



LEIDY JHOANA
Top achievements
Rank 1
 answered on 21 May 2010
2 answers
79 views
Hi all,

I'm using the moss version of the rad editor in a site and I want to extend the replaces made when you paste text from Word. It now shows a popup asking the user if they want to clean the formatting, but I also want to remove the font tags and style attributes. I've seen posts using the OnClientPasteHtml event, but I don't believe it's included in this version??

Is there anybody who might know a workaround?

Thanks,

Peter
Peter Heibrink
Top achievements
Rank 1
 answered on 21 May 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?