Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
74 views
Hello,

I am using Visual Studio 2010 and Telerik.Web.UI, v.2012.1.215.40 (Dev).

My webform has an embedded RadScheduler. I believe that the RowHeight of a scheduler defaults to 25px. At run-time, however, I change the RowHeight property using the following simple code, based on the view selected by the end-user:
protected void radScheduler_NavigationComplete(object sender, SchedulerNavigationCompleteEventArgs e) {
    if (this.radScheduler.SelectedView == SchedulerViewType.TimelineView) {
        this.radScheduler.RowHeight = Unit.Pixel(100);
    }
    else {
        this.radScheduler.RowHeight = Unit.Pixel(25);
    }
}

That works fine and the row heights sucessfully switch between 25 and 100px as the user changes the view.

Then I added a button below the scheduler to export the current scheduler view to a PDF file. The button click code is very basic and is as follows:
protected void btnExport_Click(object sender, EventArgs e) {
    this.radScheduler.ExportToPdf();
}

The click event works fine and successfully creates a PDF file.

When the scheduler is in Timeline view, which successfully displays the row heights at 100px, and the export button is clicked, the row heights are ignored during the export to PDF. The row heights in the PDF file appear to be back at 25px. The webform, which is still open in Timeline view, continues to display the row heights at 100px. How can I resolve this problem?

BTW, if I do away with the NavigationComplete event above, and explicitly add RowHeight="100px" to the <telerik:RadScheduler> ... </telerik:RadScheduler> schema, I still have the same problem when I click my Export to PDF button.

Is there something I can do to maintain the 100px row height whenever I export to PDF?

Thanks,
Steven
Peter
Telerik team
 answered on 17 Aug 2012
7 answers
473 views
I am struggling to get a RadGrid to edit a few columns. It will go into edit mode for checkbox fields, but they will revert to their prior values when editing is complete. For numeric columns, it *looks* like they are editable, but values can not be changed at all. I've looked at all the code examples I can find and nothing seems to work.
Here's the aspx:
<script type="text/javascript">
 
     var hasChanges, inputs, dropdowns, editedRow;
 
     function RowClick(sender, eventArgs)
     {
         if (editedRow != null && hasChanges)
         {
             if (confirm("Update changes?"))
             {
                 hasChanges = false;
                 $find("<%= MasterGrid.MasterTableView.ClientID %>").updateItem(editedRow);
             }
             else
             {
                 hasChanges = false;
             }
         }
     }
 
     function RowDblClick(sender, eventArgs)
     {
         if (editedRow && hasChanges)
         {
             if (confirm("Update changes?"))
             {
                 hasChanges = false;
                 $find("<%= MasterGrid.MasterTableView.ClientID %>").updateItem(editedRow);
             }
             else
             {
                 hasChanges = false;
             }
         }
          
         editedRow = eventArgs.get_itemIndexHierarchical();
         $find("<%= MasterGrid.MasterTableView.ClientID %>").editItem(editedRow);
     }
 
     function GridCreated(sender, eventArgs)
     {
         var gridElement = sender.get_element();
         var elementsToUse = [];
          
         inputs = gridElement.getElementsByTagName("input");
 
         for (var i = 0; i < inputs.length; i++)
         {
             if (inputs[i].type.toLowerCase() == "hidden")
             {
                 continue;
             }
 
             Array.add(elementsToUse, inputs[i]);
             inputs[i].onchange = TrackChanges;
         }
 
         dropdowns = gridElement.getElementsByTagName("select");
 
         for (var i = 0; i < dropdowns.length; i++)
         {
             dropdowns[i].onchange = TrackChanges;
         }
 
         setTimeout(function ()
         {
             if (elementsToUse[0]) elementsToUse[0].focus();
         }, 100);
     }
 
     function TrackChanges(e)
     {
          hasChanges = true;
     }
 
 
     function isChildOf(parentId, element)
     {
         while (element) {
             if (element.id && element.id.indexOf(parentId) > -1) {
                 return true;
             }
             element = element.parentNode;
         }
         return false;
     }
 
     function OnMoveToSelectedClick(sender, args) {
          
         var srcView = $find("<%=  ProfileGrid.ClientID %>").get_masterTableView();
         var dstView = $find("<%=  SelectedGrid.ClientID %>").get_masterTableView();
         var dataItems = srcView.get_dataItems();
         var selectedRows = srcView.get_selectedItems();
          
         var srcData = "<%=SelectedItems %>";
         var dstData = "<%=SelectedItems %>";
 
         for (var i = 0; i < selectedRows.length; i++)
         {
             var row = selectedRows[i];
             var cell = srcView.getCellByColumnUniqueName(row, "ItemID");
             //here cell.innerHTML holds the value of the cell
             var itemID = cell.innerHTML;
 
             srcView.deleteItem(dataItems[i].get_element());
         }
          
         return false;
     }
 
     function rowDropping(sender, eventArgs) {
         // Fired when the user drops a grid row
 
         var node = eventArgs.get_destinationHtmlElement();
 
         if (!isChildOf('<%=SelectedGrid.ClientID %>', node)) {
             eventArgs.set_cancel(true);
         } else {
 
         }
 
     }
 
