Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
145 views
Hi,

We are using radgrid(RadGrid.Net2, Version=5.0.1.0) and we are exporting data to excel using radGrid.MasterTableView.ExportToExcel();
As grid contains date columns, we want to format it in given format. But grid does not support "ExcelExportCellFormatting" event.
Can anybody provide me the solution or any workaround.

Reg,
Chirag
Daniel
Telerik team
 answered on 27 Apr 2011
1 answer
157 views

Hi,

 

We using Telerik tools (Version Version=2009.3.1208.20) for our ASP.Net web development. We also have Radgrids with sorting and Pagination functionality enabled in our ASPX pages. From the 508 testing, we noticed the following issues with the Radgrid when pagination/sorting enabled.  

 

a)      When images are removed or certain alternate stylesheets are applied, the table pagination and sort image buttons disappear. (Please find the attachment TotalExceptionsTableWithCSSDisabled.PNG)

b)      When CSS is disabled on the page, the table pagination and sort image buttons display as buttons with no text (they display as a gray box).  (Please find the attachment ExceptionRequestCSSOff.PNG)

c)       Further more, the “Page Size” combo box at the end (at the footer) of the radgrid data table do not have explicit labeling. Is there a way we could add a explicit label to the page size drop down?

 

We have also identified few other section 508 issues with Radgrid and created separate service requests for them. Per response to those threads, we are grouping all 508 relates issues in this one single thread.  Please find the list of 508 issues attached.

 

d)      http://www.telerik.com/community/forums/aspnet-ajax/grid/508-no-audible-cue-that-a-sort-has-been-performed-on-collumn-sort-in-radgrid.aspx

e)      http://www.telerik.com/community/forums/aspnet-ajax/grid/508-radgrid-pagination-use-layout-table-but-have-summary-attribute.aspx

f)       http://www.telerik.com/community/forums/aspnet-ajax/grid/508-no-audible-cue-that-a-sort-has-been-performed-on-collumn-sort-in-radgrid.aspx#1558157

g)      http://www.telerik.com/community/forums/aspnet-ajax/grid/508-radgrid-pagination-use-layout-table-but-have-summary-attribute.aspx#1558178

h)      http://www.telerik.com/community/forums/aspnet-ajax/grid/radgrid-complex-nested-table-how-to-code-table-using-headers-and-id-attributes.aspx#1558242

 

Please provide me a guidance / option how to address these section 508 findings.

 

Thanks,

Kalidas.K

Iana Tsolova
Telerik team
 answered on 27 Apr 2011
1 answer
263 views
Hi,
I am experiencing problem with RadSplitter by setting height to 100%
To demonstrate the issue, I created  a simple project - but I can not include a zip file here!

Some times the height is ok, but generally after pressing F5 (refresh), it takes a wrong size. In my production project i getting wrong size always.
I analyzed html and find that when splitter have a wrong size, it has the following inlize css style: 
<div id="ctl00_MainSplitter" style="width: 1210px; height: 400px;" control="[object Object]">

I tried to use all kinds of tricks, but it not working for me, can somebody help me with this issue?

Here Master Page Code: 
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="TreePartMaster.Master.cs" Inherits="Intel.Diamond.Web.TreePartMaster" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head id="masterHead" runat="server">
    <meta http-equiv="X-UA-Compatible" content="IE=8" />
    <title>Diamond System</title>
    <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
    <telerik:RadStyleSheetManager ID="masterRadStyleSheetManager" runat="server" CdnSettings-TelerikCdn="Auto" ClientIDMode="Inherit" />
    <script type="text/javascript">
        function OnBodyStart() {
            //Calculate Width and Height
            var myWidth = 0, myHeight = 0;
            if (typeof (window.innerWidth) == 'number') {
                //Non-IE
                myWidth = window.innerWidth;
                myHeight = window.innerHeight;
            } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
                //IE 6+ in 'standards compliant mode'
                myWidth = document.documentElement.clientWidth;
                myHeight = document.documentElement.clientHeight;
            } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
                //IE 4 compatible
                myWidth = document.body.clientWidth;
                myHeight = document.body.clientHeight;
            }
 
            //Update style vars with new width and height
            var b, p, m;
 
            b = parseInt(myHeight * 0.95) + "px";
            p = parseInt(myHeight * 0.97) + "px";
            m = parseInt(myHeight * 0.87) + "px";
 
            changecss(".body", "height", b);
            changecss(".page", "height", p);
            changecss(".main", "height", m);
 
            //            var ScreenWidth = document.forms[0].item("_ScreenWidth");
            //            var ScreenHeight = document.forms[0].item("_ScreenHeight");
            //           
            //            ScreenWidth.value = document.documentElement.clientWidth
            //            ScreenHeight.value = document.documentElement.clientHeight;
        };
 
        function changecss(theClass, element, value) {
            var cssRules;
 
            var added = false;
            for (var S = 0; S < document.styleSheets.length; S++) {
                if (document.styleSheets[S]['rules']) {
                    cssRules = 'rules';
                } else if (document.styleSheets[S]['cssRules']) {
                    cssRules = 'cssRules';
                } else {
                    //no rules found... browser unknown
                }
 
                for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
                    if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
                        if (document.styleSheets[S][cssRules][R].style[element]) {
                            document.styleSheets[S][cssRules][R].style[element] = value;
                            added = true;
                            break;
                        }
                    }
                }
                if (!added) {
                    try {
                        document.styleSheets[S].insertRule(theClass + ' { ' + element + ': ' + value + '; }', document.styleSheets[S][cssRules].length);
 
                    } catch (err) {
                        try { document.styleSheets[S].addRule(theClass, element + ': ' + value + ';'); } catch (err) {
                        }
 
                    }
                }
            }
        };
    </script>
    <asp:ContentPlaceHolder ID="HeadContent" runat="server">
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <style type="text/css">
                                                
                .RadPaneLocationFix
                {
                    position: relative;
                }
            </style>
            <style type="text/css">
 
                html, body, form
                {
                    height: 100%;
                    margin: 0px;
                    padding: 0px;
                    overflow: hidden;
                }
          
                #updatePnl
                {
                    height: 100% !important;
                }
            </style>
        </telerik:RadCodeBlock>
    </asp:ContentPlaceHolder>
