Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
145 views
I have a page with the code shown below.  I've tried using both var cmbo = $find("<%= cmboUsers.ClientID %>"); and var cmbo = Telerik.Web.UI.RadComboBox.ComboBoxes[0]; code.  The first returns null, while the second returns undefined.  It is only the code in the setInitialUser function that fails.  The javascript in function userChanged, which is called from the OnClientSelectedIndexChanged setting works fine.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="login.aspx.vb" Inherits="login" %> 
 
<%@ 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>Sodexo</title> 
        <link href="CTM.css" rel="stylesheet" type="text/css" /> 
        <link href="Telerik/web/UI/Skins/Optional/ComboBox.Optional.css" rel="stylesheet" type="text/css" /> 
        <link href="Telerik/web/UI/Skins/Required/ComboBox.Required.css" rel="stylesheet" type="text/css" /> 
        <link rel="SHORTCUT ICON" href="Images/PatMedSmall.ico" /> 
        <script language="javascript" type="text/javascript">  
            function fnMaxWindow() {  
                window.moveTo(0, 0);  
                window.resizeTo(screen.width, screen.height);  
            }  
 
            function userChanged(combo, eventArgs) {  
                var item = eventArgs.get_item();  
                var allowBlankPswd = item.get_attributes().getAttribute("AllowBlankPswd");  
                // alert("allowBlankPswd = " + allowBlankPswd);  
                  
                if (allowBlankPswd == 0) {  
                    document.form1.txtPswd.value = "";  
                    document.form1.txtPswd.value = "";  
                    document.form1.txtPswd.readOnly = false;  
                    document.form1.txtPswd.focus();  
                    document.form1.txtPswd.style.background = "#fbf5bb";  
                    setTimeout(function() { document.form1.txtPswd.focus(); }, 100);  
                }  
                else {  
                    // alert("Blank password is allowed!"); // use for debugging only  
                    document.form1.txtPswd.value = "********";  
                    document.form1.txtPswd.readOnly = true;  
                    document.form1.btnSubmit.focus();  
                    document.form1.txtPswd.style.background = "#C0C0C0";  
                    setTimeout(function() { document.form1.btnSubmit.focus(); }, 100);  
                }  
            }  
 
            function fnSaveScreenDimensions() {  
                // save the user's screen dimensions to use throughout the application  
                document.form1.hdnScreenHeight.value = screen.height;  
                document.form1.hdnScreenWidth.value = screen.width;  
            }  
        </script> 
          
