Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
121 views
How can you change the selected folder in a path.

This is de default folder = <Configuration ViewPaths="/Upload/" />
But i would like that the system by default opens "/Upload/Images/Siteimages/"

Anyone have an idea ?

David Blok
Top achievements
Rank 1
 answered on 02 Sep 2010
3 answers
160 views
I am getting this error on all my vb pages in the code behind

visual basic.net "unknown type or namespace" page in system.web.ui

Partial

 

Class login_User_Status

 

 

    Inherits System.Web.UI.Page

 

End

 

Class

 


It is similar to this post.

http://www.telerik.com/community/forums/justcode/code-analysis/namespace-not-recognized-on-every-page-in-project.aspx
Tsviatko Yovtchev
Telerik team
 answered on 02 Sep 2010
2 answers
60 views

Hi guys

I seem to have a problem afetr upgrading to Q2 2010 version of the controls.
I have a menu created using Q2 2009 version and have modified the text colors of the Bllack skin
with this css:

div.RadMenu_Black .rmRootGroup .rmLink {       
        color:#A49261;     
        font-family: Georgia; 
        font-weight:500; 
        font-size:11px;   
    }  
div.RadMenu_Black .rmRootGroup .rmLink:hover, 
div.RadMenu_Black .rmRootGroup .rmLink:focused 
 
        color:#A49261;     
        font-family: Georgia;     
}

The problem is that the hover color is no longer modified and has reverted to green.  How do I fix this in the new version?

Thanks

Clive
Clive Hoggar
Top achievements
Rank 1
 answered on 02 Sep 2010
1 answer
190 views
Hi,

I have image manager tool in Rad Editor. Once uploaded image using image manager i need to set image alignment to left. After that i need to change the image left -to- right or right -to- left. It's working before i saved into database.

Again i opened the page, now i try to change the image alignment left -to- right (or) right -to- left. But now i am not able to change.

I have attached javascript with this. Please help me.

----------Code---------------

var _editor = null;
var _resizeEditorInterval = null;

//---------------------------------
function resizeEditor(editor) {
    clearInterval(_resizeEditorInterval);

    var sizeInfo = null;
    var oldHeight = 0;
    var newHeight = 0;
    var availHeight = document.body.clientHeight;

    if (editor != null) {
        var elem = editor.get_element();
        sizeInfo = getElementPosition(elem);
        oldHeight = elem.clientHeight;
        newHeight = availHeight - sizeInfo.y - 50;
        if (Math.abs(newHeight - oldHeight) > 3)
            editor.setSize(elem.clientWidth, newHeight);
    }
}


//---------------------------------
var curTables = [];
function isObjectInArray(elem, array) {
    if (!array || !array.length) return false;
    for (var i = 0; i < array.length; i++) {
        if (elem == array[i]) return true;
    }
    return false;
}


//---------------------------------
function onClientPasteHTML(sender, args) {
    //alert('pasteHTML1:' + args.get_commandName());
    //alert('pasteHTML2:' + args.get_value());
}


//---------------------------------
function onClientEditorLoad(sender, args) {
    //alert('load');
    var editor = sender;

    var colors = editor.get_colors();
    colors.shift();
    colors.unshift('#ffffff');
    editor.set_colors(colors);

    _resizeEditorInterval = window.setInterval(resizeEditor, 100);

    var oTool = editor.getToolByName("InsertTable");
    if (oTool == null) { return; }
    oTool._element.onclick =
        function() {
            window.setTimeout(
                function() {
                    var elemCol = findElementByClass('span', 'SetTableProperties');
                    //alert(elemCol.parentNode.parentNode.parentNode.innerHTML);
                    elemCol.parentNode.parentNode.parentNode.style.display = 'none';

                    /*
                    for(i=0; i< elemCol.length; i++)    
                    {    
                    var elem = elemCol[i];    
                    if(elem.className=="TableWizard")    
                    {    
                    elem.parentNode.parentNode.parentNode.style.visibility = "hidden";    
                    }    
                    if(elem.className=="SetCellProperties" || elem.className=="SetTableProperties")    
                    {    
                    elem.parentNode.parentNode.style.visibility = "hidden";    
                    }    
                    }
                    */
                }, 50);
        };

}


