Telerik Forums
UI for ASP.NET AJAX Forum
21 answers
698 views

I'm trying to use a raddatepicker in a radgrid where the user can only select the Month and Year, rather than the date from the RadCalendar.  


I have implemented this once before using the javascript from the Code Library at the link below and it has worked fine.


Now I am trying to apply it to a raddatepicker that is inside of an EditForm and it will not work.  

I can pass in the RadDatePicker's client ID and when I debug I see that it finds the object, but it continually tells me that the object does not contain those methods or properties.  

The applicable code is below.  Please let me know if you can help me or if you need any further information.

<script type="text/javascript">  
        //override the onload event handler to change the picker after the page is loaded  
        window.onload = function ()  
        {  
            window.setTimeout(function() {SetCalendarTable();},200)  
        }  
              
        function SetCalendarTable()    
        {     
            var picker = "ctl00_RadPanel_ForecastGrid_ctl00_ctl02_ctl02_rdpForecastStartDate";      
            var calendar = picker.get_calendar();  
            var fastNavigation = calendar._getFastNavigation();    
 
            $clearHandlers(picker.get_popupButton());  
            $addHandler(picker.get_popupButton(), "click", function()  
            {     
                //debugger;      
                var textbox = picker.get_textBox();  
                //adjust where to show the popup table   
                var x, y;  
                var adjustElement = textbox;  
                if (textbox.style.display == "none")  
                    adjustElement = picker.get_popupImage();  
              
                var pos = picker.getElementPosition(adjustElement);  
                x = pos.x;  
                y = pos.y + adjustElement.offsetHeight;  
                  
                var e = {  
                              clientX : x,  
                              clientY : y  
                          };  
                //synchronize the input date if set with the picker one  
                var date = picker.get_selectedDate();  
                if(date)  
                {  
                    calendar.FocusedDate[0] = date.getFullYear();  
                    calendar.FocusedDate[1] = date.getMonth() + 1;  
                }                          
 
                $get(calendar._titleID).onclick(e);           
            });  
                  
            fastNavigation.OnOK =   
            function()  
            {                          
                var date = new Date(fastNavigation.Year, fastNavigation.Month, 1);  
                picker.get_dateInput().SetDate(date);  
                fastNavigation.Popup.Hide();     
                                                               
            }  
              
            fastNavigation.OnToday =   
            function()  
            {  
                var date = new Date();  
                picker.get_dateInput().SetDate(date);  
                fastNavigation.Popup.Hide();  
            }  
        }     
    </script> 
 
<telerik:RadGrid ID="ForecastGrid"   
        AllowPaging="True"   
        AllowSorting="True"   
        EnableEmbeddedSkins="false" 
        GridLines="None"   
        OnInsertCommand="ForecastGrid_InsertCommand"   
        OnItemCommand="ForecastGrid_ItemCommand" 
        OnItemCreated="ForecastGrid_ItemCreated"   
        OnItemDataBound="ForecastGrid_ItemDataBound"   
        OnNeedDataSource="ForecastGrid_NeedDataSource" 
        OnUpdateCommand="ForecastGrid_UpdateCommand" 
        PageSize="15" 
        runat="server" 
        ShowFooter = "true" 
        Skin="AO" 
        Visible = "true">  
          
        <MasterTableView CommandItemDisplay="Bottom" AutoGenerateColumns = "false" DataKeyNames="ForecastId">  
 
