Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
80 views
Hi All,
I have a RadDatePicker control and I need to validate the date. The user must enter a valid date and I have to check the date is not greater that the DataTime.Now value.
I am trying to build a method to handle both cases and send the corresponding error message. It looks I do not have the choice to call a method from the RequiredFieldValidator control.
Do you have any suggestion to handle this case?
Thanks
Yuri.
Vasil
Telerik team
 answered on 20 Feb 2015
2 answers
109 views
I've got an expandable grid that I'd like to fill the child as a Floated Tiles ListView.  Each of the cells (or tiles) in the listview have set widths and are rows/records from a datasource.  Depending on the right margin it would be good if the cells could wrap, but if not a set number of columns would be fine.  Whats the best way to achieve this?  

+ Row 1
   [1][2][3][4][5][6]
   [7][8][9][10][11]
   [12][13][14][15]
   [16][17][18][19]
- Row 2
- Row 3

Reducing the width would wrap the cells
+ Row 1
   [1][2][3][4]
   [5][6][7][8]
   [9][10][11]
   [12][13]
   [14][15]
   [16][17]
   [18][19]
- Row 2
- Row 3

cheers






Peter
Top achievements
Rank 1
 answered on 19 Feb 2015
3 answers
379 views
I'd like to add separators in the editor context menu - is this supported? The Tools section uses <telerik:EditorSeparator /> but this is not recognized inside the <ContextMenus> section.
Mark
Top achievements
Rank 2
Bronze
Bronze
Veteran
 answered on 19 Feb 2015
7 answers
448 views
No matter what I do, the dropdown arrow for the combo box only shows up on mouse over.  I have removed ALL css from the page to eliminate that as an issue and it still happens.  I've tried using a RadFormDecorator and selecting a different style theme as well but the same display issue persists.

<telerik:RadComboBox ID="cmbBillTo_State" runat="server" />


See attached images.

Anyone have an idea?
Bob
Top achievements
Rank 2
 answered on 19 Feb 2015
12 answers
1.9K+ views

We use your RadWindow controls quite a bit in our application. They are invoked using the following JavaScript convention…

 

var oWnd = radopen("EditWBSEast.aspx", "WBSRadWindow");

oWnd.setSize(830,300);

oWnd.Center();

 

We define WBSRadWindow as follows:

 

<telerik:RadWindowManager

    ID="RadWindowManager1"

    runat="server"

    Behavior="None"

    InitialBehavior="None" Left=""

    Skin="Outlook"

    style="display: inline;"

    Top=""

    DestroyOnClose="True">

    <Windows>

        <telerik:RadWindow

            ID="WBSRadWindow"

            Modal="true"

            runat="server"

            Behavior="None"

            DestroyOnClose="True"

            InitialBehavior="None"

            Title="”

            ReloadOnShow="true"

            Left=""

            NavigateUrl=""

            style="display: inline"

            Top=""

            Behaviors="None"  

            OnClientShow="OnClientShow">

        </telerik:RadWindow>

    </Windows>

</telerik:RadWindowManager>

 

This code provides us with a rather generic window with very little functionality but vastly better looking than the corresponding Window(Open) or Javascript alert. Our one problem is that we would also like to suppress the horizontal and vertical scrollbars.

 

We have seen elsewhere in your documentation that a JavaScript method similar to the one below should accomplish this

 

    function OnClientShow(radWindow)  

    {   

 

       var delScrollbar = radWindow._name;

       document.getElementsByName(delScrollbar)[0].setAttribute("scrolling", "no");

 

 

       var oTop = document.documentElement.scrollTop;  

       document.documentElement.scroll = "no";  

       document.documentElement.style.overflow = "hidden";  

       document.documentElement.scrollTop = oTop;  

 

       if(document.documentElement && document.documentElement.scrollTop)  

       {  

           var oTop = document.documentElement.scrollTop;  

           document.documentElement.scroll = "no";  

           document.documentElement.style.overflow = "hidden";  

           document.documentElement.scrollTop = oTop;  

                

       }

       else if(document.body)  

       {  

            var oTop = document.body.scrollTop;  

            document.body.scroll = "no";  

            document.body.style.overflow = "hidden";  

            document.body.scrollTop = oTop;  

        }  

    }  

  

