Telerik Forums
UI for ASP.NET AJAX Forum
8 answers
119 views
function rowDropping1(sender, eventArgs) {
           
            var IndexValue = document.getElementById('<%=ddlCrew.ClientID %>').selectedIndex;
            var SelectedVal = document.getElementById('<%=ddlCrew.ClientID %>').options[IndexValue].value;

            
            if (SelectedVal == 0) {
                alert("Must select a crew before scheduling.");
                eventArgs.set.cancel(true);
                return;
            }

            // Fired when the user drops a grid row      
            var htmlElement = eventArgs.get_destinationHtmlElement();
            var scheduler = $find('<%= radScheculer.ClientID %>');

            if (isPartOfSchedulerAppointmentArea(htmlElement)) {
                // The row was dropped over the scheduler appointment area
                // Find the exact time slot and save its unique index in the hidden field
                var timeSlot = scheduler._activeModel.getTimeSlotFromDomElement(htmlElement);

                //$get("TargetSlotHiddenField").value = timeSlot.get_index();
                document.getElementById("<%=TargetSlotHiddenField.ClientID %>").value = timeSlot.get_index();
                // The HTML needs to be set in order for the postback to execute normally
                eventArgs.set_destinationHtmlElement("TargetSlotHiddenField");
            }
            else {
                // The node was dropped elsewhere on the document
                eventArgs.set_cancel(true);
            }
        }


function isPartOfSchedulerAppointmentArea(htmlElement) {
            // Determines if an html element is part of the scheduler appointment area
            // This can be either the rsContent or the rsAllDay div (in day and week view)
            return $telerik.$(htmlElement).parents().is("div.rsAllDay") ||
                            $telerik.$(htmlElement).parents().is("div.rsContent")
        }
In Above two functions, there is a statement as below,

var htmlElement = eventArgs.get_destinationHtmlElement();

This statement returns incorrect html on row dropping over scheduler from grid.
This only happens with Crome. In Mozilla its works well and as expected. 

I feel that in some Crome version its working correctly and for others its returns wrong elements
i.e its return gridrow td element instead of scheduler td element.

Please some buddy fix it! 

Thanks in advance!



Plamen
Telerik team
 answered on 18 Dec 2014
4 answers
430 views
Good day,

I was wondering if it is possible to include text above the exported data in an Excel file using the normal Export to Excel method with a RadGrid?

For example I wish to include a description of the data as follows,  "Description: Data selected using dates between 1 Jan 2011 to 1 Sep 2011", above the actual data exported.

I shall be grateful for any information on this matter

Justin
Paul
Top achievements
Rank 1
 answered on 17 Dec 2014
1 answer
436 views
I'm fetching column names and column types (Text, Note, DateTime, Number, and Currency) from another system in my c# code behind.

I use this to create a query to return back a datatable. I also use this to create columns for a RadGrid control my my ASPX page.

This is what I'm using to add fields to the grid:

private void AddFieldToRadGrid(string internalName, string type, string title)
        {
            if (rgStudyInfo.MasterTableView.Columns.FindByUniqueNameSafe(internalName) == null)
            {
                if (string.IsNullOrEmpty(title)) title = internalName;
                GridBoundColumn column = new GridBoundColumn();
                column.HeaderText = title;
                column.AllowSorting = true;
                column.AllowFiltering = true;
                column.HeaderStyle.HorizontalAlign = HorizontalAlign.Left;
                column.DataField = internalName;
                column.EmptyDataText = "N/A";
                column.UniqueName = internalName;
                column.SortExpression = internalName;
                column.ItemStyle.VerticalAlign = VerticalAlign.Top;
                Type typ;
                switch (type)
                {
                    case "DateTime":
                        typ = typeof(System.DateTime);
                        break;
                    case "Number":
                        typ = typeof(System.Int32);
                        break;
                    case "Currency":
                        typ = typeof(System.Decimal);
                        break;
                    default:
                        typ = typeof(System.String);
                        break;
                }
                column.DataType = typ;
                rgStudyInfo.MasterTableView.Columns.Add(column);
            }
        }

I read online that if the grid itself is delcared via markup, the new columns should be added during Page_Load within a !Page.IsPosback test. I can't get the dataformatstring to work if I add it here (using "{0:dd-MMM-yyyy}" for it in the case "DateTime" above). So I was attempting to format date fields during the itemdatabound event. But when I check to see if a field is type DateTime, I find that all fields are String. I checked if e.Item is GridDataItem, then instantiated a GridDataItem variable (e.Item as GridDataItem) to get the row.