//---------------------------------
var _alignImage = null;
function onClientCommandExecuting(editor, args) {
    debugger;
    var cmd = args.get_commandName();
    var contentArea = editor.get_contentArea();

    _editor = editor;

    switch (cmd) {
        case 'SetImageProperties':
            args.set_cancel(true);

            _alignImage = editor.getSelectedElement();
            alert(_alignImage);
            if (_alignImage.tagName == "BODY") {
                alert('Please select any image before set image properties');
            }
            else {
                alignImage();
            }
            break;

        case 'ImageManager':
            args.set_cancel(true);
            addImage();
            break;

        case 'InsertTable':
            var tables = contentArea.getElementsByTagName("TABLE");
            for (var i = 0; i < tables.length; i++) {
                curTables[curTables.length] = tables[i];
            }
            break;

        case 'InsertAnchor':
            args.set_cancel(true);
            addAnchor();
            break;

        case 'SetColumnWidth':
            args.set_cancel(true);
            setColumnWidth(_editor, args);
            break;

        case 'PageBreak':
            args.set_cancel(true);
            pageBreak(editor, args);
            break;

        default:
            /*
            var selection = _editor.getSelection();           
            var selectedText = selection.getText();
            var selectedHTML = selection.getHtml();
            var selElement = _editor.getSelectedElement();
            alert(selectedHTML);
            */
            break;
    }
}


//---------------------------------
function onClientCommandExecuted(editor, args) {
    var COL_WIDTH = 80;

    switch (args.get_commandName()) {
        case 'InsertTable':
            var cArea = editor.get_contentArea();
            var tables = cArea.getElementsByTagName("TABLE");
            for (var i = 0; i < tables.length; i++) {
                var tbl = tables[i];

                //Check if this table existed before the InsertTable executed.
                if (!isObjectInArray(tbl, curTables)) {
                    // it's a new table, so size it reasonably
                    // set the column widths
                    try {
                        var numCols = tbl.getElementsByTagName('TR')[0].childNodes.length;
                        tbl.style.tableLayout = 'fixed';
                        tbl.style.pageBreakInside = 'avoid';
                        //tbl.style.width = (COL_WIDTH*numCols) + 'px';                              

                        //alert(numCols);
                        var colgroup = document.createElement("COLGROUP");
                        for (var i = 0; i < numCols; i++) {
                            var col = document.createElement("COL");
                            col.style.width = COL_WIDTH + 'px';

                            colgroup.appendChild(col);
                        }

                        tbl.insertBefore(colgroup, tbl.childNodes[0]);
                    }
                    catch (oErr) { }
                }
            }
            break;

        case 'BackColor':
            /*
            var selection = _editor.getSelection();           
            var selectedText = selection.getText();
            var selectedHTML = selection.getHtml();
            var selElement = _editor.getSelectedElement();

            alert(selectedHTML);
            */
            break;
    }

}

//---------------------------------
function alignImage() {
    try {
        var oManager = GetRadWindowManager();

        var wnd = oManager.open(_appRoot + 'pages/dlg/alignImage.htm', null);
        wnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close);
        wnd.setSize(350, 200);
        wnd.set_modal(true);
        wnd.add_close(closeAlignImage);
        wnd.get_contentFrame().style.overflow = 'hidden';

    }
    catch (oErr) { alert(oErr); }
}


//---------------------------------
function addImage() {
    try {
        var oManager = GetRadWindowManager();

        var wnd = oManager.open(_httpRoot + 'pages/dlg/FileUpload.aspx?m=add&cp=' + _cID, null);
        wnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close);
        wnd.setSize(300, 200);
        wnd.set_modal(true);
        wnd.add_close(closeAddImage);
        wnd.get_contentFrame().style.overflow = 'hidden';

        setTimeout(resizeFileDlg, 400);

        /*
        var arg = new dialogArgument();
        arg.closeCallback = closeAddImage;
        var wnd = showDialog('pages/dlg/FileUpload.aspx?m=add&cp=<%=this.CompanyID%>', 300, 200, arg);
        wnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close);
        */
    }
    catch (oErr) { alert(oErr); }
}


 

 