This method does not suppress the scrollbars for us. Could you advise us as to how to best accomplish this?

 

 

Thanks

 

 

 

 

 

John
Top achievements
Rank 1
 answered on 19 Feb 2015
1 answer
154 views
I've been fighting with this issue for hours and hours now and I'm about ready to throw Rad controls out the window, it's so counter-intuitive.

I have a Radgrid called MyGroupsRadGrid01.  This grid displays a list of groups I'm in.  When I click on the Edit command of one of the rows, it displays the details of the group as well as a RadGrid of the other members in the group called GroupMembersRadGrid all within a FormTemplate.  I want to be able to add or delete an entry in GroupMembersRadGrid using GroupMemberRadGrid_DeleteCommand() and GroupMemberRadGrid_InsertCommand().  I tried using GroupMemberRadGrid_NeedDataSource() but the method itself cannot find GroupMemberRadGrid.  I then tried populating GroupMemberRadGrid within MyGroupsRadGrid01_ItemDataBound but after deleting an entry, the GroupMemberRadGrid showed up as empty (which seems to me necessitate's the GroupMemberRadGrid_NeedDataSource() that I can't get to work.  

<telerik:RadGrid ID="MyGroupsRadGrid01" runat="server"
    OnNeedDataSource="MyGroupsRadGrid01_NeedDataSource"
    AutoGenerateColumns="false" AutoPostBackOnFilter="true" OnUpdateCommand="MyGroupsRadGrid01_UpdateCommand" OnItemDataBound="MyGroupsRadGrid01_ItemDataBound"
    AllowSorting="true" AllowAutomaticUpdates="True" AllowAutomaticInserts="True" OnEditCommand="MyGroupsRadGrid01_EditCommand"
    AllowFilteringByColumn="false" MasterTableView-CommandItemDisplay="Top">
    <MasterTableView DataKeyNames="BWGroupID">
        <EditFormSettings EditFormType="Template">
            <FormTemplate>
                <table id="Table1" style="margin-left: 50px;" width="100%" cellspacing="2" cellpadding="1" border="0" rules="none" style="border-collapse: collapse;">
                    <tr>
                        <td valign="top">
                            <table id="Table2" cellspacing="2" cellpadding="1" border="0" rules="none" style="border-collapse: collapse;">
                                <tr id="BWGroupIDRow" runat="server">
                                    <td>BW Group ID   </td>
                                    <td><asp:Label ID="BWGroupIDLabel" runat="server" Text='<%# Bind("BWGroupID") %>' /></td>
                                </tr>
                                <tr id="BWGroupNameRow" runat="server">
                                    <td>BW Group Name   </td>
                                    <td><asp:Label ID="Label5" runat="server" Text='<%# Bind("BWGroupName") %>' /></td>
                                </tr>
                                <tr id="BWUserIDRow" runat="server">
                                    <td>BW User ID Owner   </td>
                                    <td><asp:Label ID="Label6" runat="server" Text='<%# Bind("BWUserOwner.BWUserID") %>' /></td>
                                </tr>
                                <tr id="DisplayNameRow" runat="server">
                                    <td>BW User Owner   </td>
                                    <td><asp:Label ID="Label7" runat="server" Text='<%# Bind("BWUserOwner.DisplayName") %>' /></td>
                                </tr>
                                <tr id="IsActive" runat="server">
                                    <td></td>
                                    <td><asp:CheckBox ID="DeactivateCheckBox" runat="server" Text="Deactivate" /></td>
                                </tr>
                                <tr>
                                    <td align="center" colspan="2"><br />
                                        <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                            runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'></asp:Button
                                        <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button>
                                    </td>
                                </tr>
                            </table>
 
                        </td>
                        <td valign="top">
                            <table id="Table3" style="margin-left: 5px;" cellspacing="2" cellpadding="1" border="0" rules="none" style="border-collapse: collapse;">
                                <tr><td><h4>Group Members:</h4></td></tr>
                                <tr>
                                    <td>
                                        <telerik:RadGrid ID="GroupMemberRadGrid" runat="server" width="100%" AllowAutomaticUpdates="True" AllowAutomaticInserts="True"
                                            AllowAutomaticDeletes="true" OnDeleteCommand="GroupMemberRadGrid_DeleteCommand" OnNeedDataSource="GroupMemberRadGrid_NeedDataSource"
                                            AutoPostBackOnFilter="true" OnUpdateCommand="GroupMemberRadGrid_UpdateCommand">
                                            <MasterTableView AutoGenerateColumns="False" DataKeyNames="BWUserId">
                                                <Columns>
                                                    <telerik:GridBoundColumn DataField="BWGroupId" DataType="System.Int32" HeaderText="Group ID" ReadOnly="True" SortExpression="BWGroupId" UniqueName="BWGroupId"></telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="BWUserId" DataType="System.Int32" HeaderText="User ID" ReadOnly="True" SortExpression="BWUserId" UniqueName="BWUserId"></telerik:GridBoundColumn>
                                                    <telerik:GridBoundColumn DataField="DisplayName" HeaderText="Name" SortExpression="DisplayName" UniqueName="DisplayName"></telerik:GridBoundColumn>
                                                    <telerik:GridButtonColumn Text="Delete" CommandName="Delete" ButtonType="ImageButton" />
                                                </Columns>
                                            </MasterTableView>
                                        </telerik:RadGrid>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
                <br />
            </FormTemplate>
        </EditFormSettings>
        <Columns>
            <telerik:GridEditCommandColumn ButtonType="LinkButton" EditText="View/Edit" UniqueName="EditCommandColumn"></telerik:GridEditCommandColumn>
            <telerik:GridBoundColumn UniqueName="BWGroupID" DataField="BWGroupID" HeaderText="BW Group ID" SortExpression="BWGroupID" FilterControlWidth="150px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="BWGroupName" HeaderText="BW Group Name" ReadOnly="true" SortExpression="BWGroupName" FilterControlWidth="150px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="BWUserOwner.BWUserID" HeaderText="BW User ID Owner" SortExpression="BWUserOwner.BWUserID" FilterControlWidth="50px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="BWUserOwner.DisplayName" HeaderText="BW User Owner" SortExpression="BWUserOwner.DisplayName" FilterControlWidth="50px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"></telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>