The only place I found a referenced data type was in ((DataRowView)item.DataItem).Row.Table.Columns[col].DataType (col is an int index). And as I said, it's always System.String. Dates are in the columns, as strings that include date as well as time.

Also, since I programmatically added columns, do I need to do something special to handle sorting when users click column headers? When I click on them, the column headers' tex disappears and the grid isn't sorted.  Filtering breaks the page, but I haven't looked into that yet. Do I need to do something special for that since the columns were added programatically?

Data is loading fine during ItemDataBound event, and column headers are properly shown.


Pavlina
Telerik team
 answered on 17 Dec 2014
2 answers
98 views
I set the AllowPaging="true" and PageSize="2" but the list view only creates on long column when I was hoping it would create 2 columns.
Here is the code I have.

<telerik:RadListView ID="equipmentListView" runat="server" AllowPaging="true" PageSize="2">
    <LayoutTemplate>
        <div>
            <table>
                <tbody>
                    <tr id="itemPlaceholder" runat="server">
                    </tr>
                </tbody>
            </table>
        </div>
    </LayoutTemplate>
    <ItemTemplate>
        <tr>
            <td>
                <asp:Label ID="Label7" runat="server" Text="Stuff1" />
                <asp:Label ID="Label5" runat="server" Text="Stuff1" />
                <asp:Label ID="Label8" runat="server" Text="Stuff2" />
                <asp:Label ID="Label9" runat="server" Text="Stuff2" />
            </td>
        </tr>
    </ItemTemplate>
</telerik:RadListView>
James
Top achievements
Rank 1
 answered on 17 Dec 2014
3 answers
159 views
How do I change the width of  tool FontName and FontSize?
Ianko
Telerik team
 answered on 17 Dec 2014
4 answers
146 views
Hello,

I want to export scheduler to pdf with a specific format: header (logo and title) + content (the Scheduler) + footer (other information). I try to do it with atributte Stylesheets="Style.css", but it isn't work. Am I doing something wrong?, How can I have a customized pdf?

Thanks,
Regards,
Fer
Fernanda
Top achievements
Rank 1
 answered on 17 Dec 2014
1 answer
86 views
Hello,
   I am looking solution for script error in editor control but can't find anywhere.
The error come when the page are more than 200 and also the string content table format.
Please see attach file. I am using the Child page which use editor control Inherits from Master page which use ASP scriptmanager below:
<asp:ScriptManager ID="_ScriptManager" runat="server">
    </asp:ScriptManager>

The below control I use in design:
<telerik:RadEditor runat="server" ID="RTF1" EnableTextareaMode="false" Skin="Office2007"
                                    Width="99%" Height="500px" AutoResizeHeight="false" StripFormattingOptions="NoneSupressCleanMessage"
                                    ToolsFile="~/Include/XML/WordProcessorEditorTools.xml" OnClientSelectionChange="OnClientSelectionChange"
                                    OnClientLoad="OnClientEditorLoad" OnClientPasteHtml="OnClientPasteHtml">
                                    <CssFiles>
                                        <telerik:EditorCssFile Value="~/EditorContentArea.css" />
                                    </CssFiles>
                                    <SpellCheckSettings AllowAddCustom="true" />
                                    <ImageManager ViewPaths="~/medical_illustration" />
                                </telerik:RadEditor>

Please give me the solution.
I am helpless now because of this script error.
I hope you understand my problem and help me.
Thanks.
Ianko
Telerik team
 answered on 17 Dec 2014
2 answers
218 views
Hi,

Just for tests I put a button on my page and used the code below but it does not seem to cause  a postback of refetch of data using NeedDataSource in code-behind?

function refresh() {
    var masterTable = $find("<%= grdUsers.ClientID %>").get_masterTableView();
    masterTable.rebind();
}
Al
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 17 Dec 2014
1 answer
72 views
When I upload a picture I want it to be scaled down to max width of 400px (according to scale) if a picture is about 1200px wide. How can I do that?
If an image is about 250 px, do nothing.
Kjell
Top achievements
Rank 1
Iron
Iron
 answered on 17 Dec 2014
1 answer
95 views
I have radgrid with custom telerik controls

i need to add  new row from client side




function AddRow(controlName, multirenlgon) {
 
            var grd = $('#' + controlName); // where controlName is the ID
        
            var tbod = grd[0].rows[0].parentNode;
            var newRow = grd[0].rows[grd[0].rows.length - 1].cloneNode(true);
            tbod.appendChild(newRow);
    
       
            var multi = multirenlgon;
         
            EnviaDato('Add', multi, '', '', '', '');
        }



everything is cloned and append but not Events


can you help me?
Konstantin Dikov
Telerik team
 answered on 17 Dec 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?