Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
268 views
Dear Telerik,

     Am using RadTimePicker,RadDateTimePicker and RadDatePicker. I cant find the control in dynamically. I need DisplayDateFormat from database side. If i find the control is RadTimePicker, that ll execute on all loops like that control is RadTimePicker and RadDateTimePicker and RadDatePicker. so i cant set DisplayDateFormat properly. pls solve this problem.

                     if (Ctrl is RadDatePicker)
                {
                    ((RadDatePicker)Ctrl).DateInput.DisplayDateFormat = "dd/MM/yyyy";
                }
                if (Ctrl is RadTimePicker)
                {
                    ((RadTimePicker)Ctrl).DateInput.DisplayDateFormat = "hh:mm tt";
                }
                if (Ctrl is RadDateTimePicker)
                {
                    ((RadDateTimePicker)Ctrl).DateInput.DisplayDateFormat="dd/MM/yyyy hh:mm tt "
                }
vinoth sansar
Top achievements
Rank 2
 answered on 04 Jan 2011
5 answers
747 views
Hello!
I'd been searching for a couple of days to find a solution to what is think is a "simple" problem, that due to my lack of knowledge is toooo hard to solve it without help.
What i need to accomplish is:
Open a RadWindow with my login page, 
Get the login and password
Authenticate
-if succeed: redirect
-if fails: display a message ( i have label for that purpose) and keep the RadWindow open.

My problem is that i can't find a way to process the authentication and automatically close the window and redirect.
Because client-side functions run before server-side, i can't perform the authentication in my db and then execute the JavaScript functions with the same button. I know I can look for a javascript snippet to perform the authentication, but i don't want to take that path 'cause at this point i'm blind to javascript. so i want to reduce it at the very minimum possible. I'd tried the techniques to execute JS functions from code-behind with no luck. Even run sever-side functions from JS but i just can't make it work.
What i have so far:
Parent Page
<script language="javascript" type="text/javascript">
        function OpenLogin()
         {
           var wnd = $find("<%=dlgLogin.ClientID%>");
                wnd.setUrl("Login.aspx");
                wnd.show();
            }
            function IsOk(wnd, Arg) {
               var args = Arg.get_argument();
                if (args) {
                    window.location = "CustomerStatus.aspx";
                }
            }     
    </script>
<script language="javascript" type="text/javascript">
        function OpenLogin()
         {
           var wnd = $find("<%=dlgLogin.ClientID%>");
                wnd.setUrl("Login.aspx");
                wnd.show();
            }
            function IsOk(wnd, Arg) {
               var args = Arg.get_argument();
                if (args) {
                    window.location = "CustomerStatus.aspx";
                }
            }    
    </script>

Child Page aspx
<script language="javascript" type="text/javascript">
    
    function GetRadWindow() {
        var oWindow = null;
        if (window.radWindow) oWindow = window.radWindow;
        else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
        return oWindow;
    }
    function CancelWindow() {
       var wnd = GetRadWindow();
        wnd.close();
    }
    function CloseWndw() {
        var arg = document.getElementById("txtIsOk").value;
        if (arg) {
            var wnd = GetRadWindow();
            wnd.close(arg);
        }
    }
    function Waiting(s, e)
        {
            Callback.PerformCallback();
            LPWaitConn.Show();
 
        }
                       
</script>

The  hidden-Field and RadButtons
 <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
       
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
 
<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
        
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
<asp:HiddenField ID="txtIsOk" runat="server" />
 <telerik:RadButton ID="btnLogin" runat="server" Text="Submit" Style="z-index: 1;
                left: 243px; top: 134px; position: absolute; height: 19px" BackColor="Transparent"
                Font-Names="Verdana" Font-Size="10pt" ForeColor="#84DA2E" SkinID="Black" OnClientClicking="Waiting"
                OnClick="btnLogin_Click" OnClientClicked="CloseWndw">
            </telerik:RadButton>
             
            <telerik:RadButton ID="btnCancel" runat="server" Text="Cancel" Style="z-index: 1;
                left: 180px; top: 134px; position: absolute; height: 19px" BackColor="Transparent"
                Font-Names="Verdana" Font-Size="10pt" ForeColor="#84DA2E" Font-Bold="True" Skin="Black"
                EnableViewState="False" OnClientClicked="CancelWindow">
            </telerik:RadButton>
</ContentTemplate>
    </asp:UpdatePanel>

<script language="javascript" type="text/javascript">
        function OpenLogin()
         {
           var wnd = $find("<%=dlgLogin.ClientID%>");
                wnd.setUrl("Login.aspx");
                wnd.show();
            }
            function IsOk(wnd, Arg) {
               var args = Arg.get_argument();
                if (args) {
                    window.location = "CustomerStatus.aspx";
                }
            }     
    </script>
