Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
293 views
Group,
I am new to the telerik tools, and I am using the RadGrid control.  Basically I have the grid populated with data, and I have a

GridEditCommandColumn

 

.  When I click the edit button it turns any fields that aren't set to ReadOnly into editable controls (edit in place).  Two of the columns are GridDateTimeColumn(s) that when in edit mode show as what appears to look similar to a TextBox with a Date and Time Picker next to the "TextBox."

I can't for the life of me, when I select a different date or time, access the new value via c# codebehind when I click update.  Hopefully my code will help explain what I am trying to do.  This code appears in my RadGrid1_UpdateCommand

-- This works and updates my Sql database table. Basically it recognizes the text fields inside the TextBox without any problems.

            TableCell cell8 = item["RunDuration"];  --"RunDuration" is my UniqueName for that GridBoundColumn
            string _RunDuration = (cell8.Controls[0] as TextBox).Text;
            myClass.RunDuration = Convert.ToDecimal(_RunDuration);  -- I created a class in c# to handle inserts/updates

-- I can't get this to work, and I am not sure how to reference a cell that has a Datetimepicker... it doesn't appear to be a textbox, but I
-- can't figure out how to reference it.

            TableCell cell6 = item["RunStartTime"];
            RadDatePicker _StartTime = (cell6.Controls[0] as RadDatePicker);
            mfgProductionRun.StartTime = Convert.ToDateTime(_StartTime);

I get an error of: Unable to cast object of type 'Telerik.Web.UI.RadDateTimePicker' to type 'System.IConvertible'.

Any help is greatly appreciated.  I just want to be able to click the edit button, change the datetime fields if necessary and then have the new values write to the Sql database when I click update..

Jon
Top achievements
Rank 1
 answered on 29 Jul 2010
3 answers
136 views
Hi,

I've managed to find a bug with the combo boxes.  It appears that if the Item text ends with a space (and possibly certain other characters) then javascript and server side code cannot get the selected value from a combo box.

I combine first and surname fields using the following:
COALESCE(FirstName+' ','') + COALESCE(Surname,'')
on some entries there is only a first name and for these the combo box fails.

When testing I found that if I then added a space after the surname then these would fail as well.

Sample code follows:

<telerik:RadComboBox ID="uxContact" Runat="server"  EmptyMessage=" - Select a Client - " AllowCustomText="true" CssClass="fullWidthComboBoxSP" onclientselectedindexchanging="LoadContactChildren" onitemsrequested="uxContact_ItemsRequested" OnClientItemsRequested="DropDownLoaded" MarkFirstMatch="True"></telerik:RadComboBox> 
 
JS  
uxContact = $find('uxFormView_uxContact');  
alert(uxContact.get_value());  
 
VB.NET  
DirectCast(uxFormView.FindControl("uxContact"), RadComboBox).SelectedValue 
I am currently using version 2010.1.519.35

I can get a partial work around by changing by SQL for the time being but obviously this is a problem with the control itself.  It's only started happening since I applied the latest update.

Any idea when a fix can be made (or if indeed a fix has been made on a more recent compilation).

Regards,

Jon


Simon
Telerik team
 answered on 29 Jul 2010
13 answers
279 views
I've just upgraded to the latest internal build to see if this issue is fixed, but it is not. Anyways, in the official release of 2010.1 what was happening is that I had a RadComboBox set to auto post back embedded inside a RadAjaxPanel. When the combo box posted back, all menu selections would disappear except the one selected, no errors to say what was wrong. The rad script manager is in the master page. Anyways, I've applied the latest internal build hotfix to see if that fixes stuff and I still have the same problem, but I get the following java script exception (as reported by Chrome).

/Portal/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=radScriptManager_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d4.1.40412.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3a315e40c1-4559-4b59-ba08-9c63c3f1ef4d%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2010.1.706.40%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3af0701647-7e8a-4d81-8815-8bfe442ffdc0%3a16e4e7cd%3af7645509%3a24ee1bba%3a19620875%3a874f8ea2%3a33108d14%3abd8f85e4%3aed16cbdc%3a1e771326%3aaa288e2d:3752Uncaught Error: SYNTAX_ERR: DOM Exception 12
Simon
Telerik team
 answered on 29 Jul 2010
1 answer
134 views
Hi,

  Iam using radschduler. Iam saving the details description,start,end.But how can i differntiate it is personal or work. Iam using checboxes to differentiate personal and work. BUt how can i insert in to the database these checkbox values.Below is my sample code.