</head>
<body class="body" onload="OnBodyStart();">
    <form id="masterForm" runat="server">
    <telerik:RadScriptManager ID="masterRadScriptManager" runat="server">
        <Scripts>
            <%--Needed for JavaScript IntelliSense in VS2010--%>
            <%--For VS2008 replace RadScriptManager with ScriptManager--%>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <telerik:RadFormDecorator runat="server" ID="LabFormDecorator" DecoratedControls="All"
        Skin="WebBlue" />
    <telerik:RadAjaxManager ID="masterRadAjaxManager" runat="server" DefaultLoadingPanelID="AjaxDefaultLoadingPanel">
    </telerik:RadAjaxManager>
    <div class="page">
        <div class="header">
            <div class="title">
                <table id="tbHeaderLayout">
                    <tr>
                        <td style="vertical-align: top;">
                            <asp:Image ID="DiamondLogo" runat="server" ImageUrl="~/Images/DmSystemLogo.gif" Height="40px"
                                BorderStyle="None" />
                        </td>
                        <td style="vertical-align: top;">
                            <label style="color: White; font-size: 30px">
                                ThThe Diamond System
                            </label>
                        </td>
                </table>
            </div>
            <div class="loginDisplay">               
            </div>
        </div>
        <div class="main">
        <asp:UpdatePanel runat="server" ID="updatePnl" style="height:100%;">
         <ContentTemplate>
            <telerik:RadSplitter ID="MainSplitter" runat="server" Width="100%"
                Height="100%" BackColor="#66CCFF">
                <telerik:RadPane ID="SideSplitterPane" runat="server" Width="15%">
                    <telerik:RadSlidingZone ID="MainSlidingZone" runat="server" DockedPaneId="SideBarSlidingPane"
                        Width="22px">
                        <telerik:RadSlidingPane ID="SideBarSlidingPane" runat="server" Title="Side Menu">
                            <telerik:RadPanelBar ID="SideBarMenu" runat="server" Width="100%" Height="100%">
                                <Items>
                                    <telerik:RadPanelItem runat="server" NavigateUrl="~/Views/Segments.aspx" PreventCollapse="True"
                                        Text="Main Page">
                                        <Items>
                                            <telerik:RadPanelItem runat="server" NavigateUrl="~/Views/Monitor/LabInfo.aspx" Text="Lab Monitor">
                                            </telerik:RadPanelItem>
                                        </Items>
                                    </telerik:RadPanelItem>
                                    <telerik:RadPanelItem runat="server" PreventCollapse="True" Text="Project Progress Views">
                                        <Items>
                                            <telerik:RadPanelItem runat="server" NavigateUrl="~/Views/Tasks/TasksList.aspx" Text="Assignments">
                                            </telerik:RadPanelItem>
                                            <telerik:RadPanelItem runat="server" NavigateUrl="~/Views/Tasks/CreateNewTask.aspx"
                                                Text="Create New Assignments">
                                            </telerik:RadPanelItem>
                                            <telerik:RadPanelItem runat="server" NavigateUrl="~/Views/Tasks/DataManagement.aspx"
                                                Text="Data Management">
                                            </telerik:RadPanelItem>
                                        </Items>
                                    </telerik:RadPanelItem>
                                    <telerik:RadPanelItem runat="server" PreventCollapse="True" Text="Administration Tasks">
                                        <Items>
                                            <telerik:RadPanelItem runat="server" NavigateUrl="~/Views/Management/Users.aspx"
                                                Text="Users Management">
                                            </telerik:RadPanelItem>
                                            <telerik:RadPanelItem runat="server" NavigateUrl="~/Views/Management/Segments.aspx"
                                                Text="Segments Management">
                                            </telerik:RadPanelItem>
                                            <telerik:RadPanelItem runat="server" NavigateUrl="~/Views/Management/Workstations.aspx"
                                                Text="Workstations Management">
                                            </telerik:RadPanelItem>
                                        </Items>
                                    </telerik:RadPanelItem>
                                </Items>
                            </telerik:RadPanelBar>
                        </telerik:RadSlidingPane>
                    </telerik:RadSlidingZone>
                </telerik:RadPane>
                <telerik:RadPane ID="BodySplitterPane" runat="server" Width="85%" CssClass="RadPaneLocationFix">
                    <asp:ContentPlaceHolder ID="MainContent" runat="server" />
                </telerik:RadPane>
            </telerik:RadSplitter>
         </ContentTemplate>
        </asp:UpdatePanel>
        </div>
    </div>
    <div class="clear">
        <telerik:RadAjaxLoadingPanel ID="AjaxDefaultLoadingPanel" runat="server" Width="100%"
            Height="100%" HorizontalAlign="Center">
        </telerik:RadAjaxLoadingPanel>
    </div>
    <input type="hidden" name="_ScreenWidth" id="_ScreenWidth" runat="server" value="1024" />
    <input type="hidden" name="_ScreenHeight" id="_ScreenHeight" runat="server" value="640" />
    </form>
