Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
148 views
I have a grid that uses a RADCombo for selection values in a row.  When I select 'Edit' Ive put some code in the ItemCreated event that populates the dropdown from a custom object.  This all works fine except that the dropdown list always shows the first item in the list.  I need to pre-select the value in the dropdown that matches the value in the grid

eg  in the grid column I have "80's"

the drop down has 2 values  "70's"  and "80's" and it always shows "70's" as the value when in fact is should be "80's"

How can I get the value from the cell to pre-select the value ?

Heres how im getting the drop down
protected void RadGridSecondaryCategories_ItemDataBound(object sender, GridItemEventArgs e)  
        {  
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)  
            {  
                  
           
 
 
                GridEditableItem _item = (GridEditableItem)e.Item;  
                  
 
                Telerik.Web.UI.RadComboBox cb = (Telerik.Web.UI.RadComboBox)_item["Category"].FindControl("RadComboBoxCategories");  
                cb.DataSource = categorymanager.Categories(this.RadComboBoxArtistGenre.SelectedValue, this.RadComboBoxType.SelectedValue);  
                cb.DataTextField = "Category";  
                cb.DataValueField = "Category";  
                cb.DataBind();  
                  
 
                //TO DO:  
                //put code here to find the item in the dropdown from the database  
 
                TableCell cell = _item["Category"];  
                  
 
                int index = this.RadComboBoxCategories.FindItemIndexByValue();--- need to get the cell value and put it here  
                cb.SelectedIndex = index;  
 
                  
            }  
        } 
Princy
Top achievements
Rank 2
 answered on 20 Oct 2008
5 answers
361 views
Hi

I'm not sure if this post belongs here in RadCalendar or for RadDateInput.

Basically I have some RadDateInputs that share a common RadCalendar.

I know how to highlight Today's date in the RadCalendar, but is that date based on the browser's timezone?

What I need to do is programatically set the timezone from our database (like I do with culture). That way the UTC offset would be correct.

How would I go about doing this?


Kind regards

Mark Eaton
Mark
Top achievements
Rank 1
 answered on 19 Oct 2008
2 answers
124 views
Folks could someone please elaborate on what exactly the set_checkable node method is supposed to do. It does not seem to work or achieve anything. I have just loaded the latest build 2008.2.1001.20 hoping it would but to no avail.

I wanted to be able to hide or show the node checkbox client side depending on some arbitrary criteria.

To get this to work I had to set the checkable property of all the nodes to true server side. Then using the OnClientLoad event I traverse through all the nodes and as follows.

var treeView = $find("<%=radTreeView_Level.ClientID %>");
            if(treeView)
            {
                var nodeList = treeView.get_allNodes();
                for(var i=0; i < nodeList.length; i++)
                {
                    var node = nodeList[i];
                    if(node && node.get_level() > 0)
                    {
                        var chkbox = node.get_checkBoxElement();
                        if(node.get_checked())
                        {
                            chkbox.className = "rtChk";
                        }
                        else
                        {
                            chkbox.className = "hidden";
                        }
                    }
                }
            }

This works fine but seems to be a hack considering theres a set_checkable method that probably should do this for me.

Tks H





Nate
Top achievements
Rank 1
 answered on 19 Oct 2008
3 answers
282 views
After upgrading to RadControls for ASP.NET ( not ASP.NET AJAX ) my client-side validation does not perform properly.  The code below puts the function into an infinite loop.

function ValidateLongitude(sender, args)
{
    var newValue = String(args.NewValue);
    if( newValue.charAt(0) != '-' )
    {
        newValue = '-' + newValue;
        sender.SetValue(newValue);
    }

    if( newValue.length >= 4 && newValue.indexOf('.') < 0 )
    {
        if( newValue.substring(0,4) < -520 )
        {
            newValue = newValue.substring(0,3) + '.' + newValue.substring(3);
        }else{
            newValue = newValue.substring(0,4) + '.' + newValue.substring(4);
        }
        sender.SetValue(newValue);
    }   
   
    if( newValue != '' && (newValue > -52 || newValue < -142 ))
    {
        sender.SetValue('');
    }
}

Given the code below does not cause an infinite loop, can you explain why Telerik is calling the OnValueChanged every time we try to set the text box to a new value?
<html>
<head>
<script>
function BlurIt()
{
var x = document.getElementById("txtID");
x.value = "new value";
}
</script>
</head>
<body>
<form>
<input type="text" id="txtID" onblur="BlurIt();">
</form>
</body>
</html>

And upgrading to Asp.net AJAX is not option.