</head> 
<body onload="fnMaxWindow(); fnSaveScreenDimensions(); setInitialUser();">  
  <form id="form1" runat="server">  
    <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">  
            <script language="javascript" type="text/javascript">  
                function setInitialUser() {  
                    // var cmbo = $find("<%=cmboUsers.ClientID %>");  
                    var cmbo = Telerik.Web.UI.RadComboBox.ComboBoxes[0];  
                    alert("cmbo = " + cmbo);  
                    var item = cmbo.get_selectedItem();  
                    var allowBlankPswd = item.get_attributes().getAttribute("AllowBlankPswd");  
                    alert("allowBlankPswd = " + allowBlankPswd);  
                    if (allowBlankPswd == 0) {  
                        document.form1.txtPswd.value = "";  
                        document.form1.txtPswd.value = "";  
                        document.form1.txtPswd.readOnly = false;  
                        document.form1.txtPswd.focus();  
                        document.form1.txtPswd.style.background = "#fbf5bb";  
                        setTimeout(function() { document.form1.txtPswd.focus(); }, 100);  
                    }  
                    else {  
                        // alert("Blank password is allowed!"); // use for debugging only  
                        document.form1.txtPswd.value = "********";  
                        document.form1.txtPswd.readOnly = true;  
                        document.form1.btnSubmit.focus();  
                        document.form1.txtPswd.style.background = "#C0C0C0";  
                        setTimeout(function() { document.form1.btnSubmit.focus(); }, 100);  
                    }  
                }  
            </script>         
        </telerik:RadCodeBlock> 
        <telerik:RadSplitter ID="spltPage" runat="server" BorderSize="0" VisibleDuringInit="false"   
            BorderStyle="None" Skin="Default" Height="100%" Width="100%">  
            <telerik:RadPane ID="paneImages" runat="server" BorderStyle="None" Scrolling="None"   
                Width="15%" Height="100%" BackColor="#986633">  
                <img src="Images/bw_photo.jpg" id="Img1" alt="Welcome!" height="80%" width="100%" /> 
                <table cellpadding="0" cellspacing="0" border="0" class="Wide">  
                    <tr> 
                        <td align="center" valign="middle">  
                            <img src="Images/sodexo_black_trans_small.png" id="Img2" alt="Sodexo" style="margin-top: 15px;" /> 
                        </td> 
                    </tr> 
                </table> 
            </telerik:RadPane> 
            <telerik:RadPane ID="paneBody" runat="server" BorderStyle="None" Scrolling="None" BackColor="#9CAC57">  
                <telerik:RadSplitter ID="spltBody" runat="server" BorderSize="0" Orientation="Horizontal"   
                    BorderStyle="None" Skin="Default" Height="100%" HeightOffset="50" Width="100%" > 
                    <telerik:RadPane ID="paneMain" runat="server" BorderStyle="None" Scrolling="None"   
                        Width="100%">  
                        <telerik:RadSplitter ID="spltMain" runat="server" BorderSize="0" Orientation="Vertical" 
                            BorderStyle="None" Skin="Default" Width="100%" Height="100%">  
                            <telerik:RadPane ID="paneMiddle" runat="server" BorderStyle="None" Scrolling="None" BackColor="#9CAC57">  
                                <table class="Wide" cellpadding="0" cellspacing="0" border="0" style="height: 100%;">  
                                    <tr> 
                                        <td style="height: 50%;" valign="bottom" align="right">  
                                            <asp:Image ID="imgApp" runat="server" style="margin-right: 0px;" /> 
                                        </td> 
                                        <td style="width: 30%;" rowspan="2">&nbsp;</td> 
                                    </tr> 
                                    <tr> 
                                        <td style="height: 30%;" valign="top" align="right">  
                                            <div style="margin-right: 25px;">  
                                                <asp:Label ID="lblUsers" runat="server" AssociatedControlID="cmboUsers"   
                                                    Text="Users: " /> 
                                                <telerik:RadComboBox ID="cmboUsers" runat="server" EnableEmbeddedSkins="false" 
                                                    Skin="Required" ToolTip="Please select your user ID" Width="300px"    
                                                    OnClientSelectedIndexChanged="userChanged" MarkFirstMatch="true" /> 
                                                <br /><br /> 
                                                <asp:Label ID="lblPswd" runat="server" AssociatedControlID="txtPswd" Text="Password: " /> 
                                                <asp:TextBox ID="txtPswd" runat="server" MaxLength="20" CssClass="Required"   
                                                    TextMode="Password" ToolTip="Please enter your password" Width="295px" /> 
                                                <br /><br /> 
                                                <asp:Button ID="btnSubmit" runat="server" CssClass="stdbutton" Text="Sign On" /> 
                                                <br /> 
                                                <asp:Label ID="lblMsg" runat="server" Width="300px" >Please select your user ID and enter your password</asp:Label> 
                                                <asp:ValidationSummary ID="valSummary" runat="server" CssClass="ErrMsg" DisplayMode="List" Width="300px"  /> 
                                                <asp:RequiredFieldValidator ID="valrUser" runat="server" ControlToValidate="cmboUsers"   
                                                    Display="None" ErrorMessage="You must select a user" SetFocusOnError="true" /> 
                                                <asp:RequiredFieldValidator ID="valrPswd" runat="server" ControlToValidate="txtPswd"   
                                                    Display="None" ErrorMessage="You must enter a password" SetFocusOnError="true" /> 
                                                <asp:CustomValidator ID="valxUsers" runat="server" ControlToValidate="cmboUsers"   
                                                    Display="None" ErrorMessage="Invalid User / Password combination" SetFocusOnError="true" /> 
                                            </div> 
                                        </td> 
                                    </tr> 
                                    <tr> 
                                        <td valign="bottom" colspan="2">  
                                            <hr style="width: 90%;" /> 
                                            <table class="Wide" cellpadding="0" cellspacing="0" border="0">  
                                                <tr> 
                                                    <td class="LoginNote">  
                                                        <img src="images/triangle.jpg" alt="Note" /> 
                                                    </td> 
                                                    <td> 
                                                        <asp:Literal ID="litContact" runat="server" Text="Welcome!" /> 
                                                    </td> 
                                                </tr> 
                                            </table> 
                                        </td> 
                                    </tr> 
                                </table> 
                            </telerik:RadPane> 
                            <telerik:RadPane ID="paneRight" runat="server" BorderStyle="None" Scrolling="None" BackColor="#9CAC57" Width="150px">  
                                <telerik:RadMenu ID="menuTutorials" runat="server" Skin="Default" dir="rtl">  
                                </telerik:RadMenu> 
                            </telerik:RadPane> 
                        </telerik:RadSplitter> 
                    </telerik:RadPane> 
                    <telerik:RadPane ID="paneBottom" runat="server" BorderStyle="None" Scrolling="None" 
                        Width="100%" Height="50px">  
                        <span style="float: right;">  
                            <img src="images/patients.jpg" alt="Patients are where the heart is" /> 
                        </span> 
                    </telerik:RadPane>   
                </telerik:RadSplitter> 
            </telerik:RadPane> 
        </telerik:RadSplitter> 
    <asp:HiddenField ID="hdnApp" runat="server" /> 
    <asp:HiddenField ID="hdnScreenHeight" runat="server" /> 
    <asp:HiddenField ID="hdnScreenWidth" runat="server" /> 
  </form> 