<EditFormSettings EditFormType = "Template">  
                <FormTemplate> 
                    <div style="padding: 10px;">  
                        <div class="text">  
                            Click the <b>Save</b> button to save your changes.</div> 
                        <div> 
                            <asp:Label Visible="false" ID="ErrorLabel" runat="server" /></div>  
                        <div style="clear: both;">  
                        </div> 
                        <div class="validation-summary">  
                            <asp:ValidationSummary HeaderText="Changes not saved." DisplayMode="SingleParagraph" 
                                ID="ValidationSummary1" runat="server"></asp:ValidationSummary> 
                        </div> 
                        <div style="clear: both;">  
                        </div> 
                          
                        <div> 
                            <asp:Label ID="ForecastIdLabel" Visible="false" runat="server" Text='<%# Bind("ForecastId") %>'></asp:Label></div>  
                        <div> 
                  
                        <div> 
                            <asp:Label ID="IsActiveLabel" Visible="false" runat="server" Text='<%# Bind("IsActive") %>'></asp:Label> 
                        </div> 
                          
                        <div class="label-short" style="float: left; padding-bottom: 5px; width:150px;">  
                            Forecast Name:</div> 
                        <div style="padding-bottom: 5px;">  
                            <Telerik:RadTextBox ID="ForecastName" runat="server" Skin="AO" EnableEmbeddedSkins="false" 
                                Text='<%# Bind("ForecastName") %>' Width="240" MaxLength="50">  
                            </Telerik:RadTextBox> 
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="ForecastName" 
                                ErrorMessage="Forecast Name is required.">*</asp:RequiredFieldValidator> 
                        </div> 
                        <div style="clear: both;">  
                        </div> 
                          
                        <div class="label-short" style="float: left; padding-bottom: 5px; width:150px;">  
                            Forecast Start Date:</div> 
                        <div style="padding-bottom: 5px;">  
                            <telerik:RadDatePicker ID="rdpForecastStartDate" DateInput-DateFormat="MMMM, yyyy" runat="server" 
                                AutoPostBack="false" ToolTip="Month" Width="130px" CssClass="date-picker" Skin="AO" 
                                EnableEmbeddedSkins="false">  
                            </telerik:RadDatePicker> 
                            <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="rdpForecastStartDate" 
                                ErrorMessage="Forecast Start Date is required.">*</asp:RequiredFieldValidator>--%> 
                        </div> 
                        <div style="clear: both;">  
                        </div> 
                          
                        <div class="label-short" style="float: left; padding-bottom: 5px; width:150px;">  
                            Forecast Length:</div> 
                        <div style="padding-bottom: 5px;">  
                            <telerik:RadComboBox ID="rcbForecastLength" runat="server" ZIndex="7020" Skin="AO" EnableEmbeddedSkins="false" Width="243">  
                            </telerik:RadComboBox> 
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="rcbForecastLength" 
                                ErrorMessage="Forecast Length is required.">*</asp:RequiredFieldValidator> 
                        </div> 
                        <div style="clear: both;">  
                        </div> 
                          
                        <div class="label-short" style="float: left; padding-bottom: 5px; width:150px;">  
                            Is Active:</div> 
                        <div style="float: left; padding-bottom: 5px;">  
                            <asp:CheckBox ID="IsActiveCheckbox" runat="server"></asp:CheckBox> 
                        </div> 
                        <div style="clear: both;">  
                        </div> 
 
                        <div> 
                            <asp:Button ID="UpdateButton" CssClass="button" runat="server" Text="Save" CommandName="Update" /> 
                            <asp:Button ID="InsertButton" CssClass="button" runat="server" Text="Save" CommandName="PerformInsert" /> 
                            <asp:Button ID="CancelButton" CssClass="button" runat="server" Text="Cancel" CommandName="Cancel" 
                                CausesValidation="false" /> 
                        </div> 
                    </div> 
                </FormTemplate> 
            </EditFormSettings> 
        </MasterTableView> 
    </telerik:RadGrid> 

Maria Ilieva
Telerik team
 answered on 17 Jan 2013
2 answers
249 views
How would I validate checked for a radbutton with ToggleType="CheckBox"

I have one checkbox( ToggleType="CheckBox") and then a regular radbutton(ButtonType="StandardButton") to proceed.

I am using this for "Accept Terms"

Thanks, Marty

moegal
Top achievements
Rank 1
 answered on 17 Jan 2013
1 answer
248 views
Hi,

I've pasted my code below. I need to know which row caused the itemcommand server side. This works fine in below code as long as the OnCommand client event is not used. When i start using it the ItemIndex is always 0. The same issue is described in http://www.telerik.com/community/forums/aspnet-ajax/grid/itemcommand-why-is-my-itemindex-always-zero.aspx, but the solution does not work for me as the selected row might be different. GetDataKeyValue also does not work it always returns the data key from first row.