protected void MyGroupsRadGrid01_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
        GridEditableItem editedItem = e.Item as GridEditableItem;
        Label BWGroupID = editedItem.FindControl("BWGroupIDLabel") as Label;
        int ParseBWGroupID = -1; int.TryParse(BWGroupID.Text, out ParseBWGroupID);
 
        if (ParseBWGroupID < 1)
            return;
 
        BWGroupUsers usersInGroup = new BWGroupUsers();
        usersInGroup.GetActiveBWUsersByGroupID(ParseBWGroupID);
 
        RadGrid GroupMemberRadGrid = new RadGrid();
        GroupMemberRadGrid = (RadGrid)e.Item.FindControl("GroupMemberRadGrid");
 
        ViewState["BWGroupID"] = ParseBWGroupID;
 
        //GroupMemberRadGrid.DataSource = usersInGroup.BWGroupUsersList.OrderBy(u => u.DisplayName);
        //GroupMemberRadGrid.DataBind();
    }
}
 
protected void GroupMemberRadGrid_DeleteCommand(object sender, GridCommandEventArgs e)
{
    if (e.Item is GridDataItem && e.CommandName == "Delete")
    {
        GridDataItem item = (GridDataItem)e.Item;
        int parseGroupId = -1; int.TryParse(item["BWGroupId"].Text.ToString(), out parseGroupId);
        int parseUserId = -1; int.TryParse(item["BWUserId"].Text.ToString(), out parseUserId);
 
        BWGroupUser selectedGroupUser = new BWGroupUser();
        //selectedGroupUser.DeleteBWGroupUser(parseGroupId, parseUserId);
    }
}
 
