Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
126 views

In the popup that opens when I insert or edit one item in the grid, some logic has to be done, for example: enable and disable fields, depending on the values of other fields.

How can I add an onload event for the popup so that I can run js code to perform those enable/disable?

I already tried the OnPopUpShowing event, but it doesn’t work with date pickers, it fails in the get_selectedDate() because the _dateInput is empty (return this._dateInput.get_selectedDate())

Here’s the grid and javascript (simplified):

<RadGrid runat="server" ID="Grid1" AllowPaging="True" GridLines="None" CellSpacing="0" Culture="English (United Kingdom)" AllowSorting="True" AutoGenerateDeleteColumn="True" Width="95%" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" DataSourceID="ControlPanelNotifications_DS">

<MasterTableView DataKeyNames="fldId" DataSourceID="ControlPanelNotifications_DS" EditMode="PopUp" AutoGenerateColumns="False">

<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>

<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>

<Columns>

<ItemStyle HorizontalAlign="Center" Width="40px"></ItemStyle>

</sqr:GridButtonColumn>

</Columns>

<EditFormSettings CaptionFormatString="Detalhes" EditFormType="Template">

<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>

<FormTemplate>

<table style="width: 100%;">

<tr>

    <td>

                label

    <td>

                text

    <td>

                Label2

    <td>

                <RadDatePicker runat="server" ID="dtPracticalDate" Width="100px">

          <ClientEvents OnDateSelected="dtPracticalDate_DateSelected" />

        </RadDatePicker >

                <BindableControl runat="server" DataField="PraticalDate" TargetControlID="dtPracticalDate"></BindableControl>&nbsp;</td>

</tr>

<tr>

    <td>

                Label3

    <td>

text

               

     

    </td>

    <td>

                Label4

    <td>

                <RadDatePicker runat="server" ID="dtConfirmationDate" Width="100px">

          <ClientEvents OnDateSelected="dtConfirmationDate_DateSelected" />

        </RadDatePicker >

                <BindableControl runat="server" DataField="ConfirmationDate" TargetControlID="dtConfirmationDate"></BindableControl>&nbsp;</td>

</tr>

</table>

 

<asp:Button runat="server" CommandName="Cancel" Text="Cancelar"></asp:Button>

 

</FormTemplate>

<PopUpSettings Modal="True" Width="570px"></PopUpSettings>

</EditFormSettings>

</MasterTableView>

<FilterMenu EnableImageSprites="False"></FilterMenu>

<ClientSettings>

<ClientEvents OnPopUpShowing="PopUpShowing"></ClientEvents>

</ClientSettings>

<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>

</RadGrid>

Javascript:

function PopUpShowing(sender, eventArgs) {

    var practicalDate = getElementById('dtPracticalDate').get_selectedDate();

    UpdateConfirmationDate22(practicalDate);

}

function UpdateConfirmationDate22(practicalDate) {

    var confirmationDatePicker = getElementById('dtConfirmationDate');

    if (practicalDate != null) {

        confirmationDatePicker.set_enabled(true);

    }

    else {

        confirmationDatePicker.set_enabled(false);

        confirmationDatePicker.clear();

    }

}

David
Top achievements
Rank 1
 asked on 28 Mar 2012
10 answers
485 views
Hi ,


I would like to know what is the difference between the Telerik.WebControls.RadEditor and the Telerik.Web.UI.RadEditor ?

if I will need to change the existing code to use the Telerik.Web.UI.RadEditor instead of the Telerik.WebControls.RadEditor
 how and where can i find the corresponding property of the Telerik.WebControls.RadEditor with the Telerik.Web.UI.RadEditor ?

for example :  Telerik.WebControls.RadEditor.Editable,  DialogParametersMode,  HasPermission etc.

Any sample or documentation will be greatly appreciated


Thanks In Advance








Rumen
Telerik team
 answered on 28 Mar 2012
1 answer
71 views

Hello, 

I'm using Telerik's RadAjaxManager to update panels independently.

On my page, I have 3 user controls: A, B, C.

My AjaxSettings are:

  • If postback on A, update only A.
  • If postback on B, update only B.
  • I declare nothing for C.