Is there a way to find which row caused the itemcommand while have the client side OnCommand?

Thanks!

using System;
 
using Telerik.Web.UI;
 
public partial class Default : System.Web.UI.Page
{
    public class A
    {
        public int a { get; set; }
        public int b { get; set; }
    }
 
 
    protected void Page_Load(object sender, EventArgs e)
    {
        RadGrid1.DataSource = new A[] {new A() {a = 1, b = 2}, new A() {a = 3, b = 4}};
    }
 
    protected void rg_ItemCommand(object sender, GridCommandEventArgs e)
    {
        int i = e.Item.ItemIndex;
 
        GridDataItem item = (GridDataItem)e.Item;
        int letterId = (int)item.GetDataKeyValue("a");
 
        //GridDataItem dataItem = RadGrid1.SelectedItems[0] as GridDataItem;
    }
}

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <asp:ScriptReference Assembly="Telerik.Web.UI, Version=2012.3.1205.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
                Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI, Version=2012.3.1205.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
                Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI, Version=2012.3.1205.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
                Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <script type="text/javascript">
    //Put your JavaScript code here.
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <div>
        <telerik:RadGrid ID="RadGrid1" runat="server" OnItemCommand="rg_ItemCommand">
            <MasterTableView DataKeyNames="a" AutoGenerateColumns="False">
                <Columns>
                    <telerik:GridBoundColumn DataField="a" DataType="System.Int32">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="b" DataType="System.Int32">
                    </telerik:GridBoundColumn>
                    <telerik:GridButtonColumn ButtonType="LinkButton" CommandName="test" Text="test">
                    </telerik:GridButtonColumn>
                </Columns>
            </MasterTableView>
            <ClientSettings>
                <%--removing Oncommand will make itemindex work--%>
                <ClientEvents OnCommand="rgCommand" />
            </ClientSettings>
        </telerik:RadGrid>
    </div>
    <script type="text/javascript">
        function rgCommand(sender, args) {
            var commandName = args.get_commandName();
             
        }
    </script>
    </form>
</body>
</html>

Princy
Top achievements
Rank 2
 answered on 17 Jan 2013
1 answer
154 views

I have a FormView hooked into an ObjectDataSource.  Inside the FormView sits a RadPanelBar.  I have some databound controls within the RadPanelBar and I've had a terrible time getting them to work.

First, I used the suggested method, DataBinder.Eval(FormView1.DataItem, "BillingDate").  This causes the FormView to have an empty oldValues and newValues collection when it updates.  That took me days to figure out.

I then tried an alternative method, strongly typing the DataItem from the container.  

((Wcsr.ProjectBilling.Business.Data.ProjectTask)
                            (Container.DataItem ?? new Wcsr.ProjectBilling.Business.Data.ProjectTask())).Code


I am getting a null DataItem here.  If I use FormView1.DataItem, the oldValues and newValues collections become empty again.  What can I do?

<asp:FormView ID="FormView1" runat="server" DataSourceID="ObjectDataSource1" DefaultMode="Edit" OnItemUpdated="FormView1_ItemUpdated" OnItemUpdating="FormView1_ItemUpdating">
    <EditItemTemplate>
        <telerik:RadPanelBar ID="RadPanelBar1" runat="server" Skin="Metro" Width="100%">
            <Items>
                <telerik:RadPanelItem runat="server" Expanded="True" PreventCollapse="True" Text="Basic Task Information">
                    <ContentTemplate>
                        <div>
                            <asp:Label ID="Label1" runat="server" CssClass="fieldLabel">Task Code</asp:Label>
                            <%-- For some reason RadPanelItem requires you to do databinding with DataBinder.Eval --%>
                            <asp:TextBox ID="TaskCodeTb" runat="server" MaxLength="20" Text='<%# ((Wcsr.ProjectBilling.Business.Data.ProjectTask)
                            (Container.DataItem ?? new Wcsr.ProjectBilling.Business.Data.ProjectTask())).Code %>'></asp:TextBox>
                        </div>
                        <div>
                            <asp:Label ID="Label4" runat="server" CssClass="fieldLabel">Task Description</asp:Label>
                            <asp:TextBox ID="DescriptionTb" runat="server" MaxLength="250" Rows="3" Text='<%# ((Wcsr.ProjectBilling.Business.Data.ProjectTask)
                            (Container.DataItem ?? new Wcsr.ProjectBilling.Business.Data.ProjectTask())).Description %>' TextMode="MultiLine"></asp:TextBox>
                        </div>
                    </ContentTemplate>
                </telerik:RadPanelItem>
        </telerik:RadPanelBar>
        <asp:LinkButton runat="server" ID="UpdateLb" Text="Update" CommandName="Update"></asp:LinkButton> 
        <asp:LinkButton runat="server" ID="CancelLb" Text="Cancel" CommandName="Cancel"></asp:LinkButton>
    </EditItemTemplate>
 </asp:FormView>