</body>
</html>


Master Page .cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Security;
using Telerik.Web.UI;
 
namespace Intel.Diamond.Web
{
    public partial class TreePartMaster : System.Web.UI.MasterPage
    {
        protected void Page_Load( object sender, EventArgs e )
        {
            try
            {
                do
                {
                    if (!Page.IsPostBack)
                    {
                        //SetUpSideBarMenu();
                    }
 
 
                    SetUpSideBarMenu();
 
                } while (false);
 
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
            }
        }
        private void SetUpSideBarMenu()
        {
            //MainSplitter.Width = new Unit( ScreenWidth * 0.95, UnitType.Pixel );
            //MainSplitter.Height = new Unit( ScreenHeight * 0.91, UnitType.Pixel );
 
            //SideBarSlidingPane.Width = new Unit( ScreenWidth * 0.15, UnitType.Pixel );
            //SideBarSlidingPane.Height = new Unit( ScreenHeight * 0.90, UnitType.Pixel );
 
            //SideBarMenu.Width = new Unit( ScreenWidth * 0.15, UnitType.Pixel );
 
            SideBarMenu.Items[0].Enabled = true;
            SideBarMenu.Items[1].Enabled = true;
            SideBarMenu.Items[2].Enabled = true;
 
 
            SideBarMenu.Items[0].Expanded = true;
            SideBarMenu.Items[1].Expanded = true;
            SideBarMenu.Items[2].Expanded = true;
 
        }
    }
}


The Default Page is Empty

<%@ Page Title="" Language="C#" MasterPageFile="~/TreePartMaster.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TesterWebApp.Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
</asp:Content>


Thanks
 George


Dobromir
Telerik team
 answered on 27 Apr 2011
1 answer
62 views
Hi,
  I'm not able to start_edit() a new node at the 2nd Level client-side if the parent node does not have any child previously and this is the only child.
Attached is the demo application I've done.

at the node.startEdit() statement it throws an error as: "htmlfile: Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus."

to replicate the issue please try to add a new node at the 2nd level which does not have any children.

-Himanshu
Dimitar Terziev
Telerik team
 answered on 27 Apr 2011
3 answers
128 views
Hello,

It seems that the latest Release (2011 Q1) solved some of the issues with RadComboBox on IE9.

Though, There is still a problem with RTL support.

First time the control is loaded the selected item or the empty message are aligned to the left. only after
Selecting another item from the list, it fixes itself and then the item is aligned to the right as should be.

This behavior is happening in your demos as well. You can see that in the Right-To-Left demo the control
Loaded with the value "New York" selected and it aligned to the left, and after you choose another city
From the list, it fixes itself and get aligned to the right.

Do you have a solution for that wrong behavior ?

Regards,

Itamar
Helen
Telerik team
 answered on 27 Apr 2011
3 answers
216 views
Hello,

I am using Rad scheduler and it works fine for me in my local pc..
but when i publish same to sharepoint webpart it gives me following error when changing date of calender
Error: Sys.InvalidOperationException: Could not find UpdatePanel with ID . If it is being updated dynamically then it must be inside another UpdatePanel

means whe i change date or view from day to week or month ,..nothing updated
pls reply soon,

thanks,
bhora
Helen
Telerik team
 answered on 27 Apr 2011
37 answers
751 views
Hi,
I'm trying to figure out how to create something like the way you can add controls to pages in Sitefinity, by dragging a treeview node to DropZones.
I know how to just drag and drop a node to a DropZone and then create a RadDock in the controller that has the same ID as the "e.HtmlElementID".

But doing it this way doesn't work very well because I'm not dragging a RadDock so I can't choose where in the zone to put it because there is no interaction between the dragged node and the DropZone, like there is between a dragged RadDock and the DropZone.

Has anyone tried this and can point me in the right direction?

Edit: Should be RadDock in the title for this thread, not DropZone...
Pero
Telerik team
 answered on 27 Apr 2011
6 answers
79 views
When I add an event to the schedular and click the save button, it does not show the event i just enter,
can someone help me?
Veronica
Telerik team
 answered on 27 Apr 2011
1 answer
109 views
I am, on occasion (around 40% of the time), getting the following javascript error:

Uncaught TypeError: Cannot call method 'removeChild' of null - Telerik.WebUI.WebResource.axd:2897 My code has successfully completed an ajaxRequest to server side code:
        function OnClientClose(oWnd, args) {
 
            var arg = args.get_argument()
             
        if (arg!=null) {
 
            $find('<%# RadAjaxManager1.ClientID %>').ajaxRequest(arg);
          }
}
All actions appear to have completed correctly, however the loading panel is still showing (I'm using the default panel). It would appear that the LoadingPanel handlers are halting at the error and failing to remove the loadingpanels? Thanks R.
Iana Tsolova
Telerik team
 answered on 27 Apr 2011
14 answers
220 views
Dear All,
I am facing this problem whenever I am using RadAjaxPanel my javascript variables are not getting refreshed i.e they are not being initialized with default value. I am also not getting my RadAlert Boxes which I have added from code behind for Save and Delete purpose. Please help me in solving this problem. For your reference I am attaching the form code behind and aspx along with javascript.

Regards,
Noor Hussain
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="frmCurrencies.aspx.vb" Inherits="BNBERP.frmCurrencies" %>
<%@ 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">
     
    <div>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        </telerik:RadWindowManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel2">
        <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadToolBar1">
        <UpdatedControls>
        <telerik:AjaxUpdatedControl ControlID="RadSplitter1"/>       
        </UpdatedControls>
        </telerik:AjaxSetting>
        </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server" Skin="Default">
        </telerik:RadAjaxLoadingPanel>      
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
 
 
        <script type="text/javascript">
            //KeyDown for Alphabets
            function KeyDownAlphabetsOnly(e) {
 
 
                if (e.keyCode != 8 && e.keyCode != 32 && e.keyCode != 190) {
                    if (e.shiftKey) {
                        if (90 >= e.keyCode && e.keyCode >= 65) {
                            e.returnValue = true;
                        }
                        else {
 
                            e.returnValue = false;
                        }
                    }
                    else if (90 >= e.keyCode && e.keyCode >= 65) {
                        e.returnValue = true;
                    }
                    else {
 
                        e.returnValue = false;
                    }
                }
                else
                    e.returnValue = true;
            }
 
            //Keydown function for numbers only
            function KeyDownForNumbersOnly(e) {
 
                if (e.keyCode != 8) {
 
                    if (e.keyCode < 48 || e.keyCode > 57)
                        return false;
                    else if (e.shiftKey == 1)
                        return false;
                    else
 
                        return true;
                }
                return true;
            }
 
        //KeyPress Function for Alphabets only
            function AlphabetOnly(sender, eventArgs) {
                var c = eventArgs.get_keyCode();
                if ((c < 65) ||
       (c > 90 && c < 97) ||
       (c > 122))
                    eventArgs.set_cancel(true);
            }
 
            //KeyDown Function for Aplhanumeric fields
            function KeyDownAlphaNumeric(e) {
                 if (e.keyCode != 8) {
                    if (e.shiftKey) {
                        if (90 >= e.keyCode && e.keyCode >= 65) {
                            e.returnValue = true;
                        }
                        else {
 
                            e.returnValue = false;
                        }
                    }
                    else if (90 >= e.keyCode && e.keyCode >= 65) {
                        e.returnValue = true;
                    }
                    else if (57 >= e.keyCode && e.keyCode >= 48) {
                        e.returnValue = true;
                    }
                    else {
 
                        e.returnValue = false;
                    }
                }
                else
                    e.returnValue = true;
            }
            //Validation Function
            function OnClientClicking(sender, args) {
                var button = sender.get_text();
                //Closing the form
                if (button == "Ok") {
                    //Cancel the PostBack and return
                    args.set_cancel(true);
                    //Obtain a reference to the  parent window manager
                    var oManager = GetRadWindow().get_windowManager();
                    //Close the window
                    oManager.closeActiveWindow();
                }
 
                //Checking if any text is in the controls before closing the form on cancel event
                if (button == "Cancel") {
                    var button1 = $find("<%= btnAdd.ClientID %>");
                    var txtCurrCode = $find("<%= txtCurrencyCode.ClientID %>");
                    var txtCurrName = $find("<%= txtCurrencyName.ClientID %>");
                    var txtNumericCode = $find("<%= txtNumericCode.ClientID %>");
                    debugger
                    //Check if any text is there in the controls
                    if (txtCurrCode.isEmpty() != true || txtCurrName.isEmpty() != true || txtNumericCode.isEmpty() != true) {
                        if (button1.get_text() == "Add" || button1.get_text() == "Update") {
                            if (!clickCalledAfterRadconfirm) {
                                args.set_cancel(true);
                                lastClickedItem = sender;
                                radconfirm("Any unsaved data will be lost. Do you wish to continue ?", CancelconfirmCallbackFunction, 330, 100, null, 'Currencies');
                            }
                            else {
                                //Cancel the PostBack and return
                                args.set_cancel(true);
                                //Obtain a reference to the  parent window manager
                                var oManager = GetRadWindow().get_windowManager();
                                //Close the window
                                oManager.closeActiveWindow();
                            }
                        }
                        else {
                            //Cancel the PostBack and return
                            args.set_cancel(true);
                            //Obtain a reference to the  parent window manager
                            var oManager = GetRadWindow().get_windowManager();
                            //Close the window
                            oManager.closeActiveWindow();
                        }
                    }
                    else {
                        //Cancel the PostBack and return
                        args.set_cancel(true);
                        //Obtain a reference to the  parent window manager
                        var oManager = GetRadWindow().get_windowManager();
                        //Close the window
                        oManager.closeActiveWindow();
                    }
                }                 
                   
                //Validation Starts here
                if (button == "Add" || button == "Update") {
                    //Check for Currency Code empty
                    var txtCurrCode = $find("<%= txtCurrencyCode.ClientID %>");
                    if (txtCurrCode.isEmpty() == true) {
                        //Set the Focus
                        txtCurrCode.focus();
                        //Show the alert message
                        radalert('Please enter the Currency Code.', 330, 100, 'Currencies');
                        return false;
                         
                    }
 
                    //Check for Currency Name empty
                    var txtCurrName = $find("<%= txtCurrencyName.ClientID %>");
                    if (txtCurrName.isEmpty() == true) {
                        //Show the alert message
                        radalert('Please enter the Currency Name.', 330, 100, 'Currencies');
                        return false;
                        //Set the Focus
                        txtCurrName.focus();
 
                    }
                }
            }
 
 
 
            //Confirmation messagebox function
 
            var lastClickedItem = null;           
            var clickCalledAfterRadconfirm = false;
            function onClientButtonClicking(sender, args) {
            //Confirmation Messagebox for Delete button
                if (args.get_item().get_index() == "3") {
                    if (!clickCalledAfterRadconfirm) {
                        args.set_cancel(true);
                        lastClickedItem = args.get_item();
                        radconfirm("Are you sure you want to delete the currency?", confirmCallbackFunction,330, 100, null, 'Currencies');
                    }
                }
                //Confirmation Messagebox for Browse,Add,Search button
                if (args.get_item().get_index() == "0" || args.get_item().get_index() == "1" || args.get_item().get_index() == "4" || args.get_item().get_index() == "5" || args.get_item().get_index() == "6" || args.get_item().get_index() == "7") {
                    var button = $find("<%= btnAdd.ClientID %>");
                    var txtCurrCode = $find("<%= txtCurrencyCode.ClientID %>");
                    var txtCurrName = $find("<%= txtCurrencyName.ClientID %>");
                    var txtNumericCode = $find("<%= txtNumericCode.ClientID %>");              
                    //Check if any text is there in the controls
                    if (txtCurrCode.isEmpty() != true || txtCurrName.isEmpty() != true || txtNumericCode.isEmpty() != true) {
                        if (button.get_text() == "Add" || button.get_text() == "Update") {
                            if (!clickCalledAfterRadconfirm) {
                                args.set_cancel(true);
                                lastClickedItem = args.get_item();
                                radconfirm("Any unsaved data will be lost. Do you wish to continue ?", confirmCallbackFunction, 330, 100, null, 'Currencies');
                            }
                        }
                     
                    }
                }
            }
 
            //Call Back function for Confirmation Messagebox
            function confirmCallbackFunction(args) {
                         if (args) {
                    clickCalledAfterRadconfirm = true;
                    lastClickedItem.click();
                }
                else
                    clickCalledAfterRadconfirm = false;
                lastClickedItem = null;
            }
 
            //Call Back function for Cancel Confirmation Messagebox
            function CancelconfirmCallbackFunction(args) {
                 
                if (args) {
                    clickCalledAfterRadconfirm = true;
                    //lastClickedItem.click();
                    //Obtain a reference to the  parent window manager
                    var oManager = GetRadWindow().get_windowManager();
                    //Close the window
                    oManager.closeActiveWindow();
                }
                else
                    clickCalledAfterRadconfirm = false;
                lastClickedItem = null;
            }
            
            //Get a reference to existing window
            function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow)
                    oWindow = window.radWindow;
                else if (window.frameElement.radWindow)
                    oWindow = window.frameElement.radWindow;
                return oWindow;
            }          
             
                       
        </script>          
        </telerik:RadCodeBlock>
    <telerik:RadSplitter runat="Server" ID="RadSplitter1" Width="100%" BorderSize="0"
            BorderStyle="Inset" PanesBorderSize="1" Orientation="Horizontal"
            VisibleDuringInit="false">
        <telerik:RadPane ID="RadPane1" runat="server">      
            <%--<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1"> --%>     
             <telerik:RadToolBar ID="RadToolBar1" runat="server" Width="99%"
                Height="22px" style="position:absolute;top:1px; left:1px" OnClientButtonClicking="onClientButtonClicking">
            <Items>
                <telerik:RadToolBarButton ToolTip="NEW" ImageUrl="../Images/add.png" />                       
                        <telerik:RadToolBarButton ToolTip="SEARCH" ImageUrl="../Images/search16.png" />
                        <telerik:RadToolBarButton ToolTip="EDIT" ImageUrl="../Images/edit.png" />
                        <telerik:RadToolBarButton ToolTip="DELETE" ImageUrl="../Images/del.png" />                   
                        <telerik:RadToolBarButton ToolTip="FIRST" ImageUrl="../Images/first16.png" />
                        <telerik:RadToolBarButton ToolTip="PREVIOUS" ImageUrl="../Images/back16.png" />
                        <telerik:RadToolBarButton ToolTip="NEXT" ImageUrl="../Images/play16.png" />
                        <telerik:RadToolBarButton ToolTip="LAST" ImageUrl="../Images/last16.png" />
                        <telerik:RadToolBarButton ToolTip="SAVE AS" ImageUrl="../Images/saveas.gif" />
                        <telerik:RadToolBarButton ToolTip="BASE-DOCUMENT" ImageUrl="../Images/baseDoc.png" />
                        <telerik:RadToolBarButton ToolTip="TARGET-DOCUMENT" ImageUrl="../Images/targetDoc.png" />
                        <telerik:RadToolBarButton ToolTip="PRINT-PREVIEW" ImageUrl="../Images/print_preview.png" />
                        <telerik:RadToolBarButton ToolTip="PRINT" ImageUrl="../Images/Printer.png" />
                        <telerik:RadToolBarButton ToolTip="COPY-TO" ImageUrl="../Images/copyTo.png" />
                        <telerik:RadToolBarButton ToolTip="COPY-FROM" ImageUrl="../Images/copyFrom.png" />                       
                         
            </Items>
             
         </telerik:RadToolBar>
      
         <div style="margin-left:30px; margin-top:50px;font-size:11px;">
            <table>
                           <tr>
                              <td width="110px"><span style="color: #0F3789;">Currency Code</span> </td>
                              <td width="250px">
                                  <telerik:RadTextBox ID="txtCurrencyCode" runat="server" width="200px"
                                      MaxLength="25" onkeydown="return KeyDownAlphaNumeric(event)"></telerik:RadTextBox>
                              </td>                                         
                           </tr>
                           <tr>
                               <td><span style="color: #0F3789;">Currency Name</span></td>
                               <td><telerik:RadTextBox ID="txtCurrencyName" runat="server" width="200px"
                                       MaxLength="100" >
                                       <ClientEvents OnKeyPress="AlphabetOnly" />
                                       </telerik:RadTextBox>                                   
                                      </td>
                           </tr
                            <tr>
                               <td><span style="color: #0F3789;">International Code</span></td>
                               <td><telerik:RadTextBox ID="txtNumericCode" runat="server" width="200px"
                                       MaxLength="50" onkeydown="return KeyDownAlphaNumeric(event)" /></td>
                           </tr>
                           <tr>
                           <td>
                               <telerik:RadButton ID="btnAdd" runat="server" Text="Add" OnClientClicking="OnClientClicking" Width="50px">
                               </telerik:RadButton>
                           </td>
                           <td><telerik:RadButton ID="btnCancel" runat="server" Text="Cancel" OnClientClicking="OnClientClicking" Width="50px">
                               </telerik:RadButton></td>
                           </tr>                                                        
                        </table>
         </div>
         <%--</telerik:RadAjaxPanel>--%>
    </telerik:RadPane>   
  </telerik:RadSplitter>
   
    </div>
 
    </form>