protected void GroupMemberRadGrid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    GroupMemberRadGrid.DataSource = GroupMemberDataSource().BWUserList;  //Doesn't find this!
}
 
private BWUsers GroupMemberDataSource()
{
    BWUsers allBWUsers = new BWUsers();
    if (ViewState["BWGroupID"] != null && ViewState["BWGroupID"].ToString().Length > 0)
    {
        int ParseBWGroupID = -1; int.TryParse(ViewState["BWGroupID"].ToString(), out ParseBWGroupID);
 
        allBWUsers.GetActiveBWUsersByGroupID(ParseBWGroupID);
        return allBWUsers;
    }
    return allBWUsers;
}



It's 9:00pm and I've been working on this since noon.  I can't fight with this all night and it's due in 11 hours.  I need help.
Pavlina
Telerik team
 answered on 19 Feb 2015
5 answers
143 views
Data in the file exported to excel is incorrect plz help me
Kostadin
Telerik team
 answered on 19 Feb 2015
1 answer
161 views
After hours of research, I have figured out my own solution to some issues I reported earlier. So to summarize all my issues and solutions:

I experienced two major BINDING issues with fields under <EditFormSettings EditFormType="Template"><FormTemplate>:

1. DropDownList - Setting the SelectedValue property to <%# Bind("security_webpage_id") %> caused an error when clicking on the Add New Record button. The error was 'ddlWebPages' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value.

Fix: I added a blank listitem. My Dropdown tag looked like this after fix:

<asp:DropDownList ID="ddlWebPages" DataSourceID='sqlDataSourceWebpages'
                                               AppendDataBoundItems="True" DataTextField="webpage_name" DataValueField="ID"
                                               SelectedValue='<%# Bind("security_webpage_id") %>' runat="server"> 
                                      <asp:ListItem Text=" " Value=""></asp:ListItem>
                                          
</asp:DropDownList>
 
2. Checkbox - I had three checkboxes that received an error when I clicked on the Add New Record button.
The error was "Specified cast is not valid".

Fix: I created a User Control for the CheckBox and handled the passing of null value to the Checked property which is what was happening when the Add New Record button was clicked. Below is my code for the code behind and markup of the checkbox control.

Code-Behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace FRC
{
    public partial class CheckBoxNullableChecked : System.Web.UI.UserControl
    {
        private bool m_checked = false;
        protected void Page_Load(object sender, EventArgs e)
        {
            m_checked = CheckBox1.Checked;
        }
 
        public object Checked
        {
            get { return m_checked; }
            set
            {
                if (value.GetType() == DBNull.Value.GetType()) m_checked = false;
                else if (value == null) m_checked = false;
                else if (value.GetType() == typeof(bool)) m_checked = (bool)value;
                else m_checked = false;
            }
        }
        public string Text
        {
            get { return this.CheckBox1.Text; }
            set { this.CheckBox1.Text = value; }
        }
 
        protected void Page_PreRender()
        {
            CheckBox1.Checked = m_checked;
        }
 
    }
}



Mark-up:
%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CheckBoxNullableChecked.ascx.cs" Inherits="FRC.CheckBoxNullableChecked" %>
<asp:CheckBox ID="CheckBox1" runat="server" />


Registering User Control in markup file that contains the standard Checkbox;
<%@ Register src="~/CheckBoxNullableChecked.ascx" TagName="CheckBoxNullableChecked"
    TagPrefix="uc1" %>