Code-Behind
Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click
       Dim strCon As String = String.Empty
       Dim cnn As SqlConnection
 
       If Me.txtIsOk.Value.Length > 0 Then Exit Sub 'Because of the forced postback this is avoid more than one execution
 
       If Me.txtUser.Text.Length > 0 AndAlso Me.txtPass.Text.Length > 0 Then
           strCon = "Data Source=MyServer;Initial Catalog=MyDb;User Id=" & Me.txtUser.Text & ";Password=" & Me.txtPass.Text & ";"
           cnn = New SqlConnection(strCon)
           Try
               cnn.Open()
               Me.txtIsOk.Value = "Yes"
           Catch ex As SqlException
               Me.lblWarning.Text = "Wrong Login or Password"
               Me.lblWarning.Visible = True
           Catch ex1 As Exception
               Me.lblWarning.Text = "Wrong Login or Password"
               Me.lblWarning.Visible = True
           Finally
               cnn.Close()
               cnn.Dispose()
           End Try
       End If
   End Sub
The problem with my code is that i have to click twice in the "btnLogin".
In the first click everything will run, but the client-side will execute first and nothing will happen in that side. At the same time if credentials are ok the hidden field will be populated.
In the second click: Again everything will run this time as expected.

For any help
Thanks in advance




Jet
Top achievements
Rank 2
 answered on 04 Jan 2011
2 answers
165 views
Hi All,

Please Please Help ....

I have to update data from Grid.
I have added GridEditCommandColumn in RadGrid. When I browse to Edit data and Click Update data not change in both RadGrid and Database.
Please advice what properties or event I must add?

On the same page I have added (VisualStudio) GridView and do as I did in RadGrid, use same datasourceControl as RadGrid used, updating data worked fine at GridView.