</script>

<AxnGrids:AxnGrid
ID="MasterGrid"
runat="server"
Width="1550"
Height="356"
AutoGenerateColumns="False"
InitialResizeToFit="False"
AllowMultiRowSelection="False"
BorderStyle="Solid"
BorderColor="black"
BorderWidth="1px"
Visible="True"
OnPreRender="MasterGrid_PreRender"
OnNeedDataSource="MasterGrid_NeedDataSource"
AllowMultiRowEdit="False">
<ClientSettings
AllowRowsDragDrop="False"
AllowColumnsReorder="true"
ReorderColumnsOnClient="true">
<Selecting AllowRowSelect="False" EnableDragToSelectRows="false" CellSelectionMode="SingleCell"/>
<Scrolling AllowScroll="True" UseStaticHeaders="True" FrozenColumnsCount="1"/>
<ClientEvents OnRowClick="RowClick" OnRowDblClick="RowDblClick" OnGridCreated="GridCreated" />
</ClientSettings>
<MasterTableView
CommandItemDisplay="Top"
MasterKeyField="ItemID"
Width="100%"
TableLayout="Fixed"
EditMode="InPlace"
AllowAutomaticUpdates="False"
AllowAutomaticDeletes="False"
AllowAutomaticInserts="False">
<CommandItemSettings ShowAddNewRecordButton="False"/>
<NoRecordsTemplate>
<div style="height: 30px; cursor: pointer;">No inventory items found.</div>
</NoRecordsTemplate>
<Columns>
<telerik:GridEditCommandColumn Visible="True" HeaderStyle-Width="100px" />
<telerik:GridDragDropColumn HeaderStyle-Width="18px" Visible="false" />
<AxnGrids:AxnGridBoundColumn UniqueName="ItemID" DataField="ItemID" HeaderText="ItemID" Visible="False" ReadOnly="True"/>
<AxnGrids:AxnGridBoundColumn UniqueName="PartNumber" DataField="PartNumber" HeaderText="Part" HeaderStyle-Width="100px" ReadOnly="True"/>
<AxnGrids:AxnGridBoundColumn UniqueName="Description" DataField="Description" HeaderText="Description" HeaderStyle-Width="200px" HeaderStyle-HorizontalAlign="Left" ReadOnly="True"/>
<AxnGrids:AxnGridBoundColumn UniqueName="ShopID" DataField="ShopID" HeaderText="Shop" HeaderStyle-Width="100px" ReadOnly="True"/>
<AxnGrids:AxnGridBoundColumn UniqueName="Manufacturer" DataField="Manufacturer" HeaderText="Manufacturer" HeaderStyle-Width="100px" ReadOnly="True"/>
<telerik:GridNumericColumn UniqueName="OnHand" DataField="OnHand" HeaderText="On Hand" HeaderStyle-Width="100px" ReadOnly="True"/>
<telerik:GridNumericColumn UniqueName="OnOrder" DataField="OnOrder" HeaderText="On Order" HeaderStyle-Width="100px" ReadOnly="True"/>
<telerik:GridCheckBoxColumn UniqueName="Seasonal" DataField="Seasonal" HeaderText="Seasonal" HeaderStyle-Width="100px" ReadOnly="False" />
<telerik:GridCheckBoxColumn UniqueName="UseLeadTime" DataField="UseLeadTime" HeaderText="Use Lead Time" HeaderStyle-Width="150px" ReadOnly="False"/>
<telerik:GridCheckBoxColumn UniqueName="UseOrderCycle" DataField="UseOrderCycle" HeaderText="Use Order Cycle" HeaderStyle-Width="200px" ReadOnly="False"/>
<telerik:GridNumericColumn UniqueName="ServiceLevel" DataField="ServiceLevel" HeaderText="Service Level" HeaderStyle-Width="100px" ReadOnly="False"/>
<telerik:GridNumericColumn UniqueName="ForecastPeriod" DataField="ForecastPeriod" HeaderText="Forecast Period" HeaderStyle-Width="140px" ReadOnly="False"/>
<telerik:GridNumericColumn UniqueName="DemandScope" DataField="DemandScope" HeaderText="Demand Scope" HeaderStyle-Width="150px" ReadOnly="False"/>
<telerik:GridNumericColumn UniqueName="AverageLeadTime" DataField="AverageLeadTime" HeaderText="Average Lead Time" HeaderStyle-Width="150px" ReadOnly="True"/>
<telerik:GridNumericColumn UniqueName="AverageOrderCycle" DataField="AverageOrderCycle" HeaderText="Average Order Cycle" HeaderStyle-Width="150px" ReadOnly="True"/>
<telerik:GridNumericColumn UniqueName="TotalDemand" DataField="TotalDemand" HeaderText="Total Demand" HeaderStyle-Width="150px" ReadOnly="True"/>
<telerik:GridNumericColumn UniqueName="AverageDemand" DataField="AverageDemand" HeaderText="Average Demand" HeaderStyle-Width="150px" ReadOnly="True"/>
<telerik:GridNumericColumn UniqueName="TotalVariance" DataField="TotalVariance" HeaderText="Total Variance" HeaderStyle-Width="150px" ReadOnly="True"/>
<telerik:GridNumericColumn UniqueName="AverageVariance" DataField="AverageVariance" HeaderText="Average Variance" HeaderStyle-Width="150px" ReadOnly="True"/>
<telerik:GridNumericColumn UniqueName="StandardDeviation" DataField="StandardDeviation" HeaderText="Standard Deviation" HeaderStyle-Width="150px" ReadOnly="True"/>
<telerik:GridNumericColumn UniqueName="ServiceFactor" DataField="ServiceFactor" HeaderText="Service Factor" HeaderStyle-Width="150px" ReadOnly="True"/>
<telerik:GridNumericColumn UniqueName="DemandCost" DataField="DemandCost" HeaderText="Demand Cost" HeaderStyle-Width="150px" ReadOnly="True"/>
<telerik:GridNumericColumn UniqueName="AverageInventoryCost" DataField="AverageInventoryCost" HeaderText="Average Inventory Cost" HeaderStyle-Width="160px" ReadOnly="True"/>
<telerik:GridNumericColumn UniqueName="LeadTimeFactor" DataField="LeadTimeFactor" HeaderText="Lead Time Factor" HeaderStyle-Width="150px" ReadOnly="True"/>
<telerik:GridNumericColumn UniqueName="OrderCycleFactor" DataField="OrderCycleFactor" HeaderText="Order Cycle Factor" HeaderStyle-Width="150px" ReadOnly="True"/>
<telerik:GridNumericColumn UniqueName="Turns" DataField="Turns" HeaderText="Turns" HeaderStyle-Width="130px" ReadOnly="True"/>
<telerik:GridNumericColumn UniqueName="HighPoint" DataField="HighPoint" HeaderText="High Point" HeaderStyle-Width="150px" ReadOnly="True"/>
<telerik:GridNumericColumn UniqueName="RecReorderPoint" DataField="RecReorderPoint" HeaderText="Recommended Reorder Point" HeaderStyle-Width="200px" ReadOnly="True"/>
<telerik:GridNumericColumn UniqueName="RecSafetyPoint" DataField="RecSafetyPoint" HeaderText="Recommended Safety Point" HeaderStyle-Width="190px" ReadOnly="True"/>
<telerik:GridNumericColumn UniqueName="AverageCost" DataField="AverageCost" HeaderText="Average Cost" HeaderStyle-Width="150px" ReadOnly="True"/>
<telerik:GridNumericColumn UniqueName="InventoryValue" DataField="InventoryValue" HeaderText="Inventory Value" HeaderStyle-Width="150px" ReadOnly="True"/>
</Columns>
</MasterTableView>
</AxnGrids:AxnGrid>