I want to insert the Appoinment as personal or WOrk or both . Later I want to display based on the values of checkboxes. Please give me the solution as soons as possible.


    <div class="title">
                Schedule</div>
            <telerik:RadSplitter runat="server" ID="RadSplitter1" PanesBorderSize="0" Width="734px"
                Height="552px" Skin="Office2007" SplitBarsSize="">
                <telerik:RadPane runat="Server" ID="leftPane" Width="240px" MinWidth="240" MaxWidth="300"
                    Scrolling="None" OnClientResizing="hideScrollableArea" OnClientResized="showScrollableArea"
                    OnClientExpanding="hideScrollableArea" OnClientExpanded="showScrollableArea"
                    OnClientCollapsing="hideScrollableArea" OnClientCollapsed="showScrollableArea">
                    <div class="calendar-container">
                        <telerik:RadCalendar runat="server" ID="RadCalendar1" Skin="Office2007" AutoPostBack="True"
                            EnableMultiSelect="False" DayNameFormat="FirstTwoLetters" EnableMonthYearFastNavigation="False"
                            OnSelectionChanged="RadCalendar1_SelectionChanged" OnDefaultViewChanged="RadCalendar1_DefaultViewChanged"
                            SelectedDate="" ViewSelectorText="x">
                            <SpecialDays>
                                <telerik:RadCalendarDay Date="" IsToday="True">
                                </telerik:RadCalendarDay>
                            </SpecialDays>
                        </telerik:RadCalendar>
                        <telerik:RadCalendar runat="server" ID="RadCalendar2" Skin="Office2007" AutoPostBack="true"
                            EnableMultiSelect="false" DayNameFormat="FirstTwoLetters" EnableNavigation="false"
                            EnableMonthYearFastNavigation="false" OnSelectionChanged="RadCalendar2_SelectionChanged">
                        </telerik:RadCalendar>
                    </div>
                    <telerik:RadPanelBar runat="server" Skin="Office2007" ID="PanelBar" Width="100%">
                        <Items>
                            <telerik:RadPanelItem runat="server" Text="To Do" Expanded="true">
                                <Items>
                                    <telerik:RadPanelItem runat="server">
                                        <ItemTemplate>
                                          
                                        </ItemTemplate>
                                    </telerik:RadPanelItem>
                                </Items>
                            </telerik:RadPanelItem>
                            <telerik:RadPanelItem runat="server" Text="My Calendar" Expanded="true">
                                <Items>
                                    <telerik:RadPanelItem runat="server">
                                        <ItemTemplate>
                                            <div class="rpCheckBoxPanel">
                                                <div>
                                                    <asp:CheckBox ID="chkQ1" runat="server" Text="Personal" Checked="true" AutoPostBack="true"
                                                        OnCheckedChanged="CheckBoxes_CheckedChanged" />
                                                </div>
                                                <div>
                                                    <asp:CheckBox ID="chkQ2" runat="server" Text="Work" Checked="true" AutoPostBack="true"
                                                        OnCheckedChanged="CheckBoxes_CheckedChanged" />
                                                </div>
                                            </div>
                                        </ItemTemplate>
                                    </telerik:RadPanelItem>
                                </Items>
                            </telerik:RadPanelItem>
                        </Items>
                    </telerik:RadPanelBar>
                </telerik:RadPane>
                <telerik:RadSplitBar runat="server" ID="RadSplitBar2" CollapseMode="Forward" />
                <telerik:RadPane runat="Server" ID="rightPane" Scrolling="None" Width="490px">
                    <telerik:RadScheduler runat="server" ID="RadScheduler" Skin="Office2007" DataSourceID="UsersSqlDataSource"
                        Height="551px" ShowFooter="False" DataKeyField="TaskID" DataDescriptionField="Description" data
                        DataStartField="Start" DataEndField="End" DataSubjectField="Subject"
                        TimeZoneOffset="03:00:00" DayEndTime="21:00:00" FirstDayOfWeek="Monday" LastDayOfWeek="Friday"
                        EnableDescriptionField="True" AppointmentStyleMode="Default" AllowEdit="true" AllowDelete="true" AllowInsert="true">
                        <AdvancedForm Modal="true" />
                        <TimelineView UserSelectable="false" />
                        <ResourceStyles>
                            <%--AppointmentStyleMode must be explicitly set to Default (see above) otherwise setting BackColor/BorderColor
                         will switch the appointments to Simple rendering (no rounded corners and gradients)--%>
                            <telerik:ResourceStyleMapping Type="Calendar" Text="Development" />
                            <telerik:ResourceStyleMapping Type="Calendar" Text="Marketing" ApplyCssClass="rsCategoryRed" />
                            <telerik:ResourceStyleMapping Type="Calendar" Text="Work" ApplyCssClass="rsCategoryOrange" />
                        </ResourceStyles>
                        <AppointmentTemplate>
                            <div class="rsAptSubject">
                                <%# Eval("Subject") %>
                            </div>
                            <%# Eval("Description") %>
                        </AppointmentTemplate>
                        <TimeSlotContextMenuSettings EnableDefault="true" />
                        <AppointmentContextMenuSettings EnableDefault="true" />
                    </telerik:RadScheduler>
                </telerik:RadPane>
            </telerik:RadSplitter>
            <asp:SqlDataSource ID="UsersSqlDataSource" runat="server" ProviderName="System.Data.SqlClient"
                ConnectionString="Data Source=INTNSOR-D0768\SQLEXPRESS;Initial Catalog=Test;Integrated Security=True"
                SelectCommand="SELECT * FROM [Tasks] where CompanyID=@CompanyID"
                InsertCommand="INSERT INTO [Tasks] ([Subject], [Description], [Start], [End], CompanyID) VALUES (@Subject, @Description, @Start, @End, @CompanyID)"
                UpdateCommand="UPDATE [Tasks] SET [Subject] = @Subject, [Description] = @Description, [Start] = @Start, [End] = @End WHERE TaskID = @TaskID"
                DeleteCommand="DELETE FROM [Tasks] WHERE [TaskID] =@TaskID ">
                <SelectParameters>
                    <asp:SessionParameter Name="CompanyID" SessionField="CompanyID" />
                </SelectParameters>
                <DeleteParameters>
                    <asp:Parameter Name="TaskID" />
                </DeleteParameters>
                <UpdateParameters>
                    <asp:Parameter Name="Subject" Type="String" />
                    <asp:Parameter Name="Description" Type="String" />
                    <asp:Parameter Name="Start" Type="DateTime" />
                    <asp:Parameter Name="End" Type="DateTime" />
                    <asp:Parameter Name="TaskID" />
                </UpdateParameters>
                <InsertParameters>
                    <asp:Parameter Name="Subject" Type="String" />
                    <asp:Parameter Name="Description" Type="String" />
                    <asp:Parameter Name="Start" Type="DateTime" />
                    <asp:Parameter Name="End" Type="DateTime" />
                    <asp:SessionParameter Name="CompanyID" SessionField="CompanyID" />
                </InsertParameters>
            </asp:SqlDataSource>