Kate
Telerik team
 answered on 17 Jan 2013
7 answers
516 views
ive recently installed the telerik tools in my site, but keep getting this error when i try and build the solution.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3607,9): warning MSB3061: Unable to delete file "C:\Sites\MySite\bin\Telerik.Web.UI.xml". Access to the path 'C:\Sites\MySite\bin\Telerik.Web.UI.xml' is denied.

i shut down VS and ensure the bin folder has read-only removed, but this error keeps coming back every time.

how do i eradicate it ?
Edward
Top achievements
Rank 1
 answered on 17 Jan 2013
3 answers
88 views
Does anybody know why .ExportToCSV() exports data in the following format?

header1,header2,header3,
r1value1,r1value2,r1value3,
r2value1,r2value2,rwvalue3,

as opposed to

header1,header2,header3
r1value1,r1value2,r1value3
r2value1,r2value2,rwvalue3

Notice how the second set of value doe not have the comma at the end of each line, which is what I was expecting.  Is there any way to not append the comma to the end of each line?

Any help would be greatly appreciated.  Thank you!
Kostadin
Telerik team
 answered on 17 Jan 2013
3 answers
110 views
Hi,
Is it possible to have the radgrid in which there is no edit button.
Even if the existing rows are modified, the changed row is inserted.. How to achieve this?

Thanks
Princy
Top achievements
Rank 2
 answered on 17 Jan 2013
0 answers
125 views
Hi all,

I am currently exploring on telerik radgrid, I am required to have a button to Export to CSV and using telerik's radgrid method, .ExportToCSV, it works wonders! But i found out that there is an issue where after I click to export the file, the whole page dies (not responsive) e.g. my other button "Submit" / "Cancel" / "dropdown_onselectedindexchange". May I know if anyone encountered this?

Another query is that is there any function that I can refresh only a row within the RadGrid? As I have a dropdown control for each of the rows in the dropdown causing a postback after selecting an option, which causes postback. I have implemented an update panel for it but users is complaining they need to wait for the dropdown to populate the textboxes before proceeding on to the next record. I am looking into ways that it would be best to refresh only the row as user can proceed on without waiting for the postback to happen.

Cheers! 
dodrio
Chong
Top achievements
Rank 1
 asked on 17 Jan 2013
4 answers
207 views
Hi,

I have just installed 2010 Q1 (2010.1.309.20) and my previous code seems to have developed an issue.

I have a menu on the main page which calls RadWindow to open other pages.  This is all handled through javascript and was working fine previously in Q3 2009.  After upgrading the RadWindow opens and displays, but the title bar and close icon appear briefly and then disappear.

If I open another window from my opened window, the title bar then appears OK.  I can close that window, but cannot now close the window opened from the menu.

David Penny
Marin Bratanov
Telerik team
 answered on 17 Jan 2013
2 answers
80 views
I'm having some trouble understanding what's up with the new SP 2010 RadEditor. When I deploy the wsp and activate the feature
'Use RadEditor to edit List Items', I get the following on my list items (attached images). The 2010 is missing images and doesn't have all the features that the 2007 version does. What is going on here? 

Rumen
Telerik team
 answered on 17 Jan 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?