This very simple, updating one by one record I still cannot do it  :(   ...  The actually program I want to do is user may update more than one records, the update data will be affect on RadGrid only, data will just save into database when user click save button.

Any idea please please ...

Thanks and Best Regards....
Naunton
Top achievements
Rank 1
 answered on 04 Jan 2011
1 answer
146 views
I have a user control with a RadListView, which contains a RadSlider and RadToolTip control like this:

<telerik:RadListView ID="myListView" runat="server" >
        <LayoutTemplate>
            <asp:Panel ID="RadListViewLayoutPanel" runat="server">
                <div class="container">
                    <asp:PlaceHolder ID="ItemPlaceHolder" runat="server"></asp:PlaceHolder>
                </div>
                <div class="slider">
                    <telerik:RadSlider ID="mySlider" runat="server" >
                    </telerik:RadSlider>
                    <telerik:RadToolTip ID="myToolTip" runat="server" Position="TopLeft" >
                    </telerik:RadToolTip>
                </div>
            </asp:Panel>
        </LayoutTemplate>
...
...

How do I find the ToolTip and Slider control in my JS? Note that I can't simple put the JS in the LayoutTemplate since this is a user control that lives on a page and for some reason the JS wouldn't get executed if I put in directly in the LayoutTemplate.

I was able to get the RadListView control by doing $find("<%=myUserControlThatHoldsTheListView.FindControl("myListView").ClientID %>") but how do I get the controls inside?

Thanks.

not
Top achievements
Rank 1
 answered on 04 Jan 2011
2 answers
76 views
 I have a grid in an ajaxpanel:

 

<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="100%" Width="100%" LoadingPanelID="RadAjaxLoadingPanel1">
  
<table><tr><td valign="top">
  
<telerik:RadGrid ID="radGridABC" runat="server" Width="800px" AutoGenerateColumns="False" GridLines="None" OnItemDataBound="radGridABC_ItemDataBound" Skin="MainGrid" EnableEmbeddedSkins="false" PageSize="10" AllowPaging="true">
  
<PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
  
<ClientSettings EnableRowHoverStyle="true">
  
<Selecting AllowRowSelect="True" />
  
<ClientEvents OnRowSelecting="RowSelected" />
  
</ClientSettings>

After clicking the next page on pager, the page goes post back and loses the instance of grid. only this line remains:

<input id="radGridABC_ClientState" name="radGridABC_ClientState" type="hidden" autocomplete="off">

any ideas why??

Ersin
Top achievements
Rank 1
 answered on 04 Jan 2011
1 answer
87 views
I have a RadComboBox I am using ItemsRequested to populate the combobox with data that is filtered by the contents of another asp:TextBox control. So it is something like this:

<asp:TextBox runat="server" id="txtFilter" />
 
<telerik:RadComboBox runat="server" ID="rcbPCN" AllowCustomText="true" EnableLoadOnDemand="true"
                                 OnItemsRequested="rcbPCN_ItemsRequested"
                                 AutoPostBack="True" CausesValidation="False"
                                onselectedindexchanged="rcbPCN_SelectedIndexChanged" Filter="StartsWith" />
 
.... code behind:
 
        protected void rcbPCN_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
        {
                var query = PlanManager.QueryPlans().Where(q => q.bin == txtFilter.Text);
                rcbPCN.DataSource = query;
                rcbPCN.DataBind();
        }

The problem is that txtFilter.Text in the ItemsRequested event is only read the first time. After I delete the text from the RadComboBox, then change the text in txtFilter, then click the arrow on the combobox again, the results it shows me are from the original value of txtFilter.Text, not the newly changed value. How can I get around this? I need the combobox to always show a list of results that match the current value of txtFilter.Text.

thanks!
Brandon
Simon
Telerik team
 answered on 03 Jan 2011
2 answers
305 views
I have a page with an UpdatePanel containing a couple of dropdowns, a retrieve button, and a RadGrid. The idea is that the user would select a set of data using the dropdowns, and click the retrieve button.  This would then populate the grid, and the user would then be able to add/edit/delete the displayed data.

Simple enough, but there was a problem.  The user could click on the "Add New Record" button at the top of the grid, which would display the the insert record control, when the selection criteria in the dropdowns had not been set.  Clicking its "Inert" button would generate errors, because there were no selected values in the dropdowns.

My fast fix was to set "theGrid.Visible = False", and to make the grid visible only after the partial postback on the retrieve button.  With this change, the insert record worked, but the edit existing record did not.  When I clicked on the button in the GridEditCommandColumn, the little busy spinner spun, but the edit control was never displayed.  It looks as if the grid isn't being properly initialized, if it's not visible on initial page load.

In any case, changing it to "theGrid.Enabled = False" made everything work fine.
Jeff
Top achievements
Rank 1
 answered on 03 Jan 2011
2 answers
170 views
I have 4 RadDocks ("RadDock1", "RadDock2", etc.) inside of RadDockZone1.  In the OnClientDockPositionChanged() function in Javascript, I would like to iterate through each RadDock in RadDockZone1.  How can I do this using a foreach loop, or another method?
Richard M
Top achievements
Rank 1
 answered on 03 Jan 2011
2 answers
78 views

For some crazy (but i'm sure very simple) reason i cannot get this to work, any help would be appreciated.

<body>

    <form id="form1" runat="server">

    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">

    </telerik:RadScriptManager>

    <div>

        <telerik:RadToolTipManager ID="RadToolTipManager1" runat="server">

        </telerik:RadToolTipManager>

        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">

        </telerik:RadAjaxLoadingPanel>

        <telerik:RadTreeView ID="TazaTree" runat="server">

        </telerik:RadTreeView>

        <br />

        <asp:Button ID="Button1" runat="server" Text="Button" />

    </div>

    <telerik:RadAjaxManager runat="server">

        <AjaxSettings>

            <telerik:AjaxSetting AjaxControlID="Button1">

                <UpdatedControls>

                    <telerik:AjaxUpdatedControl ControlID="TazaTree" />

                </UpdatedControls>

            </telerik:AjaxSetting>

        </AjaxSettings>

    </telerik:RadAjaxManager>

    </form>

</body>

 

 

 

 

 

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

 

        Dim ReMan As New ReMan

        Dim REs As List(Of ReUltraObj) = ReMan.GetCompanyUltraREsByCity("1000", "San Jose")

 

        For Each RE As ReUltraObj In REs

            Dim RENode As New RadTreeNode

            RENode.Value = RE.REID.ToString

            RENode.Text = RE.Address

            TazaTree.Nodes.Add(RENode)

 

            RadToolTipManager1.TargetControls.Add(RENode.ClientID, RENode.Value, True)

        Next

 

    End Sub

 

    Protected Sub RadToolTipManager1_AjaxUpdate(ByVal sender As Object, ByVal e As Telerik.Web.UI.ToolTipUpdateEventArgs) Handles RadToolTipManager1.AjaxUpdate

        Dim L As New Label

        L.Text = "test"

        e.UpdatePanel.ContentTemplateContainer.Controls.Add(L)

    End Sub

Sam
Top achievements
Rank 1
 answered on 03 Jan 2011
1 answer
85 views
Hello,
I have the following problem with my Update Panel and the Rad Grid.  When I perform a post back on the rad grid I get the following message directly above the Rad Grid.  "56|updatePanel|RadAjaxManager1SU|| ".

A snipet of the loading panel is as follows:
<rad:RadScriptManager runat="server" ID="radSM"></rad:RadScriptManager>  
       <rad:RadAjaxLoadingPanel ID="LoadingPanel" 
        CssClass="AjaxLoadingPanelBackground"
        runat="server"
        Transparency="10" >
        <div class="AjaxLoadingPanel" >
            <div style="font-family: Arial; font-size: 0.7em; font-weight: bold;">Loading...
            </div>
            <img src="I/loading.gif" alt="Loading.."/>
        </div>
    </rad:RadAjaxLoadingPanel
  
<asp:Panel ID="pnlSelectionList" runat="server" Height="285px" HorizontalAlign="Center" Width="1000px" Wrap="False">
                            <%--<asp:Panel ID="pnlGrid" runat="server" HorizontalAlign="Center" Width="100%"> --%>            
                                    <rad:RadAjaxManager ID="RadAjaxManager1" EnableAJAX="true" runat="server">
                                    <AjaxSettings>
                                        <rad:AjaxSetting AjaxControlID="RadGrid1">
                                            <UpdatedControls>
                                                <rad:AjaxUpdatedControl ControlID="pnlSelectionList" LoadingPanelID="LoadingPanel" />
                                                <rad:AjaxUpdatedControl ControlID="RadGrid1" />                                                                                                                                              
                                            </UpdatedControls>
                                        </rad:AjaxSetting>
                                    </AjaxSettings>
                                </rad:RadAjaxManager>                                                                                                   
                                <rad:RadGrid id="RadGrid1"
                                    EnablePostBackOnRowClick="false" 
                                    OnItemCreated="RadGrid1_ItemCreated"                                  
                                    OnPreRender="RadGrid1_PreRender"                                                                      
                                    ShowStatusBar="false" 
                                    runat="server" 
                                    AllowPaging="False" 
                                    AllowSorting="True"
                                    AllowMultiRowSelection="True" 
                                    AutoGenerateColumns="false"                                     
                                    ClientSettings-Resizing-ResizeGridOnColumnResize="false"                                    
                                    OnNeedDataSource="RadGrid1_NeedDataSource"
                                    EnableViewState="true"                                                                        
                                    Width="100%"   Height="92%"  Skin="Windows7" AllowFilteringByColumn="true"  EnableLinqExpressions="false">
                                    <MasterTableView PageSize="10" Width="95%" TableLayout="Fixed"  EnableViewState="true"  CommandItemDisplay="None">
                                        <Columns>                        
                                            <rad:GridTemplateColumn UniqueName="CheckBoxTemplateColumn"  
                                            HeaderStyle-Width="10%" 
                                            HeaderStyle-HorizontalAlign="Center" 
                                            AllowFiltering="false">
                                                <HeaderTemplate>
                                                 <asp:CheckBox id="headerChkbox" 
                                                    Text="Select All" 
                                                    OnCheckedChanged="ToggleSelectedState" 
                                                    AutoPostBack="True" 
                                                    runat="server"></asp:CheckBox>
                                                </HeaderTemplate>
                                                <ItemTemplate >
                                                    <asp:CheckBox id="CheckBox1" 
                                                    OnCheckedChanged="ToggleRowSelection" 
                                                    AutoPostBack="False" 
                                                    runat="server" 
                                                    Width="65"></asp:CheckBox>
                                                </ItemTemplate>
                                            </rad:GridTemplateColumn>
                                          </Columns>
                                    </MasterTableView>
                                    <ClientSettings EnableRowHoverStyle="true" 
                                                    Resizing-AllowColumnResize="true"
                                                    Resizing-AllowRowResize="false"  
                                                    Resizing-EnableRealTimeResize ="false" 
                                                    Resizing-ResizeGridOnColumnResize="false" 
                                                    Resizing-ClipCellContentOnResize ="false" 
                                                    EnablePostBackOnRowClick="false">                                                    
                                        <Scrolling AllowScroll ="true" UseStaticHeaders="true" />
                                        <ClientEvents OnColumnResized="OnColumnResized" />     
                                        <Selecting AllowRowSelect="true" />                                   
                                    </ClientSettings>
                                    <PagerStyle Mode="Slider"></PagerStyle>
                                </rad:RadGrid>

Any input is appreciated.
Thanks,
Pete
Pete
Top achievements
Rank 1
 answered on 03 Jan 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?