Lee Christensen
Top achievements
Rank 1
 answered on 19 Oct 2008
2 answers
237 views
If I modify a RadTextBox's value using its set_value() method, will its OnValueChanged event be raised?
Steele
Top achievements
Rank 1
 answered on 19 Oct 2008
4 answers
148 views
Hi,

I attached an event on OnGridDestroying that checks if the grid has been changed and asks the user to save the changes.
But i always get the error: Microsoft JScript runtime error: Sys.InvalidOperationException: ScriptLoader.loadScripts cannot be called while the ScriptLoader is already loading scripts.

I don't get this error when i attach this handler to another event like onclick.
Somebody who knows the reason?

This error only happens in IE. firefox doesn't give this error.

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
<script type="text/javascript"
    var hasChanges, inputs; 
 
    function GridCreatedEventHandler(sender, eventArgs) 
    { 
        var gridElement = sender.get_element(); 
        var elementsToUse = []; 
        inputs = gridElement.getElementsByTagName("input"); 
        for (var i = 0; i < inputs.length;i++) 
        { 
            if(inputs[i].type.toLowerCase() == "hidden") 
            { 
                continue; 
            }         
            Array.add(elementsToUse, inputs[i]); 
            inputs[i].onchange = OnChangeEventHandler
        } 
        setTimeout(function(){if(elementsToUse[0])elementsToUse[0].focus();},100); 
    } 
     
    function GridDestroyingEventHandler(sender, eventArgs) 
    { 
        if(hasChanges) 
        { 
            if(confirm("Update changes?")) 
            { 
                hasChanges = false
                var masterTable = $find("<%= grdvGrid.ClientID %>").get_masterTableView(); 
                masterTable.updateEditedItems(); 
            } 
            else 
            { 
                hasChanges = false
            } 
        } 
    } 
 
    function OnChangeEventHandler(e) 
    { 
        hasChanges = true
    } 
</script> 
</telerik:RadCodeBlock> 
         
       
<CSystems:GridView ID="grdvGrid" runat="server"
    <ClientSettings> 
        <ClientEvents OnGridCreated="GridCreatedEventHandler" OnGridDestroying="GridDestroyingEventHandler"/> 
    </ClientSettings> 
</CSystems:GridView> 


Thx in advance,
Glenn
Levi
Top achievements
Rank 1
 answered on 18 Oct 2008
0 answers
149 views
this is the code i have and i can't get the loading screen to work could someone help and if i click on the button call btnNext1, it supposes to make other asp controls to visible. this works fine if that item is html control like <input typ...... but this doesn't work if i use servercontrol like <asp:button>..... . so the questions are can you make it so that when i click on the asp controls, it will call javascript function to make visiblity becomes true. and second question is how could i include the 

telerik

:RadAjaxManager

 

 

and telerick:radajaxloadingpanel

I tried to but it didn't work.. could you help? thank you.

 

 

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> 
 
<%@ 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 runat="server">  
    <title>Testing Telerik</title> 