If I do a postback on A, I see the loading panel on A, but (using Chrome dev tool) I see data sent for A and B. Strange to me as only A has loading panel.

If I do as postback on B, same behavior: loading panel on B but data for A and B.

Now, if I remove from AjaxSettings the settings for B, when I do a postback on A, only data for A are sent.

Am I wrong, or I should only see data for the "target" panel defined in AjaxSettings?

Moreover, sometimes in our user controls we access the RadAjaxManager to add response script. Can it be related? For instance, if in B's code-behind I add script to RadAjaxManager, will the entire B content will be sent when I do a postback on A (with rule A updates A only)?

This is really an issue in our app.

Thanks in advance for any help.

FB
Top achievements
Rank 1
 answered on 28 Mar 2012
3 answers
228 views
Hi there, I have come across a problem with the Rad Grid shrinking in size when it's rebound, or when it's item command it hit.

I will explain where my grid sits, It is in a control which is situated in a RadWindow which contains a tab strip it is one of the page contols of one of the rad tabs.

The RadGrid is set up with the following code:


    <telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="true" AllowPaging="true" AutoGenerateColumns="true" OnNeedDataSource="RadGrid1_NeedDataSource"
        OnColumnCreated="RadGrid1_ColumnCreated" OnItemDataBound="RadGrid1_ItemDataBound" AllowMultiRowSelection="true" ShowGroupPanel="true" OnItemCommand="RadGrid1_ItemCommand">
        <MasterTableView TableLayout="Fixed" Width="100%">     
            <Columns>
                <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn">
                    <HeaderStyle Width="50px" />
                </telerik:GridClientSelectColumn>
                <telerik:GridButtonColumn DataTextFormatString="Download" UniqueName="DownloadLink" CommandName="Download"
                        runat="server" DataTextField="ID" ButtonType="LinkButton" >                    
                </telerik:GridButtonColumn>                                     
            </Columns>                        
        </MasterTableView>
        <ClientSettings EnableRowHoverStyle="true" AllowDragToGroup="true" AllowColumnsReorder="true">
            <Selecting AllowRowSelect="True" UseClientSelectColumnOnly="true" />      
            <Resizing AllowColumnResize="True" AllowRowResize="false" ResizeGridOnColumnResize="false"
              ClipCellContentOnResize="false" EnableRealTimeResize="false" AllowResizeToFit="false" />                   
        </ClientSettings> 
    </telerik:RadGrid> 

When the page first loads the grid renders as desired, however once it has been updated or the Download command has been run the grid shrinks all columns so that the contents of the cells are spread over 3 lines.

Any ideas on how to stop this from happening?

Regards
Ryan
Andrey
Telerik team
 answered on 28 Mar 2012