Peter
Telerik team
 answered on 29 Jul 2010
4 answers
100 views
I have a grid that has 7 frozen columns whose data is bound, and up to 50 other columns which are dynamically created based on data in a table.(currently 24 columns are being created)  Everything seems to work fine until I go into edit mode and the frozen columns are disappearing or being pushed out.  Will scroll all the way back to the left and columns are missing.  If I tab through all the columns eventually I can return the the editcolumn or the frozen columns.  Also this seems to be happening if we edit one of the values.  We tested this page fairly thoroughly and seems like a new problem that arose.

*Note it seems to be working fine with Chrome or FireFox, but not in Internet Explorer.

Any help is appreciated.
Tsvetoslav
Telerik team
 answered on 29 Jul 2010
2 answers
123 views
Is there any way to wrap the title or have multi-line titles on the RadTab? I can easily set the text in code and include a line break but since the tabs are images they do not render correctly when text wraps.

Thanks!
jfkrueger
Top achievements
Rank 1
 answered on 29 Jul 2010
1 answer
148 views
Im having trouble adding a client side event as an attribute to the RadRating through the code behind. The RadRating is in a GridEditForm within a Grid so I'm having trouble "finding" controls when I try to do the javascript through the ASPX page.

Below is an example of my attempt. As you see I am trying to add a simple alert to the onclientrated event. When tracing the code, it doesn't seem to add the attribute. If you have a different solution to help me find controls within the Radgrid Editforms, please let me know.

Thanks Kellie

protected void RadGridAssetExtrasCondition_ItemDataBound(object sender, GridItemEventArgs e)
{
    switch (e.Item.OwnerTableView.Name)
    {
        case "AssetExtrasCondition":
            if (e.Item is GridCommandItem)
            {
                Do some stuff here
            }
            if (e.Item is GridDataItem)
            {
                Do some stuff here
            }
            if ((e.Item is GridEditFormItem || e.Item is GridEditFormInsertItem) && e.Item.IsInEditMode)
            {
                var ctrlLabelConditionRatingDescription = (Label)e.Item.FindControl("LabelConditionRatingDescription");
                var ctrlRadRatingCondition = (RadRating)e.Item.FindControl("RadRatingCondition");
  
  
                // Creating the Rad Rating stars dynamically
                foreach (var item in this.ConditionRatings.Items)
                {
                    var ratingItem = new RadRatingItem
                                         {
                                             Value = Convert.ToDecimal(item.Rating),
                                             ToolTip = item.Rating.ToString()
                                         };
                    ctrlRadRatingCondition.Items.Add(ratingItem);
                }
  
                ctrlRadRatingCondition.Attributes.Add("onclientrated", "alert('hello');");
  
                if (!e.Item.OwnerTableView.IsItemInserted)
                {
                   Do some stuff here
                }
            }
            break;
    }
}
Tsvetie
Telerik team
 answered on 29 Jul 2010