</head> 
<body style="background-color: #3d766f;">  
    <form id="Form1" name="myform" runat="server" action="testing.aspx" method="post">  
        <telerik:RadScriptManager ID="ScriptManager1" runat="server">  
        </telerik:RadScriptManager> 
        <telerik:RadAjaxManager EnableAJAX="true" ID="RadAjaxManager1" runat="server">  
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="Button1">  
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadPanelBar1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
        <table id="tableCReports" border="1" cellpadding="0" cellspacing="0" align="center" style="border-color: #3d766f;" width="800px">  
            <tr> 
                <td style="background-color: #ffffff; padding: 5px;">  
                    <table border="0" cellpadding="0" cellspacing="0" width="800px" align="center">  
                        <tr> 
                            <td> 
                                <img src="images/header.jpg" border="0" /></td>  
                        </tr> 
                        <tr> 
                            <td height="5px">  
                            </td> 
                        </tr> 
                        <tr> 
                            <td> 
                                <telerik:RadPanelBar runat="server" ID="RadPanelBar1" Skin="Outlook" Width="400" Height="500px" ExpandMode="FullExpandedItem" AllowCollapseAllItems="true">  
                                    <CollapseAnimation Duration="500" Type="inoutelastic" /> 
                                    <Items> 
                                        <telerik:RadPanelItem Text="Company Reports">  
                                            <Items> 
                                                <telerik:RadPanelItem Value="DDLCReport">  
                                                    <ItemTemplate> 
                                                        <table border="0" cellpadding="7" cellspacing="0">  
                                                            <tr> 
                                                                <td valign="top">  
                                                                    <asp:DropDownList ID="DDLCompanyReport" runat="server">  
                                                                    </asp:DropDownList> 
                                                                </td> 
                                                                <td> 
                                                                    <asp:Button ID="btnNext1" runat="server" Text="Next" /> 
                                                                    &nbsp;  
                                                                    <asp:Button ID="btnSaveAs" Text="Save As" runat="server" /> 
                                                                    <br /> 
                                                                    <asp:TextBox ID="txtFileNameSaveas" runat="server" Text="Enter your file name here" Visible="false"></asp:TextBox> 
                                                                    <asp:Button runat="server" ID="btnSubmitSave" Text="Save" Visible="false" /> 
                                                                </td> 
                                                            </tr> 
                                                        </table> 
                                                    </ItemTemplate> 
                                                </telerik:RadPanelItem> 
                                            </Items> 
                                        </telerik:RadPanelItem> 
                                        <telerik:RadPanelItem Text="My Reports">  
                                            <Items> 
                                                <telerik:RadPanelItem Value="DDLMReport">  
                                                    <ItemTemplate> 
                                                        <table border="0" cellpadding="7" cellspacing="0">  
                                                            <tr> 
                                                                <td valign="top">  
                                                                    <asp:DropDownList ID="DDLMyReports" runat="server">  
                                                                        <asp:ListItem>Grocery Item Movement</asp:ListItem> 
                                                                        <asp:ListItem>Norwalk Weekly Sales</asp:ListItem> 
                                                                        <asp:ListItem>Grocery Labor</asp:ListItem> 
                                                                    </asp:DropDownList> 
                                                                </td> 
                                                                <td valign="top">  
                                                                    <asp:Button ID="btnModifyReport" runat="server" Text="Modify Report" /> 
                                                                    <br /> 
                                                                    <asp:Button ID="btnBuildNewReport" runat="server" Text="Build New Report" /> 
                                                                </td> 
                                                                <td> 
                                                                </td> 
                                                            </tr> 
                                                        </table> 
                                                    </ItemTemplate> 
                                                </telerik:RadPanelItem> 
                                            </Items> 
                                        </telerik:RadPanelItem> 
                                        <telerik:RadPanelItem Text="Date Range">  
                                            <Items> 
                                                <telerik:RadPanelItem Value="DateRange">  
                                                    <ItemTemplate> 
                                                        <table border="0" cellpadding="7" cellspacing="0" align="center">  
                                                            <tr> 
                                                                <td colspan="5">  
                                                                    Date Range</td> 
                                                            </tr> 
                                                            <tr> 
                                                                <td> 
                                                                    <asp:RadioButton ID="rbtnDateRange" runat="server" GroupName="rdGroupDateRange" Checked="true" /> 
                                                                </td> 
                                                                <td> 
                                                                    Date From</td> 
                                                                <td colspan="2">  
                                                                    <telerik:RadDatePicker ID="CalendarDateFrom" runat="server" Calendar-ShowRowHeaders="false" Skin="Web20">  
                                                                    </telerik:RadDatePicker> 
                                                                </td> 
                                                            </tr> 
                                                            <tr> 
                                                                <td> 
                                                                </td> 
                                                                <td> 
                                                                    Date To</td> 
                                                                <td colspan="2">  
                                                                    <telerik:RadDatePicker ID="CalendarDateTo" runat="server" Skin="Web20">  
                                                                    </telerik:RadDatePicker> 
                                                                </td> 
                                                            </tr> 
                                                            <tr> 
                                                                <td colspan="5">  
                                                                    OR</td> 
                                                            </tr> 
                                                            <tr> 
                                                                <td> 
                                                                    <asp:RadioButton ID="rbtnOR" runat="server" GroupName="rdGroupDateRange" /> 
                                                                </td> 
                                                                <td> 
                                                                    From Week</td> 
                                                                <td align="center">  
                                                                    <asp:DropDownList ID="ddlfromweek" runat="server">  
                                                                    </asp:DropDownList> 
                                                                </td> 
                                                                <td> 
                                                                    for year</td> 
                                                                <td> 
                                                                    <asp:DropDownList ID="ddlfromyear" runat="server">  
                                                                    </asp:DropDownList> 
                                                                </td> 
                                                            </tr> 
                                                            <tr> 
                                                                <td> 
                                                                </td> 
                                                                <td> 
                                                                    To Week</td> 
                                                                <td align="center">  
                                                                    <asp:DropDownList ID="ddltoweek" runat="server">  
                                                                    </asp:DropDownList> 
                                                                </td> 
                                                                <td> 
                                                                    for year  
                                                                </td> 
                                                                <td> 
                                                                    <asp:DropDownList ID="ddltoyear" runat="server">  
                                                                    </asp:DropDownList> 
                                                                </td> 
                                                            </tr> 
                                                            <tr> 
                                                                <td colspan="5" align="center">  
                                                                    <asp:Button ID="btnNextDaterange" runat="server" OnClientClick="OpenItem('Parameters');return false;" Text="Next" /> 
                                                                </td> 
                                                            </tr> 
                                                        </table> 
                                                    </ItemTemplate> 
                                                </telerik:RadPanelItem> 
                                            </Items> 
                                        </telerik:RadPanelItem> 
                                        <telerik:RadPanelItem Text="Parameters">  
                                            <Items> 
                                                <telerik:RadPanelItem Value="Parameters">  
                                                    <ItemTemplate> 
                                                        <table border="0" cellpadding="0" cellspacing="0" width="400px" align="center">  
                                                            <tr> 
                                                                <td colspan="4">  
                                                                    Store(s)</td> 
                                                            </tr> 
                                                            <tr> 
                                                                <td colspan="4">  
                                                                    <asp:CheckBoxList ID="chkboxStores" runat="server" RepeatLayout="Table" RepeatColumns="4" Width="395px" RepeatDirection="Horizontal">  
                                                                    </asp:CheckBoxList> 
                                                                </td> 
                                                            </tr> 
                                                            <tr> 
                                                                <td height="8px">  
                                                                </td> 
                                                            </tr> 
                                                            <tr> 
                                                                <td colspan="4">  
                                                                    Department(s)</td> 
                                                            </tr> 
                                                            <tr> 
                                                                <td colspan="4">  
                                                                    <asp:CheckBoxList ID="chkboxDepts" runat="server" RepeatLayout="Table" RepeatColumns="4" Width="395px" RepeatDirection="Horizontal">  
                                                                    </asp:CheckBoxList> 
                                                                </td> 
                                                            </tr> 
                                                            <tr> 
                                                                <td height="8px">  
                                                                </td> 
                                                            </tr> 
                                                            <tr> 
                                                                <td colspan="3" align="center">  
                                                                    <asp:Button ID="RunReport" runat="server" Text="Run Report" /> 
                                                                </td> 
                                                                <td colspan="2" align="left">  
                                                                    <asp:Button ID="ResetForm" runat="server" Text="Reset Form" /> 
                                                                </td> 
                                                            </tr> 
                                                        </table> 
                                                    </ItemTemplate> 
                                                </telerik:RadPanelItem> 
                                            </Items> 
                                        </telerik:RadPanelItem> 
                                    </Items> 
                                </telerik:RadPanelBar> 
                            </td> 
                        </tr> 
                    </table> 
                </td> 
            </tr> 
        </table> 
        <asp:Label ID="NotAuthorized" Text="You are not authorized to view this page." ForeColor="REd" Font-Size="Large" Visible="false" runat="server"></asp:Label> 
    </form> 