12 answers
421 views
When y try to filter, the exception "Invalid column name" shows up
Here is the aspx
<p>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGrid2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid2" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
    <telerik:RadGrid ID="RadGrid1" Width="100%" DataSourceID="SqlDataSource1" AllowFilteringByColumn="True"
        AllowSorting="True" AllowPaging="True" PageSize="7" runat="server" AutoGenerateColumns="False"
        OnPreRender="RadGrid1_PreRender" ShowStatusBar="true" EnableLinqExpressions="false">
        <MasterTableView DataKeyNames="IdEmpresa">
            <Columns>
                <telerik:GridBoundColumn UniqueName="Empresa" DataField="Empresa" HeaderText="Empresa"
                    AllowFiltering="false" HeaderStyle-Width="200px" />
                <telerik:GridBoundColumn UniqueName="Supergrupo" DataField="Supergrupo" HeaderText="Super Grupo"
                    HeaderStyle-Width="200px">
                    <FilterTemplate>
                        <telerik:RadComboBox ID="RadComboBoxTitle" DataSourceID="SqlDataSource2" DataTextField="SuperGrupo" AutoPostBack="false"
                            DataValueField="SuperGrupo" Height="200px" AppendDataBoundItems="true"
                            SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("SuperGrupo").CurrentFilterValue %>'
                            runat="server" OnClientSelectedIndexChanged="TitleIndexChanged">
                            <Items>
                                <telerik:RadComboBoxItem Text="Todos" />
                            </Items>
                        </telerik:RadComboBox>
                        <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
 
                            <script type="text/javascript">
                                function TitleIndexChanged(sender, args)
                                {
                                    var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                    tableView.filter("SuperGrupo", args.get_item().get_value(), "EqualTo");
 
                                }
                            </script>
                        </telerik:RadScriptBlock>
                    </FilterTemplate>
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn UniqueName="Grupo" DataField="Grupo" HeaderText="Grupo" HeaderStyle-Width="200px">
                    <FilterTemplate>
                        <telerik:RadComboBox ID="RadComboBoxCity" DataSourceID="SqlDataSource3" DataTextField="Grupo" AutoPostBack="false"
                            DataValueField="Grupo" Height="100px" AppendDataBoundItems="true"
                            SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("Grupo").CurrentFilterValue %>'
                            runat="server" OnClientSelectedIndexChanged="CityIndexChanged">
                            <Items>
                                <telerik:RadComboBoxItem Text="All" />
                            </Items>
                        </telerik:RadComboBox>
                        <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
 
                            <script type="text/javascript">
                                function CityIndexChanged(sender, args)
                                {
                                    var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                    tableView.filter("Grupo", args.get_item().get_value(), "EqualTo");
                                }
                            </script>
 
                        </telerik:RadScriptBlock>
                    </FilterTemplate>
                </telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
    <br />
    <telerik:RadToolTip ID="RadToolTip1" runat="server" OffsetY="3" Position="TopCenter"
        ShowCallout="false" Height="20px" ShowEvent="fromcode" />
    <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:BTIMEXICO_DESConnectionC %>"
        ProviderName="System.Data.SqlClient" runat="server"
        SelectCommand="SELECT E.idEmpresa, E.Nombre AS Empresa, GE.idgrupo, G.Descripcion AS Grupo, SG.Descripcion AS SuperGrupo
                       FROM tbl_empresa E
                       LEFT JOIN tbl_grupoempresa GE
                       ON E.idEmpresa = GE.idEmpresa
                       LEFT JOIN tbl_grupos G
                       ON GE.idgrupo = G.idgrupo
                       LEFT JOIN tbl_Supergrupo SG
                       ON SG.idsupergrupo = G.idsupergrupo
                       ORDER BY Nombre">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" ConnectionString="<%$ ConnectionStrings:BTIMEXICO_DESConnectionC %>"
        ProviderName="System.Data.SqlClient" SelectCommand="SELECT DISTINCT Descripcion AS SuperGrupo FROM tbl_supergrupo"
        runat="server">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource3" ConnectionString="<%$ ConnectionStrings:BTIMEXICO_DESConnectionC %>"
        ProviderName="System.Data.SqlClient" SelectCommand="SELECT DISTINCT Descripcion AS Grupo FROM tbl_grupos"
        runat="server">
    </asp:SqlDataSource>
</p>

And the Code-behind
using System;
using System.Linq;
using System.Data;
using Telerik.Web.UI;
 
namespace BCD.PP.VIEW
{
    public partial class Client_Question_Config_A : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
            }
        }
 
        protected void ImportedFilter_ItemDataBound(object sender, RadComboBoxItemEventArgs e)
        {
            DataRowView rowView = (DataRowView)e.Item.DataItem;
            if (rowView["Bool"] is DBNull)
            {
                e.Item.Text = "No";
                e.Item.Value = "0";
            }
            else if ((bool)rowView["Bool"])
            {
                e.Item.Text = "Yes";
                e.Item.Value = "1";
            }
        }
 
        protected void RadGrid1_PreRender(object sender, System.EventArgs e)
        {
            if (RadGrid1.MasterTableView.FilterExpression != string.Empty)
            {
                RefreshCombos();
            }
        }
        protected void RefreshCombos()
        {
            SqlDataSource2.SelectCommand = SqlDataSource2.SelectCommand + " WHERE " + RadGrid1.MasterTableView.FilterExpression.ToString();
            SqlDataSource3.SelectCommand = SqlDataSource3.SelectCommand + " WHERE " + RadGrid1.MasterTableView.FilterExpression.ToString();
            RadGrid1.MasterTableView.Rebind(); //<<< Here is where the exception pops up
        }
    }
}

Following the example from here