1 answer
264 views
Are there any circumstances which would cause cacheDependency to forget the temporary files to delete?
Can it survive a machine reboot?
T. Tsonev
Telerik team
 answered on 29 Jul 2010
1 answer
108 views
Hi,

Iam creating a masterview for a telerik grid and binding few columns on firsttime pageload. One among these columns is Editable column. But when I click on 2nd page in the grid, my editable column is displayed as a non-editable column. How to make sure that this column is always editable ?  Is there any way to clear the grid view and reconfigure on every postback ? Please suggest.

protected void Page_Init()
    {
       ConfigureGrid();
          
    }
  
  
private void ConfigureGrid()
    {
  
        OrderTypeRankingGrid.AddNeedDataSourceEventHandler(NeedDataSource); // Binding master table view
        OrderTypeRankingGrid.AddGridCommandEventHandler(DataGrid_ItemCommand); // Events for the standard ngm controls
  
        OrderTypeRankingGrid.AllowColumnsReorder = false;
           
        OrderTypeRankingGrid.GridHeaderText = "Order Type Ranking"
        var masterView = OrderTypeRankingGrid.ConfigureMasterTableView("vDivisionOrderTypeRanking", new string[] { "DivisionOrderTypeRankId" });
        masterView.AllowFilteringByColumn = true;
        masterView.AllowSorting = true;
        masterView.FullEditMode = true;
        masterView.EditMode = GridEditMode.InPlace;
        masterView.EnableShowHideColumns = true;
        masterView.SetPaging(GridPagerMode.NextPrevAndNumeric);
        masterView.GridTableView.ShowHeader = true;
        masterView.ShowHeader = true;
        masterView.ShowFooter = true;
        masterView.ShowHeadersWhenNoRecords = true;
        masterView.AllowPaging = true;
          
        //Enable standard Ngm controls
          
          
        masterView.AddNgmCommandButton(NgmButtonType.Save, "btnSave", null, null, "Save Function Id", Unit.Pixel(50));
        masterView.AddNgmCommandButton(NgmButtonType.Cancel, null, null, null, null, Unit.Pixel(50));
          
        masterView.CommandItemDisplay = GridCommandItemDisplay.Bottom;
  
        if (!IsPostBack)  //must check for postback; otherwise, columns will be duplicated
        {
              
            //masterView.AddBoundColumn("DivisionOrderTypeRankId", "Rank ID", null, true, false, true, Unit.Percentage(7.0));
            masterView.AddBoundColumn("CategoryCode", "Category Code", null, truefalse, true, Unit.Percentage(7.0));
            masterView.AddBoundColumn("PurposeCode", "Purpose Code", null, true, false, true, Unit.Percentage(7.0));
            masterView.AddBoundColumn("ReasonCode", "Reason Code", null, true, false, true, Unit.Percentage(7.0));
            masterView.AddBoundColumn("ReasonDescription", "Reason Description", null, true, false, true, Unit.Percentage(7.0));
            masterView.AddBoundColumn("OrderTypeRank", "Rank", null, false, false, true, Unit.Percentage(7.0));
  
        }
          
    }
  
  
  
  
protected void NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        if (IsPostBack)
        {
  
            if (!e.IsFromDetailTable && (this.productDivision == 1 || this.productDivision == 2))
            {
                 
                IDivisionOrderTypeRankService divisionOrderTypeRankServiceAgent = null;
                divisionOrderTypeRankServiceAgent = (IDivisionOrderTypeRankService)ContextRegistry.GetContext().GetObject("DivisionOrderTypeRankServiceAgent");
                IList<DivisionOrderTypeRankDTO> divisionOrderTypeRankDTOs = divisionOrderTypeRankServiceAgent.GetDivisionOrderTypeRankByDivision(productDivision);
                OrderTypeRankingGrid.DataSource = divisionOrderTypeRankDTOs;
                  
            }
        }
    }
Maria Ilieva
Telerik team
 answered on 29 Jul 2010
1 answer
182 views
Hello ...Is there a way to have the docking panels dynamically resize when the browser window is resized (both horizontally and   vertically)? I got this done horizontally... but how vertically...?
Pero
Telerik team
 answered on 29 Jul 2010
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?