//---------------------------------
// sender = radWindow
function closeAddImage(sender, eventArgs) {
    try {
        var fileID = 0;
        debugger;
        sender.remove_close(closeAddImage);
        debugAlert('a');
        if (_editor == null) { return; }

        var result = sender.get_contentFrame().contentWindow.getResult();
        debugAlert(result);
        if (result != null && result.indexOf('success') == 0) {
            var fileParts = result.split(':');

            if (fileParts.length > 1) {
                fileID = parseInt(fileParts[1], 10);
                if (fileID > 0) {
                    var imgWidth = -1;
                    var imgHeight = -1;
                    if (fileParts.length > 2) {
                        var sizeParts = fileParts[2].split('x');
                        imgWidth = parseInt(sizeParts[0], 10);
                        imgHeight = parseInt(sizeParts[1], 10);
                    }

                    //var img = _editor.get_document().createElement("IMG");
                    //img.src = _appRoot + 's/img.ashx?f=' + fileID;
                    var imgHTML = '<img src="' + _appRoot + 's/img.ashx?f=' + fileID + '" ';
                    if (imgWidth > 0 && imgHeight > 0) {
                        // limit image size somewhat arbitrarily. we have no firm definition of
                        // a 'good' size, but the user can size back up if they want to. Size
                        // width down first; only check height if no width adjustment was needed.
                        if (imgWidth > 300) {
                            imgWidth = 300;
                        }
                        else if (imgHeight > 300) {
                            imgHeight = 300;
                        }

                        imgHTML += 'width="' + imgWidth + '" ';
                        imgHTML += 'height="' + imgHeight + '" ';
                        imgHTML += 'align=left';
                        imgHTML += ' style="marginRight:8px; padding:5px 5px 5px 5px;" ';
                    }
                    imgHTML += '/>';
                    debugger;
                    _editor.pasteHtml(imgHTML);

                    //var contentArea = _editor.get_contentArea();
                    //contentArea.appendChild(img);
                }
            }
        }
        else {
            if (result.indexOf('load') < 0)
                alert(result);
        }
    }
    catch (oErr) { }
}

//---------------------------------
// sender = radWindow
function closeAlignImage(sender, eventArgs) {
    try {
        debugger;
        var fileID = 0;

        sender.remove_close(closeAlignImage);
        if (_alignImage == null) { return; }
        alert(_alignImage);
        var wnd = sender.get_contentFrame().contentWindow;
        var text = wnd.getAlign();
        if (text.length == 0) { return; }
        debugger;
        _alignImage.setAttribute('align', text);  //style.textAlign = 'left';
        if (text == 'left') {
            _alignImage.style.marginRight = '8px';
        }
        else {
            _alignImage.style.marginLeft = '8px';
        }

    }
    catch (oErr) {
        alert(oErr);
     }
}




Thanks in advance.

Dobromir
Telerik team
 answered on 02 Sep 2010
1 answer
353 views
-edit- nevermind I was reviewing outdated documentation.
Pavlina
Telerik team
 answered on 02 Sep 2010
2 answers
189 views
We have a RadGrid and when a row is clicked we want to make an ajax call to the database and populate some textboxes.

We tried using the RadAjaxManager but we only ever got a postback anyways.

We are now using an Updatepanel with a trigger. This makes the ajax part work but the Grid paging is now broken.

Could any1 give me a simple example, preferably step by step what is necessary to fill our needs?

Lars Thorén
Top achievements
Rank 1
 answered on 02 Sep 2010
3 answers
147 views
Hello Everyone,
First of all thanking for the great support from the Telerik team.

I have a problem with RadGrid when I'm using it with GridDropDownColumn.

My scenario:

I have a grid with GridDropDownColumn column. I load the values of  the ComboBox during ItemDataBound event and and select the values from it if I'm in edit mode. In this situation I don't see the text of this column in the grid table.
So I added in the ItemDataBound event a check if the item is GridDataItem and then set the GridDataItem.Text  to the right value (The text should be a little bit different from the text used in the ComboBox). It works OK now and showing the text in the Grid table.
Now I face another problem, I have NestedTemplate in this grid. When I expand the column the text of the GridDropDownColumn column disapears... How can I resolve this problem?