</body>
</html>
Imports BNB.ELL
Imports BNB.BLL
Imports BNB.DAL
Public Class frmCurrencies
    Inherits System.Web.UI.Page
 
#Region "Variable Decleration"
 
    ''' <summary>
    ''' Entity Layer Object Initialisation
    ''' </summary>
    ''' <remarks></remarks>
    Public objELCurrencies As New ELCurrencies
 
    ''' <summary>
    ''' Business Layer Object Initialisation
    ''' </summary>
    ''' <remarks></remarks>
    Public objBLCurrencies As New BLCurrencies
 
    ''' <summary>
    ''' Data Layer Object Initialisation
    ''' </summary>
    ''' <remarks></remarks>
    Public objDLCurrencies As New DLCurrencies
 
    ''' <summary>
    ''' Dataset to hold the browsing data
    ''' </summary>
    ''' <remarks></remarks>
    Public dsBrowse As DataSet
 
 
    Public rowNum As Integer
 
#End Region
 
#Region "Methods"
 
    ''' <summary>
    ''' This method is used to clear the controls
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub ClearControls()
        txtCurrencyCode.Text = ""
        txtCurrencyName.Text = ""
        txtNumericCode.Text = ""
    End Sub
 
    ''' <summary>
    ''' This Method is used for enabling or disabling controls
    ''' </summary>
    ''' <param name="enabledisable">True:Enables the controls
    ''' False:Disables the controls</param>
    ''' <remarks>True:Enables the controls
    ''' False:Disables the controls</remarks>
    Private Sub EnableDisableControls(ByVal enabledisable As Boolean)
        txtCurrencyCode.Enabled = enabledisable
        txtCurrencyName.Enabled = enabledisable
        txtNumericCode.Enabled = enabledisable
 
    End Sub
    ''' <summary>
    ''' This Method is used to set the form mode
    ''' </summary>
    ''' <param name="mode">0:New Mode
    ''' 1:Search Mode
    ''' 2:Browse Mode
    ''' 3:Edit Mode</param>
    ''' <remarks>Pass Integer Value</remarks>
    Private Sub FormMode(ByVal mode As Integer)
        Select Case mode
            Case "0" 'Add Mode
                'Disable New Record
                RadToolBar1.Items(0).Enabled = False
                'Disable Save As
                RadToolBar1.Items(8).Enabled = False
                'Disable Base Document
                RadToolBar1.Items(9).Enabled = False
                'Disable Target Document
                RadToolBar1.Items(10).Enabled = False
                'Disable Print Preview Document
                RadToolBar1.Items(11).Enabled = False
                'Disable Print
                RadToolBar1.Items(12).Enabled = False
                'Disable Copy To
                RadToolBar1.Items(13).Enabled = False
                'Disable Copy From
                RadToolBar1.Items(14).Enabled = False
 
                'Disable Delete
                RadToolBar1.Items(3).Enabled = False
 
                'Disable Edit
                RadToolBar1.Items(2).Enabled = False
 
                'Enable the Search
                RadToolBar1.Items(1).Enabled = True
 
                'Change the button text to Add
                btnAdd.Text = "Add"
 
                'Focus the Main Textbox
                txtCurrencyCode.Focus()
 
            Case "1" 'Find Mode
                'Disable the Search
                RadToolBar1.Items(1).Enabled = False
                'Enable the New
                RadToolBar1.Items(0).Enabled = True
                'Disable Save As
                RadToolBar1.Items(8).Enabled = False
                'Disable Base Document
                RadToolBar1.Items(9).Enabled = False
                'Disable Target Document
                RadToolBar1.Items(10).Enabled = False
                'Disable Print Preview Document
                RadToolBar1.Items(11).Enabled = False
                'Disable Print
                RadToolBar1.Items(12).Enabled = False
                'Disable Copy To
                RadToolBar1.Items(13).Enabled = False
                'Disable Copy From
                RadToolBar1.Items(14).Enabled = False
                'Disable the Delete
                RadToolBar1.Items(3).Enabled = False
                'Disable the Edit
                RadToolBar1.Items(2).Enabled = False
 
 
                'Change the text to Search
                btnAdd.Text = "Search"
                'Focus the Main Textbox
                txtCurrencyCode.Focus()
 
 
            Case "2" 'Browse Mode
                'Enable the New
                RadToolBar1.Items(1).Enabled = True
                'Enable the Search
                RadToolBar1.Items(0).Enabled = True
                'Enable the Edit
                RadToolBar1.Items(2).Enabled = True
                'Enable the Save As
                RadToolBar1.Items(8).Enabled = True
                'Disable Print Preview Document
                RadToolBar1.Items(11).Enabled = True
                'Disable Print
                RadToolBar1.Items(12).Enabled = True
                'Enable the Delete
                RadToolBar1.Items(3).Enabled = True
 
                'Change the text to Ok
                btnAdd.Text = "Ok"
 
 
            Case "3" 'Edit Mode
                'Disable Save As
                RadToolBar1.Items(8).Enabled = False
                'Disable Base Document
                RadToolBar1.Items(9).Enabled = False
                'Disable Target Document
                RadToolBar1.Items(10).Enabled = False
                'Disable Print Preview Document
                RadToolBar1.Items(11).Enabled = False
                'Disable Print
                RadToolBar1.Items(12).Enabled = False
                'Disable Copy To
                RadToolBar1.Items(13).Enabled = False
                'Disable Copy From
                RadToolBar1.Items(14).Enabled = False
                'Disable the Delete
                RadToolBar1.Items(3).Enabled = False
                'Disable the Edit
                RadToolBar1.Items(2).Enabled = False
                'Change the text to Ok
                btnAdd.Text = "Update"
 
 
 
        End Select
 
    End Sub
 
#End Region
 
#Region "Properties"
 
 
#End Region
 
#Region "Events"
 
    ''' <summary>
    ''' Event for Page Load
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks>Page Initialisation Code</remarks>
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Page.IsPostBack = False Then
            Try
                'Set the Form Mode to New
                FormMode(0)
 
                'Enable Controls
                EnableDisableControls(True)
 
                'Set the focus
                txtCurrencyCode.Focus()
 
            Catch ex As Exception
 
            Finally
 
            End Try
        End If
    End Sub
 
    ''' <summary>
    ''' ToolBar Event
    ''' </summary>
    ''' <param name="sender"></param>
    ''' <param name="e"></param>
    ''' <remarks></remarks>
    Private Sub RadToolBar1_ButtonClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadToolBarEventArgs) Handles RadToolBar1.ButtonClick
        Try
            Select Case e.Item.Index
 
                Case "0" 'New Button
 
                    'Set The Form Mode
                    FormMode(0)
 
                    'Clear the controls
                    ClearControls()
 
                    'Enable Controls
                    EnableDisableControls(True)
 
                    'Set the focus
                    txtCurrencyCode.Focus()
 
                Case "1" 'Search Button
 
                    FormMode(1)
 
                    'Clear Controls
                    ClearControls()
 
                    'Enable Controls
                    EnableDisableControls(True)
 
                    'Set the Focus
                    txtCurrencyCode.Focus()
 
                Case "2" 'Edit Button
 
                    FormMode(3)
 
                    'Enable Controls
                    EnableDisableControls(True)
 
                    'Disable the Primary key field
                    txtCurrencyCode.Enabled = False
 
                    'Set the Focus
                    txtCurrencyName.Focus()
 
                Case "3" 'Delete Button
                    ' Call the Entity Layer
                    objELCurrencies.CurrencyCode = txtCurrencyCode.Text
                    'Call Business Layer Update Method
                    If objBLCurrencies.Delete(objELCurrencies) = True Then
 
                        'Display the Message to user                      
                        Dim radalertscript As String = "<script language='javascript'>function f(){radalert('Record Deleted Sucessfully', 330, 100,'Currencies'); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>"
                        Page.ClientScript.RegisterStartupScript(Me.[GetType](), "Deleteradalert", radalertscript)
 
                        'Set the Form mode to search
                        FormMode(1)
 
                        'Clear Controls
                        ClearControls()
 
                        'Enable Controls
                        EnableDisableControls(True)
 
                        'Set the Focus
                        txtCurrencyCode.Focus()
                    Else
 
                    End If
 
 
                Case "4" 'First Record Browse button
 
                    'Enable Controls
                    EnableDisableControls(True)
 
                    'Intialise the DataSet
                    dsBrowse = New DataSet()
 
                    'get the data
                    dsBrowse = objDLCurrencies.GetAllData()
 
                    'Set the first record data
                    txtCurrencyCode.Text = dsBrowse.Tables(0).Rows(0)(0).ToString()
                    txtCurrencyName.Text = dsBrowse.Tables(0).Rows(0)(1).ToString()
                    txtNumericCode.Text = dsBrowse.Tables(0).Rows(0)(2).ToString()
 
                    'Set the form mode
                    FormMode(2)
 
                    'Disable the Controls
                    EnableDisableControls(False)
 
                Case "5" 'Previous record Browse button
                    'Intialise the DataSet
                    dsBrowse = New DataSet()
 
                    'get the data
                    dsBrowse = objDLCurrencies.GetPreviousRecord(txtCurrencyCode.Text)
 
                    txtCurrencyCode.Text = dsBrowse.Tables(0).Rows(dsBrowse.Tables(0).Rows.Count - 1)(0).ToString
                    txtCurrencyName.Text = dsBrowse.Tables(0).Rows(dsBrowse.Tables(0).Rows.Count - 1)(1).ToString
                    txtNumericCode.Text = dsBrowse.Tables(0).Rows(dsBrowse.Tables(0).Rows.Count - 1)(2).ToString
 
                    'Set the form mode
                    FormMode(2)
 
                    'Disable the Controls
                    EnableDisableControls(False)
 
 
                Case "6" 'Next record Browse button
                    'Intialise the DataSet
                    dsBrowse = New DataSet()
 
                    'get data
                    dsBrowse = objDLCurrencies.GetPreviousRecord(txtCurrencyCode.Text)
 
                    txtCurrencyCode.Text = dsBrowse.Tables(0).Rows(dsBrowse.Tables(0).Rows.Count - 1)(0).ToString
                    txtCurrencyName.Text = dsBrowse.Tables(0).Rows(dsBrowse.Tables(0).Rows.Count - 1)(1).ToString
                    txtNumericCode.Text = dsBrowse.Tables(0).Rows(dsBrowse.Tables(0).Rows.Count - 1)(2).ToString
 
                    'Set the form mode
                    FormMode(2)
 
                    'Disable the Controls
                    EnableDisableControls(False)
 
                Case "7" 'Last record Browse button
                    'row Number
                    Dim rowNum As Integer = 0
                    'Intialise the DataSet
                    dsBrowse = New DataSet()
 
                    'get the data
                    dsBrowse = objDLCurrencies.GetAllData()
                    rowNum = dsBrowse.Tables(0).Rows.Count - 1
 
                    'Set the last record data
                    txtCurrencyCode.Text = dsBrowse.Tables(0).Rows(rowNum)(0).ToString()
                    txtCurrencyName.Text = dsBrowse.Tables(0).Rows(rowNum)(1).ToString()
                    txtNumericCode.Text = dsBrowse.Tables(0).Rows(rowNum)(2).ToString()
 
                    'Set the form mode
                    FormMode(2)
 
                    'Disable the Controls
                    EnableDisableControls(False)
 
                Case "8" 'Save As
 
                    'Set the form mode to Add
                    FormMode(0)
 
                    'Enable the Controls
                    EnableDisableControls(True)
 
                    'Clear the Primary Key field and set focus
                    txtCurrencyCode.Text = String.Empty
                    txtCurrencyCode.Focus()
 
            End Select
        Catch ex As Exception
 
        End Try
    End Sub
#End Region
 
 
 
 
 
    Private Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click
        Try
            Select Case btnAdd.Text
                Case "Add"
                    'Call the Entity Layer
                    objELCurrencies.CurrencyCode = txtCurrencyCode.Text
                    objELCurrencies.CurrencyName = txtCurrencyName.Text
                    objELCurrencies.CurrencyInternationalCode = txtNumericCode.Text
                    objELCurrencies.UserCode = ""
                    objELCurrencies.URI = ""
                    objELCurrencies.CreateDate = DateTime.Now
                    objELCurrencies.UpdateDate = DateTime.Now
 
                    'Call Business Layer Create Method
                    If objBLCurrencies.Create(objELCurrencies) = True Then
 
 
                        'Display the Message to user
                        Dim radalertscript As String = "<script language='javascript'>function f(){radalert('Record Saved Sucessfully', 330, 100,'Currencies'); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>"
                        Page.ClientScript.RegisterStartupScript(Me.[GetType](), "radalert", radalertscript)
 
                        'Clear the controls
                        ClearControls()
                        'Set the form mode
                        FormMode(0)
                        'set the form mode
                        txtCurrencyCode.Focus()
                    Else
 
                    End If
                Case "Update"
                    'Call the Entity Layer
                    objELCurrencies.CurrencyCode = txtCurrencyCode.Text
                    objELCurrencies.CurrencyName = txtCurrencyName.Text
                    objELCurrencies.CurrencyInternationalCode = txtNumericCode.Text
                    objELCurrencies.UserCode = ""
                    objELCurrencies.URI = ""
                    objELCurrencies.CreateDate = DateTime.Now
                    objELCurrencies.UpdateDate = DateTime.Now
 
                    'Call Business Layer Update Method
                    If objBLCurrencies.Update(objELCurrencies) = True Then
 
 
 
                        'Display the Message to user                      
                        Dim radalertscript As String = "<script language='javascript'>function f(){radalert('Record Updated Sucessfully', 330, 100,'Currencies'); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>"
                        Page.ClientScript.RegisterStartupScript(Me.[GetType](), "Updateradalert", radalertscript)
 
                        'Set the Form Mode
                        FormMode(2)
 
                        'Disable Controls
                        EnableDisableControls(False)
 
                    Else
 
                    End If
 
                Case "Ok"
 
                Case "Search"
                    If txtCurrencyCode.Text <> String.Empty Or txtCurrencyName.Text <> String.Empty Or txtNumericCode.Text <> String.Empty Then
                        'Intialise the DataSet
                        dsBrowse = New DataSet()
 
                        'get the data
                        dsBrowse = objDLCurrencies.SearchRecord(txtCurrencyCode.Text, txtCurrencyName.Text, txtNumericCode.Text)
 
                        'Set the first record data
                        txtCurrencyCode.Text = dsBrowse.Tables(0).Rows(0)(0).ToString()
                        txtCurrencyName.Text = dsBrowse.Tables(0).Rows(0)(1).ToString()
                        txtNumericCode.Text = dsBrowse.Tables(0).Rows(0)(2).ToString()
                        txtCurrencyCode.Enabled = False
 
                        'Set the form mode
                        FormMode(2)
 
                        'Disable Controls
                        EnableDisableControls(False)
 
                    End If
 
            End Select
        Catch ex As Exception
        Finally
        End Try
    End Sub
 
 
End Class
Noor hussain
Top achievements
Rank 1
 answered on 27 Apr 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?