Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
242 views
I have implemented a confirm close window for closing a RadWindow which works fine, however I want to only show the dialog if the user clicks Cancel. I have the following code:

Calling Window:
function OnClientShow(sender, arg) { 
    sender.add_beforeClose(onBeforeClose); 
} 
 
function onBeforeClose(sender, arg) { 
    var oArg = arg.get_argument(); 
    alert(oArg.closingbutton); 
    if (oArg.closingbutton = "Cancel") { 
        function callbackFunction(arg) { 
 
            if (arg) { 
                sender.remove_beforeClose(onBeforeClose); 
                sender.close(); 
            } 
        } 
        arg.set_cancel(true); 
        radconfirm("Any unsaved data will be lost.<br /><br />Are you sure you wish to close this window?", callbackFunction, 400, 200, null, "Close this window?"); 
    } 
} 
 

Closing window:
//Close the dialog 
function closeWindow(btndesc) { 
    var oWnd = GetRadWindow(); 
    var oArg = new Object(); 
    oArg.closingbutton = btndesc; 
    oWnd.close(oArg); 
} 
 

I am getting the error Object doesn't support this property or method.

I can confirm that the text (btndesc) is "Cancel" when the function is fired, but the argument is not being received on the calling window. Any help is appreciated.

GlenB
Top achievements
Rank 1
 answered on 22 May 2010
0 answers
69 views

I thought I'd share some javascript code that will automatically deselect a click on a link that has target="_blank" since it is a popup window.  Put in OnClientItemClicked="RadPanelBarClicked" your RadPanelBar declaration.

function
RadPanelBarClicked(sender, eventArgs) {

 

 

// Dont' select links with target.

 

 

 

var item = eventArgs.get_item();

 

 

var target = item.get_target();

 

 

if (target)

 

{

item.set_selected(

false);

 

}

}

John
Top achievements
Rank 1
 asked on 22 May 2010
4 answers
154 views
Hello All,

i honestly tried to find if this have been asked before but to no avail.

i have a user control that is bind-able to inside a GridTemplateColumn of a datagrid, it works fine and it displays the data, the problem is when the grid is sorted for example, all the data is lost.

i think i can solve this using a hidden control inside the usercontrol, but i am not sure yet, and i would like to know if there is something i am missing


to reproduce:
create user control:
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="X3.ascx.vb" Inherits="X3" %> 
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> 
User control code behind:
 
Partial Class X3 
    Inherits System.Web.UI.UserControl 
    Private _X3 As String 
    Public Property X3() As String 
        Get 
            Return _X3 
        End Get 
        Set(ByVal value As String) 
            _X3 = value 
        End Set 
    End Property 
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 
        Label1.Text = _X3 
    End Sub 
End Class 
 


Page:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ControlState.aspx.vb" Inherits="ControlState" %> 
 
<%@ 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"> 
<%@ Register Src="X3.ascx" TagName="X3" TagPrefix="uc1" %> 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"> 
    <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server"> 
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> 
        </telerik:RadScriptManager> 
    <div> 
        <telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" AllowSorting="True" AutoGenerateColumns="False" EnableViewState ="true" > 
            <MasterTableView> 
                <RowIndicatorColumn> 
                    <HeaderStyle Width="20px" /> 
                </RowIndicatorColumn> 
                <ExpandCollapseColumn> 
                    <HeaderStyle Width="20px" /> 
                </ExpandCollapseColumn> 
                <Columns> 
                    <telerik:GridBoundColumn UniqueName="X1" DataField="X1" HeaderText="X1"> 
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn UniqueName="X2" DataField="X2" HeaderText="X2"> 
                    </telerik:GridBoundColumn> 
                    <telerik:GridTemplateColumn UniqueName="X3" DataField="X3" HeaderText="X3" SortExpression="X3"> 
                        <ItemTemplate> 
                            <uc1:X3 ID="X3_1" runat="server" X3='<%# Eval("X3") %>' /> 
                        </ItemTemplate> 
                    </telerik:GridTemplateColumn> 
                    <telerik:GridBoundColumn UniqueName="X4" DataField="X4" HeaderText="X4"> 
                    </telerik:GridBoundColumn> 
                </Columns> 
            </MasterTableView> 
         
        </telerik:RadGrid> 
    </div> 
    </form> 
</body> 
</html> 
 

Page code behind:
Imports Telerik.Web.UI 
Partial Class ControlState 
    Inherits System.Web.UI.Page 
 
    Private Sub RadGrid1_NeedDataSource(ByVal [source] As Object, _ 
             ByVal e As GridNeedDataSourceEventArgs) _ 
             Handles RadGrid1.NeedDataSource 
        Dim list As New ArrayList 
        For i As Integer = 0 To 4 
            Dim v As New D 
            v.X1 = "V" & i.ToString & "_X1" 
            v.X2 = "V" & i.ToString & "_X2" 
            v.X3 = "V" & i.ToString & "_X3" 
            v.X4 = "V" & i.ToString & "_X4" 
            list.Add(v) 
        Next 
 
 
        RadGrid1.DataSource = list 
    End Sub 
    Private Class D 
        Private _X1 As String 
        Public Property X1() As String 
            Get 
                Return _X1 
            End Get 
            Set(ByVal value As String) 
                _X1 = value 
            End Set 
        End Property 
        Private _X2 As String 
        Public Property X2() As String 
            Get 
                Return _X2 
            End Get 
            Set(ByVal value As String) 
                _X2 = value 
            End Set 
        End Property 
        Private _X3 As String 
        Public Property X3() As String 
            Get 
                Return _X3 
            End Get 
            Set(ByVal value As String) 
                _X3 = value 
            End Set 
        End Property 
        Private _X4 As String 
        Public Property X4() As String 
            Get 
                Return _X4 
            End Get 
            Set(ByVal value As String) 
                _X4 = value 
            End Set 
        End Property 
 
    End Class 
End Class 
 



Basel Nimer
Top achievements
Rank 2
 answered on 21 May 2010
1 answer
119 views

I have  text file ( for TermsAndConditions) with all <p> , <h1>, <b> and all kid of html tags.

I want to open this file in a control like ( text area) with all html applied, how do I do this with telerik control? Which control should I use? And how should I open above text file in this control? So all css and html is applied.

All I want to do is open this file in scrollable form ( standard terms and conditions aggrement)?

Thanks!

A K
Top achievements
Rank 1
 answered on 21 May 2010
1 answer
200 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
267 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
96 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
111 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
186 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
189 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?