I suspect the problem may be because the SQLDataSource is composed by joins instead of being a single table
any idea on how to solve this?
James Campbell
Top achievements
Rank 1
 answered on 28 Mar 2012
1 answer
111 views
Sorry if this has been posted this in somewhere else.   


I'm using a RadComboBox (ASP.Net) that has properties:
CloseDropDownOnBlur="true"
MarkFirstMatch="true"
AllowCustomText="true"


The Problem I'm facing is: 
If user start typing your own title, the pre-defined values starts to appear.
Say, the user types a single letter, say "N" into the box and it instantly selects the first option that starts with a 'N' (the list is presorted) and fill in that option in the box.
When you click off the combobox, is takes what you typed followed with the predefined value.


For e.g.: 'nNetwork Administrator'

I typed in "n"

'Network Administrator' automatically got taged on to the end there.


This happens on IE 9, IE8, Safari and Chrome but not on Mozilla (My Mozilla version is 3.6.28).
The Telerik RdComboBox Version I'm using is: 2.8.5.0

Please advice. 
Thanks in Advance
Ivana
Telerik team
 answered on 28 Mar 2012
1 answer
76 views
Dear Telerik,

After the upgrade form 2011.3.1115.40  to 2012.1.215.40 I had I lot of errors. Some thinks where fixed by the CAG and copieing dll's in the bin dir.

Any update gives me the creeps, it's giving me always troubles so it is not a thing I looking forward to.

This time I've spend over two days struggeling with the newest update, conlcuding that i had to roll back everything and stick with the 2011Q3 version.
For example im using the Documentmanger with Physical Paths which didnt work out.
So in the end ive build a new project complete according to the Telerik examples, and thank god... it didnt work in that project either...

Everything works fine until you want to insert that selected document into the RadEditor. I have search the code for a javascript Event on the insert button, I have set on every JS function a breakpoint none of them has been hit.

We did a rollback and it worked like a charme!

So there must be somthing wrong with it.

Regards Marco.
Rumen
Telerik team
 answered on 28 Mar 2012
3 answers
252 views
I am try to access the GridFooterItem on databound event and GridFooterItem.DataItem is nothing. 

Why I am getting Nothing for  "GridFooterItem.DataItem"?
Eyup
Telerik team
 answered on 28 Mar 2012
3 answers
181 views
Hi!

Is there a way to hide or change the attached button?

<telerik:RadTextBox ID="radTextBoxUsername" runat="server" CssClass="inputBox" ClientEvents-OnKeyPress="OnKeyPress"
                    MaxLength="16" ClientEvents-OnBlur="UsernameTextBoxValueChanged" SelectionOnFocus="SelectAll">
                    <ClientEvents OnKeyPress="OnKeyPress" OnBlur="UsernameTextBoxValueChanged"></ClientEvents>
                    <InvalidStyle CssClass="inputBoxInvalid" />
                </telerik:RadTextBox>
Michael O'Flaherty
Top achievements
Rank 2
 answered on 28 Mar 2012
3 answers
183 views
We're currently using an older version of Telerik (from 2009).  We are located in Arizona. DST has always been a huge hassle for us, requiring manual editing of appointments for customers in areas that do DST (e.g. all but Arizona).  Example: It's Friday, and the DST switch-over happens on Sunday. If they schedule an appointment for Monday in Mountain time, the UTC time saved to the database will be an hour off.  This requires us to edit the offsets on every time zone on the scheduler (except Arizona), but it's nearly impossible to time this edit in such a way that eliminates a huge pile of mis-scheduled appointments twice a year. People seriously dread "DST week" in our office because it means overtime spent correcting scheduling mistakes and calling customers.

I noticed that in the most recent update, it was mentioned that the time zone handling has become more advanced.  In the documentation it was unclear if this new functionality would help us to correctly handle DST.  Is there anywhere I can read more about the "CustomTimeZones" referred to in the changelog?  We are trying to decide if it is worth re-purchasing Telerik for this (it most certainly would be if let us handle DST correctly).

Also, any additional insight as to how we can properly handle DST would be much appreciated.  We currently only deal with Pacific, Mountain, Arizona, Central, and Eastern.

Thanks!
Plamen
Telerik team
 answered on 28 Mar 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?