Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
270 views
Hello,

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RadGrid.aspx.cs" Inherits="Test_RadGrid" %>
  
<%@ 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">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadGrid ID="RadGrid1" runat="server">
        <MasterTableView>
            <Columns>
                <telerik:GridBoundColumn DataField="AccountProgram" HeaderText="Account Program">
                    <HeaderStyle Width="150" Height="40"></HeaderStyle>
                </telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
    </form>
</body>
</html>

The Width of HeaderStyle is working. However, the Height of HeaderStyle is not working.

How can I do to solve this problem?

Thank you for your help.

Minkyu Lee.
Dimo
Telerik team
 answered on 02 Sep 2010
3 answers
188 views
How do you add a custom button to a column?

I've been searching the website and found a few things that are close to what I'm trying to do. I'm still pretty new to all this, and didn't completely understand it.

I have a Rad Grid pulling in registration data from a database. I want to add another column that contains a button that will call an "unregister Event". On the click event, I want to right code that unregisters the user.

What is the most efficient way to get this done?

Thanks in advance for any help.
Iana Tsolova
Telerik team
 answered on 02 Sep 2010
1 answer
64 views
I have a NumericTextBox on a page that prompts the user when they try to navigate away from that page if they have unsaved changes.

My javascript:

 

window.onbeforeunload = function () {
  if (isDirty) {
    return 'You have unsaved changes. You will lose your changes if you leave the page.';
  }
};

 
The issue is that if I enable the spinbuttons on the numeric textbox this event fires whenever the user clicks the spin button, even though they don't navigate away. Is there a way to prevent this event from firing?

 

Dimo
Telerik team
 answered on 02 Sep 2010
1 answer
400 views
Hi ,

I have a rad grid and in item databound im trying to get the items count . My dataset contains 3 items and is also bound to the rad grid where its displayed . In Item Databound radGrid.Items.Count  returns 2 , where as it should be 3 .
Similarly i used radGrid.MasterTableView.Items.Count ,returns 2 .

What could be the problem
Shinu
Top achievements
Rank 2
 answered on 02 Sep 2010
1 answer
115 views
G'Day,

I have a grid, which I always want to show the Insert Row, except when another row is being edited.

So far I have set the IsItemInserted to true or false during the NeedDataSource event and everything works as expected,. That is until I save a new item. Then the Insert row is removed.

It looks like property is being set to false After the NeedDataSource event and Before the Grid Pre-Render event. Can anyone tell me how I can override this property being reset to False?

I do have a workaround, but it is a little clunky.

I check it's status in the Grid_PreRender, if false I then reset it to be true and then force a ReBind.

Thanks

Andrew

Princy
Top achievements
Rank 2
 answered on 02 Sep 2010
7 answers
218 views
I have a situation where a SlidingPane contains a treeview and 2 dropdown listboxes.  About half a second after the form loads, the Pane slides out from the left.  I like this effect.  The problem arises after each postback when the user has chosen an item in the tree or selected an item in one of the dropdown listboxes.  Since the form is posting back, the same slide out effect occurs.  This is annoying to the user.

So to the SlidingPane control I added this event handler definition: OnClientExpanded="radSlidingPane_Expanded"

Which then calls this:

      function radSlidingPane_Expanded(sender, args) {
        $("#<%= UpdatePanel1.ClientID %> #<%= radSlidingZone.ClientID %>").attr('DockedPaneId', 'radSlidingPane');
      }

I'm using jQuery to get the SlidingZone object.  That part seems to work fine.  But apparently setting 'DockedPaneId' as I have doesn't forcibly dock the SlidingPane.  Note: I even tried specifying the longer version - 'ctl00_ContentPlaceHolder1_radSlidingPane' - but it didn't work either.

What should I be doing to achieve the effect I'm looking for?

Robert
Svetlina Anati
Telerik team
 answered on 02 Sep 2010
2 answers
124 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
163 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
65 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
199 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
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?