</body> 
</html> 
 


How can I get a reference to the combobox to get the selected item?
Steve LaForge
Top achievements
Rank 1
 answered on 07 May 2009
3 answers
122 views
Hi

I am trying to setup a grid so that a user can filter using the keyboard.
Currently, if the user tabs to a filter control and hits the enter key the filter menu opens in the top left corner of the screen:

http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/filtering/defaultcs.aspx

Is it possible to have the menu open next to the filter button?

Cheers
Aaron
Iana Tsolova
Telerik team
 answered on 07 May 2009
3 answers
257 views
Hi,
I am trying to dynamically load some user controls into the nested view template when the row is expanded but nothing seems to work. I read all posts regarding nestedViewTemplate and couldn't find an answer.
Does anybody know how this can be done (if it can)?

Mario
Sebastian
Telerik team
 answered on 07 May 2009
0 answers
118 views
Hello

i am trying to drap and drop from one treeview to another

as soon as i select and try to drag the item, i get the "visual studio Just-In-Time debugger"  popup saying:
"an unhandled exception ('Object expected') occured in iexplore.exe"

when i click "Yes" to debug, the debugger point the runtime error here:

ClientMove(RadTreeViewGlobalFirstParam, RadTreeViewGlobalSecondParam, RadTreeViewGlobalThirdParam, RadTreeViewGlobalFourthParam);

this page works on other servers
could someone help please?

vaz
Top achievements
Rank 1
 asked on 07 May 2009
1 answer
146 views
Hi.

It's possible to define your own skin for a RadChart element? If it is, how can I do it?

Thanks.
Dessy
Telerik team
 answered on 07 May 2009
1 answer
140 views

Hi,

I have a RadToolBar on my page. It should be called a client side javascript and therefore I use the OnClientButtonClicked event. If I render the page I get the following error:

Message: Expected '}'
Line: 783
Char: 447
Code: 0

This is what is generated on client:

$create(Telerik.Web.UI.RadToolBar, {"_skin":"Default","attributes":{},"clientStateFieldID":"ucDetails_Address_ClientState","collapseAnimation":"{\"duration\":450}","expandAnimation":"{\"duration\":450}","itemData":[{"items":[{"value":"1","cssClass":"rtbWrap"},{"value":"2","cssClass":"rtbWrap"}],"type":2}]}, {"buttonClicked":onAddress(this'Adress'); return false;}, null, $get("ucDetails_Address")); 

This is my code on ascx:

<telerik:RadToolBar ID="Address" runat="server" OnClientButtonClicked="onAddress(this, 'Adress'); return false;"></telerik:RadToolBar> 

I add the buttons as SplitButtons server side by xml.The message is right. The generated code is not well formed. Do you have any suggestion?

Yana
Telerik team
 answered on 07 May 2009
1 answer
193 views
I switched my line chart to percent with this piece of code:

RadChart2.PlotArea.YAxis.Appearance.ValueFormat = Telerik.Charting.Styles.

ChartValueFormat.Percent;

Now the line shows the correct values, but the scale show for example 3.500,00%. If I divide my input value with 100 the scale is right (35%) but the line shows 0.33%. Do I need to set something else for displaing percent?

 

Dessy
Telerik team
 answered on 07 May 2009
2 answers
492 views

I'm using the below function to show a window, but the code for the pages that I'm showing is being executed twice
once with seturl and once with show.
What am I doing wrong to cause this?

If i remove the oWnd.Show() my window opens with the URL page being executed, but you can't close the window.