The data that the grid is binding to is a System.Collections.Generic.List of items coming from a web service.

I found the double-click edit code in the documentation, I believe, but I would also like for editing to not require a double click. I would prefer that edits be started as soon as the cell has focus and edits committed as soon as the cell loses focus. So if there are any pointers on how to do that I would appreciate the help. But, obviously, just getting the data to commit at all would be a primary objective.

Thanks,

Ben
TMW Systems

Ben
Top achievements
Rank 1
 answered on 17 Aug 2012
1 answer
87 views

I have an issue when i did the upgrade last version of Telerik '2012.2.607.35'
I tried others version, as '02217Telerik.Web.UI_2012_2_807_Dev_hotfix' or '2012.2.710.35' HotFix too.

This problem happend on the events Onchange and OnKeyPress.
I debugged the code and the problem is that method 'set_value' sign in loop.

The version HotFix '2012.2.710.35' works fine, but only the Event Onchange, the Event OnKeyPress the issue persists.

Example: (Javascript)
var iResul='25';
function Calcular(sender, args) {

        var textBox = sender;
        textBox.set_value(iResul);

 }

 

Martin
Telerik team
 answered on 17 Aug 2012
5 answers
1.0K+ views
In the attached page, the button set not to display with style="display:none", displays the rounded right side of the button when FormDecorator is applied.