My code:
protected void AttributesRadGrid_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridEditableItem && e.Item.IsInEditMode)
        {
            GridEditableItem editedItem = e.Item as GridEditableItem;
            GridEditManager editMan = editedItem.EditManager;
  
            GridDropDownListColumnEditor fieldTypeEditor = editMan.GetColumnEditor("FieldType") as GridDropDownListColumnEditor;
            GridDropDownListColumnEditor attributeCategoryIDEditor = editMan.GetColumnEditor("AttributeCategoryID") as GridDropDownListColumnEditor;
              
            fieldTypeEditor.ComboBoxControl.Items.Add(new RadComboBoxItem("Text", "0"));
            fieldTypeEditor.ComboBoxControl.Items.Add(new RadComboBoxItem("Yes/No", "1"));
            fieldTypeEditor.ComboBoxControl.Items.Add(new RadComboBoxItem("Multi Yes/No", "2"));
            fieldTypeEditor.ComboBoxControl.Items.Add(new RadComboBoxItem("Select", "3"));
  
            FillAttributeCategoriesComboBox(attributeCategoryIDEditor.ComboBoxControl);
  
            if (e.Item.RowIndex != -1)
            {
                CellphonesCL.Database.attributes attr = (CellphonesCL.Database.attributes)e.Item.DataItem;
  
                fieldTypeEditor.ComboBoxControl.SelectedValue = attr.FieldType.ToString();
                attributeCategoryIDEditor.ComboBoxControl.SelectedValue = attr.AttributeCategoryID.ToString();
            }
        }
        else if (e.Item is GridDataItem)
        {
            GridDataItem dataItem = e.Item as GridDataItem;
            CellphonesCL.Database.attributes attr = (CellphonesCL.Database.attributes)e.Item.DataItem;
  
            dataItem["AttributeCategoryID"].Text = attr.attributecategories.Title;
            dataItem["FieldType"].Text = attributes.GetAttributeFieldTypeStr((AttributeFieldType)attr.FieldType);
        }
    }


Regards,
Alex.
Alex Vr
Top achievements
Rank 1
 answered on 02 Sep 2010
3 answers
108 views
I am looking for a server-side equivalent of the client-side function IsPinned().  I am setting my windows to be invisible each time a page is posted back; however, if they have been pinned then I want to keep them visible.
Georgi Tunev
Telerik team
 answered on 02 Sep 2010
1 answer
70 views
Hello Sir,

i want to Preserve Template Colomn Value When Pagging is Allow in grid view.

For example if i have 2 Column in grid view.
   a). Id
   b). Name (It is Template Column Use Text box For Showing Data)

Now When I change Page 1 Data And When change Page 2 Data Again when i come back to Page 1 Then i want to See my changes
So Please Help me.

Thanks
Chandan Kumar.
Pavlina
Telerik team
 answered on 02 Sep 2010
3 answers
899 views
Hi There,

When I was trying to export an "number-like" text column, Excel (HTML) automatically treat it as a number.
For example: column "UserID" with data "000579" will be truncated to "579" in Excel.

Below are my functions. Is that any way to handle the cell format (force it to be TEXT) programmatically when it went to Excel?

' Add column to RadGrid1 Programmatically
Private Sub AddNewColumnToRadGrid(ByVal UniqueName As String, ByVal HeaderText As StringByVal DataField As StringByVal SortExpression As String)
        Dim boundColumn As New GridBoundColumn()
        RadGrid1.MasterTableView.Columns.Add(boundColumn)
        boundColumn.UniqueName = UniqueName
        boundColumn.HeaderText = HeaderText
        If DataField.Length > 0 Then boundColumn.DataField = DataField
        If SortExpression.Length > 0 Then boundColumn.SortExpression = SortExpression
End Sub
 
' Simple Export to Excel Function
Protected Sub btnExportToExcel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExportToExcel.Click
        RadGrid1.ExportSettings.FileName = "Report"
        RadGrid1.ExportSettings.ExportOnlyData = True
        RadGrid1.ExportSettings.IgnorePaging = True
        RadGrid1.ExportSettings.OpenInNewWindow = True
        RadGrid1.MasterTableView.ExportToExcel()
End Sub

Thanks in advance. :)

Regards,
waiwai
Wai Wai Chan
Top achievements
Rank 1
 answered on 02 Sep 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?