function OpenFeatureWindow(URL) {  
try {  
    var oWnd = $find("<%= Features.ClientID %>");  
    oWnd.set_height(document.documentElement.clientHeight - 75);  
    oWnd.set_width(document.documentElement.clientWidth - 50);  
    oWnd.center();  
    oWnd.Show(); 
    } catch (e) 
    {  
    alert(e); 
}  
}  
 

<telerik:RadWindowManager ID="RadWindowManager1" runat="server" Behavior="Default" 
        InitialBehavior="None" EnableViewState="true" DestroyOnClose="true">  
        <Windows> 
            <telerik:RadWindow runat="server" Behavior="Close" InitialBehavior="None" Left="" 
                Top="" ID="Features" Behaviors="Close, Resize, Maximize, Move" Height="400" Modal="True" 
                VisibleStatusbar="false" Width="1000px" DestroyOnClose="false" ShowContentDuringLoad="true" 
                ReloadOnShow="True" OnClientClose="ClearWindow" Animation="None" NavigateUrl="">  
            </telerik:RadWindow> 
        </Windows> 
    </telerik:RadWindowManager> 

Modified approach, which seems to work very well, however, I do not want the statusbar to be visible, not finding a way to hide it totally, I set it to "" as shown, but this causes the page title to be cleared as well, when the page title is set in code behind on the URL pages, me.title = "xyz", xyz does not show in the title.

I'd really like to use this approach, but I don't want to see the statusbar at all, and I don't want to loose my titles.

Suggestions

function OpenFeatureWindow(URL) {  
 
                try {  
                    var oWnd = radopen(URL, null);     
                    oWnd.set_height(document.documentElement.clientHeight - 75);  
                    oWnd.set_width(document.documentElement.clientWidth - 50);  
                    oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Resize + Telerik.Web.UI.WindowBehaviors.Maximize + Telerik.Web.UI.WindowBehaviors.Move)  
                    oWnd.center();  
                    oWnd.set_status = "" 
                } catch (e) {  
                    alert(e);  
                }  
            } 

Georgi Tunev
Telerik team
 answered on 07 May 2009
3 answers
144 views
Hi,


 

protected void RadComboBoxDiagnosis_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)

 

{

 

string app = string.Empty;

 

 

 

if (e.Text.Length > 0)

 

{

app =

"DESCRIPTION LIKE '" + e.Text.Replace("'", "''") + '%' + "' AND";

 

}

 

string diagnosisData = "select DESCRIPTION,FK_CODE_VALUE,PK_ALL_CODE_DESC_ID from M_ALL_CODES_DESC WHERE " + app + " STATUS=1 order by DESCRIPTION ";

 

 

DataTable rowsCount = SqlHelper.ExecuteDataset(new Connection().GetCon, CommandType.Text, diagnosisData).Tables[0];

 

 

int itemsPerRequest = 10;

 

 

int itemOffset = e.NumberOfItems;

 

 

int endOffset = itemOffset + itemsPerRequest;

 

 

string text = e.Text;

 

 

DataRow[] rows = rowsCount.Select();

 

 

if (endOffset > rows.Length)

 

{

endOffset = rows.Length;

}

 

RadComboBoxDiagnosis.ClearSelection();

RadComboBoxDiagnosis.Items.Clear();

 

 

 

 

string diagnosisData1 = "select top " + endOffset + " DESCRIPTION,FK_CODE_VALUE,PK_ALL_CODE_DESC_ID from M_ALL_CODES_DESC WHERE " + app + " STATUS=1 order by DESCRIPTION ";

 

 

DataTable dtData = SqlHelper.ExecuteDataset(new Connection().GetCon, CommandType.Text, diagnosisData1).Tables[0];

 

RadComboBoxDiagnosis.DataTextField =

"DESCRIPTION";

 

RadComboBoxDiagnosis.DataValueField =

"FK_CODE_VALUE";

 

RadComboBoxDiagnosis.DataSource = dtData;

RadComboBoxDiagnosis.DataBind();

e.Message = GetStatusMessage(endOffset, rowsCount.Rows.Count);

}



first 10 records shows in combo but when i click for next 10 then e.NumberOfItems changes 20 ,previous items will be there ,it shows duplicates values and NumberOfItems  will be 40 due to that duplicate value.

 

 

Plz help me.

ManniAT
Top achievements
Rank 2
 answered on 07 May 2009
1 answer
83 views
Hi we are using the 5.4 radeditor for MOSS.

And i would like to know if it is possible to configure the toolsbar per user or role. I know it is possible to configure it per web.
Stanimir
Telerik team
 answered on 07 May 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?