Any ideas?  Currently i just bumped it off the page, but I would like to get it fixed properly.


<%@ Page Language="VB" AutoEventWireup="false" CodeFile="nobutton.aspx.vb" Inherits="Junk_nobutton" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> 
<%@ Register Assembly="System.Web.Ajax" Namespace="System.Web.UI" TagPrefix="asp" %> 
 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server"
    <div> 
     
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePartialRendering="true" CombineScripts="false">        </asp:ToolkitScriptManager> 
<telerik:RadFormDecorator runat="server" ID="RadFormDecorator1" EnableEmbeddedSkins="true" Skin="Forest" DecoratedControls="All"/> 
       
     
<asp:Table runat="server" ID="tblbtn" HorizontalAlign="Left" > 
    <asp:TableRow> 
        <asp:TableCell> 
            <asp:Button ID="buttonOpen" runat="server" CausesValidation="false" style="display:none"   OnClientClick="javascript:popUp('help/cmj.aspx?lt=3')" />   
        </asp:TableCell> 
    </asp:TableRow> 
</asp:Table> 
  
 <asp:PopupControlExtender ID="PopupControlExtender1" runat="server" PopupControlID="buttonOpen" TargetControlID="buttonOpen"></asp:PopupControlExtender> 
     
     
  <script type="text/javascript" language="javascript"
      function popup2(checkbox) { 
          if (checkbox.checked) 
              $get('<%= buttonOpen.ClientID %>').click(); 
          return true; 
      }   
  </script>  
    
    </div> 
    </form> 