</body> 
</html> 
 

 

 

appdev
Top achievements
Rank 1
 asked on 18 Oct 2008
11 answers
187 views
i have radpanelbar then items then radpanelitem then item then radpanelitem then itemtemplate . then inside this itemtemplate, i have an asp user control and this control is invisble. i could make it visible by doing this

document.getElementById('btnNext').style.visibility='visible';

but this is just regular html <input>. if i do this with user control like <asp:button> it doesn't work. could someone help? Thank you.

appdev
Top achievements
Rank 1
 answered on 18 Oct 2008
7 answers
201 views
I have a grid with 

CommandItemDisplay

 

="Top"

The command bar has an insert button and a refresh button, it all seems to work ok.  The problem is when there are no rows to display in the grid and I want to add one, the commandbar isnt visible so I cant add any rows !

Is there a way around this problem ? Can I have the command bar visible even when there are no rows to display in the grid ?

 

mww
Top achievements
Rank 1
 answered on 18 Oct 2008
3 answers
135 views
I have a Create New User Wizard.  Step 3 of the wizard I am using Rad Upload.  I have a folder on the server called "upload".  When the user clicks the sumbit button of the Rad Upload  I  need a  a folder  to be created based uopn the  users "UserId" and the files will upload into the newly created folder in the upload folder on the server.  I am unsure how to code the page to perform this action.
I am using VB.
Steve Kaser
Top achievements
Rank 1
 answered on 18 Oct 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?