Your Checkbox and/or Drop Down List will look like this now under the FormTemplate:
<EditFormSettings EditFormType="Template">
               <FormTemplate>   
                   
                  
                   <div id="divGridEdit" class="divGrid">
                           <b>Add New Role to Webpage Association</b>
                           <br /><br />
                           <table>
 
                               <tr>
                                   <td><asp:Label Text="Web Page:" runat="server"></asp:Label></td>
                                   <td>
                                      <asp:DropDownList ID="ddlWebPages" DataSourceID='sqlDataSourceWebpages'
                                              AppendDataBoundItems="True" DataTextField="webpage_name" DataValueField="ID"
                                              SelectedValue='<%# Bind("security_webpage_id") %>' runat="server">
                                     <asp:ListItem Text=" " Value=""></asp:ListItem>
                                          
                                        </asp:DropDownList>
 
 
                                   </td>
                               </tr>
                               
                               <tr>
                                   <td><br /></td>
                                   <td></td>
                               </tr>
                               <tr>
                                    <td><asp:Label Text="Allow Add:" runat="server"></asp:Label></td>
                                    <td><uc1:CheckBoxNullableChecked ID="chkboxAllowAdd" Checked='<%# Bind("add_privledge") %>' runat="server" />
                                    </td>
                               </tr>
                               <tr>
                                    <td><asp:Label Text="Allow Edit:" runat="server"></asp:Label></td>
                                    <td><uc1:CheckBoxNullableChecked ID="chkboxAllowEdit" Checked='<%# Bind("edit_privledge") %>' runat="server" />
                                    </td>
                               </tr>
                               <tr>
                                    <td><asp:Label Text="Allow Delete:" runat="server"></asp:Label></td>
                                    <td><uc1:CheckBoxNullableChecked ID="chkboxAllowDelete" Checked='<%# Bind("delete_privledge") %>' runat="server" /></td>
                               </tr>
 
                               <tr>
                                   <td><asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                       CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'  runat="server" /></td>
                                   <td><asp:Button ID="btnCancel" Text="Cancel" runat="server" CommandName="Cancel" CausesValidation="false" /></td>
                               </tr>
                           </table>
                       </div>            
 
               </FormTemplate>
           </EditFormSettings>
 
 
           </MasterTableView>
           <ClientSettings>
               <ClientEvents OnRowDblClick="rowDblClick" />
           </ClientSettings>
               
       </telerik:RadGrid>
 
 
   </div>
 
   <asp:SqlDataSource ID="sqlDataSourceWebpages" runat="server" SelectCommand="SELECT * FROM dbo.security_webpage" ConnectionString="<%$ ConnectionStrings:GATEConnectionString %>"></asp:SqlDataSource>

Hopefully this will help someone else not have to go through days of pain that I did over there two issues
Eyup
Telerik team
 answered on 19 Feb 2015
6 answers
762 views
Hi,

I get this error since I started to use Telerik controls a couple hours ago.

 JavaScript runtime error: Unable to get property 'UI' of undefined or null reference

The exception occurs on the following line:

   
$create(Sys.Extended.UI.ModalPopupBehavior, {"BackgroundCssClass":"modalBackground","DropShadow":true,"PopupControlID":"Pnl_ForAdd","dynamicServicePath":"/Main.aspx","id":"MdlPppXtndr_Add_ID"}, null, null, $get("DummyForAdd"));


One my page I use Ajax for the modal popups and update panels.
I did as people suggested in other posts, and used the design to register Telerik in the web.config as follow:

<system.web>
...
    <httpHandlers>
      <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
    </httpHandlers>
...
</system.web>

<system.webServer>
...
<handlers>
      <add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" />
</handlers>
...
</system.webServer>

<location path="Telerik.Web.UI.WebResource.axd">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>

On my page I register the scriptmanager like this:
           
<telerik:RadScriptManager ID="RadScriptManager1" runat="server" EnablePageMethods="True"></telerik:RadScriptManager>

So now I am at a loss about what to do to make this work, and in a hurry to get things working because of deadlines.
Marin Bratanov
Telerik team
 answered on 19 Feb 2015
3 answers
239 views
I'm using the EditMode="PopUp" and I have script that will center the popup window over the visible portion of the screen.  Except there's a hitch: I'm not explicitly setting the height of my popup but my script relies on knowing the height of the popup object.  How can I get the height if I don't explicitly set it?
Hassan
Top achievements
Rank 1
 answered on 19 Feb 2015
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?