</body> 
</html> 
 

Mohammed
Top achievements
Rank 2
 answered on 17 Aug 2012
3 answers
120 views

 

Good day,

We would like to know if is there any way to apply style of a control to an another. We have table inside RadPanelBar. Its looks fine with Metro style. Text is gray (#767676) and also there is bigger space between rows. If table is outside RadPanelBar, text is black and row space is not so big.

Question is how to apply style from RadPanelBar to another object. We apply class rfdAspLabel. Text is good colored but that’s all. There is now style for table formatting.


Thank you in advance for your advice.

Tsvetina
Telerik team
 answered on 17 Aug 2012
1 answer
91 views
I'm using RadScheduler (2012.2.724.40) set to MonthView to display a series of Appointments. In our app, Appointments are actually scheduled events (sent to Quartz Scheduler) requiring a precise start time but no end time, so we set the duration for all of them to 30 minutes just for display purposes. I'd like to keep the MonthView active, as our app has events spread out over the course of a month or more within a given context.

However, when adding an Appointment from MonthView, the StartTime defaults to 12:00 AM on the day of the appointment (an all-day appt) and does not change despite unchecking All Day and setting StartTime in the advanced form. What is the best way to work around this behavior?
James
Top achievements
Rank 1
 answered on 17 Aug 2012
3 answers
137 views
Hi,

We have a situation where we need to restrict user to input only numbers and the limit should be 15 digits with 2 precision.
We tried using the below code and looks there is a restriction of using more than 9 digits:

<telerik:RadMaskedTextBox ID="tbQuantity" runat="server" SelectionOnFocus="SelectAll"                                                                 AutoPostBack="true" Mask="<0..9999999999999>.<0..99>" />

We also tried the below from Telerik demos but the "." comes end like "111111." even though we type "111.111"
 <telerik:RadMaskedTextBox ID="txtNewPrice" runat="server" DisplayFormatPosition="Right" HideOnBlur="true" EmptyMessage="" Mask="##############.##" DisplayMask="##############.##" />

Please help in this regard. 

Thanks.
Mohan
Top achievements
Rank 1
 answered on 17 Aug 2012
4 answers
491 views
I use standard filters for each grid column. The functionality works fine.
But we would like to fit the filter controls automatically when user resizes the columns.

Grid contains corresponding property "FilterControlWidth" and it is possible to set it to "100%". But, unfortunately, it doesn't work as we expected. The "100%" width can be specified only for the textbox and it means that corresponding filter icon always wraps.
The similar problem is for DateTime columns with textbox and 2 icons (date selection and filter).

The idea is to set "100%" for a wrapper on the textbox and filter icon in order to avoid the filter row wrapping.

Is it possible to fit the filter controls automatically?
Vamsi Kamal
Top achievements
Rank 1
 answered on 17 Aug 2012
8 answers
342 views
Is there a way to narrow this column? right now the range filter is quite wide is there a way to stack the datepickers instead of having them appear side by side, this takes up an enourmous amount of grid real estate.  I have tried filtercontrolwidth and it had no effect at all.  Please assist, thank you.
Pavlina
Telerik team
 answered on 17 Aug 2012
1 answer
58 views
Hello, 

I want to set the VirtualItemCount to the number of items within a SQL query. Following this example : http://demos.telerik.com/aspnet-ajax/grid/examples/client/virtualscrollpaging/defaultcs.aspx .

How would I set the Virtual item count whenever I do a query within the defaultcs.aspx NeedDataSource, and update the grid?

Thank you, Joe Nguyen
Andrey
Telerik team
 answered on 17 Aug 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?