Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
409 views
Hello,

I'm having issues when setting the selected and minimum dates on a RadDateTimePicker client-side.

I've two RadDateTimePickers, one for setting the starting datetime (dtpBegin) and other for the ending (dtpEnd) declared as follows:
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
        ......
    <telerik:RadDateTimePicker ID="dtpBegin" runat="server">
        <ClientEvents OnDateSelected="startDateTimeSelected" OnPopupClosing="startDateTimePopupClosing" />
    </telerik:RadDateTimePicker>
    <telerik:RadDateTimePicker ID="dtpEnd" runat="server">
        <ClientEvents OnPopupClosing="endDateTimePopupClosing" />
    </telerik:RadDateTimePicker>
</telerik:RadAjaxPanel>
 
<telerik:RadScriptBlock runat="server">
    <script type="text/javascript">
        var endDateTimePickerId = "<%= dtpEnd.ClientID %>";
    </script>
</telerik:RadScriptBlock>


When selecting the starting datetime, I'd like to set the selected value as minimum on the ending control and also would like to set a valid value for that control (say the starting datetime plus 1 minute). To do that, I've the following code client-side:
function startDateTimeSelected(sender, e) {
    if (e.get_newDate != undefined && e.get_newDate() != null) {
        var startDate = e.get_newDate();
        var endDateTimePicker = $find(endDateTimePickerId);
 
        endDateTimePicker.set_minDate(e.get_newDate());
        if (endDateTimePicker.get_timeView().getTime() < startDate) {
            var timeView = timePicker.get_timeView();
            timeView.setTime(newDate.getHours(), newDate.getMinutes() + 1, newDate.getSeconds(), newDate);
        }
    }
}

Now, even though the calls to set_minDate and setTime are not throwing any errors, the selected date on dtpEnd is not changed neither is the minimum date time set. One thing I find weird is that after setting the time on dtpEnd, if I run on Firebug's console:
$find(endDateTimePickerId).get_timeView().getTime()
 I get null.

And regarding the minimum date, if I run on Firebug's console:
$find(endDateTimePickerId).get_minDate()

I get the expected value (even though the calendar allows to select any value).
One extra thing that might be useful for troubleshooting is that I'm also setting the MinDate server-side for these two controls (setting it to DateTime.Now to forbid users selecting past datetimes).

Thanks a lot,
Diego.
Maria Ilieva
Telerik team
 answered on 24 Jun 2011
4 answers
119 views
Hi.
I´ve got some problem to get my template manager dialog to fit my needs.
As below I set with / height of the dialog from code-behind, but i also need to set new width / height to the iframe that holds "preview".

protected override void OnInit(EventArgs e)
{
    base.OnInit(e);
    this.Page.PreRenderComplete += new EventHandler(Page_PreRenderComplete);
}
void Page_PreRenderComplete(object sender, EventArgs e)
{
    Telerik.Web.UI.DialogDefinition TemplateManager = bloggEditor.GetDialogDefinition("TemplateManager");
    TemplateManager.Height = Unit.Pixel(500);
    TemplateManager.Width = Unit.Pixel(1020);
}

How can i access Template Manager dialog iframe "templateIframe" to set my own width / height?

/Mattias
Rumen
Telerik team
 answered on 24 Jun 2011
1 answer
138 views
Hi

I use editor insert text ( Example : <b>abcdefghr </b> ) I was format "Bold" for Text. But when i insert in Database, It remove tag HTML become "abcdefghr" not Bold.

Please help
Dobromir
Telerik team
 answered on 24 Jun 2011
1 answer
126 views
Hi there , 
Can i call a Ajax request on the content page when i close the rad pop up window from the 'X' on the pop up window and not a button on the pop up window ?
Please advise if anyone has done this 
Thanks
Tsvetoslav
Telerik team
 answered on 24 Jun 2011
1 answer
120 views
I want to use RadMenu to show a tree of pages as an indented list of links. The basic markup that it generates is perfect, but I don't need the slide effects for child items: I want them to always be displayed. Is there any way of switching the slide feature off?
Kate
Telerik team
 answered on 24 Jun 2011
1 answer
318 views
Hi Guys,

I just download this control and I'm trying to walk through the tutorial pdf. All of the screen shots are different from the one that I that I have? I pretty much figured out most of it, however, I'm having trouble with getting the RadGrid to Edit, Add and Delete. The tutorial tells me "Go into the Property Builder, select the Master Table, select the Columns collection and then expan the Button Column tree in the Available Columns area." The button is not expandable??? It further says "You will see three options there. Go ahead and add all three." Again, nothing to add???

Can anyone help me out with this? Any help would be greatly appreciated.

William
Princy
Top achievements
Rank 2
 answered on 24 Jun 2011
1 answer
300 views
Long subject, I know, but here's what's happening:

I have a RadAjaxPanel.  Inside the RadAjaxPanel is an asp:Panel set to not visible and a button (button1).  Inside the asp:Panel is a button (button2) that calls a function called AlertIt() within a RadCodeBlock.  When button1 is clicked, it runs server code that makes the asp:Panel visible which, in turn, shows button2.  When you click button2, however, a Javascript error is thrown saying AlertIt() could not be found on the page.  button2 is showing like it should, so It's almost like it's stripping the Javascript out of the page.

When I remove the RadAjaxPanel so that the page does regular postbacks, it works just fine.  I've also tried a RadAjaxManager, but that yields the same results.

This is very urgent, so I hope someone can reply to this.  Here is all my code:

Master
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="TelerikIssues.Site1" %>
<!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>
    <asp:ContentPlaceHolder ID="head" runat="server"></asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <asp:ValidationSummary runat="server" ID="ValidationSummary1" EnableClientScript="true"
            HeaderText="The following errors were encountered: " />
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>

Content Page

<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true"
    CodeBehind="disappearingjavascript.aspx.cs" Inherits="TelerikIssues.disappearingjavascript" %>
<%@ Register Src="~/controls/javascriptinclude.ascx" TagPrefix="uc" TagName="test" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
        <asp:Panel ID="pnlTest" Visible="false" runat="server">
            <asp:Button ID="Button1" Text="Alert It" OnClientClick="javascript:AlertIt();" runat="server" />
            <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
                <script language="javascript" type="text/javascript">
                    function AlertIt() { alert("Success"); }
                </script>
            </telerik:RadCodeBlock>
        </asp:Panel>   
        <asp:Button ID="cmShow" Text="Show" OnClick="Show" runat="server" />
    </telerik:RadAjaxPanel>
</asp:Content>

Genti
Telerik team
 answered on 24 Jun 2011
1 answer
136 views

I have been searching all day to solve this problem and I am still at a loss.

I have a Grid that contains two detail tables linked to it, one of the Gallery allows the user to upload images to a specfic folder
for each property. Which names happens to be the primaryID of the Master Grid.  However I cannot get it to insert a new record as i have been unable to access the primary key and therefore the upload component does not target the correct folder.

Any Help would be appreciated.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="propertyadmin.aspx.cs" Inherits="Default2" %>
  
<!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>
</head>
<body>
    <form id="form1" runat="server">
    <asp:Label ID="Label1" ForeColor="Red" runat="server" />
    <asp:SqlDataSource ID="SqlDataSourceTransportOptions" runat="server" 
        ConnectionString="<%$ ConnectionStrings:proprovsConnectionString %>" 
        SelectCommand="SELECT * FROM [tbl_transport_option]"></asp:SqlDataSource>
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">
    </telerik:RadStyleSheetManager>
    <div>
  
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <%--Needed for JavaScript IntelliSense in VS2010--%>
            <%--For VS2008 replace RadScriptManager with ScriptManager--%>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
  
  
  
   
  
    <script type="text/javascript">
        //Put your JavaScript code here.
  
  
    </script>
  
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
  
        <script type="text/javascript">
        // <![CDATA[
            //On insert and update buttons click temporarily disables ajax to perform upload actions
            function conditionalPostback(sender, eventArgs) {
                var theRegexp = new RegExp("\.UpdateButton$|\.PerformInsertButton$", "ig");
                if (eventArgs.get_eventTarget().match(theRegexp)) {
                    var upload = $find(window['UploadId']);
  
                    //AJAX is disabled only if file is selected for upload
                    if (!upload || upload.getFileInputs()[0].value != "") {
                        eventArgs.set_enableAjax(false);
                    }
                }
            }
  
            function validateRadUpload(source, e) {
                e.IsValid = false;
  
                var upload = $find(source.parentNode.getElementsByTagName('div')[0].id);
                var inputs = upload.getFileInputs();
                for (var i = 0; i < inputs.length; i++) {
                    //check for empty string or invalid extension
                    if (inputs[i].value != "" && upload.isExtensionValid(inputs[i].value)) {
                        e.IsValid = true;
                        break;
                    }
                }
            }
            // ]]>
        </script>
  
    </telerik:RadCodeBlock>
  
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" ClientEvents-OnRequestStart="conditionalPostback">
  
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
            <asp:SqlDataSource ID="SqlDataSourceProperty" runat="server" 
            ConnectionString="<%$ ConnectionStrings:proprovsConnectionString %>" 
            SelectCommand="SELECT * FROM [tbl_property]" 
            DeleteCommand="DELETE FROM [tbl_property] WHERE [Property_ID] = @Property_ID" 
            InsertCommand="INSERT INTO [tbl_property] ([Property_Title], [Short_Description], [Tenure], [Plot_Size], [Building_Gross_Internal], [Building_Net_Internal], [Location],  [Description], [Accommodation], [Address], [Post_Code], [Price], [Geographical_Area], [Type], [Status], [date_Added], [thumbnail], [date_sold]) VALUES (@Property_Title, @Short_Description, @Tenure, @Plot_Size, @Building_Gross_Internal, @Building_Net_Internal, @Location, @Description, @Accommodation, @Address, @Post_Code, @Price, @Geographical_Area, @Type, @Status, @date_Added, @thumbnail, @date_sold)" 
            UpdateCommand="UPDATE [tbl_property] SET [Property_Title] = @Property_Title, [Short_Description] = @Short_Description, [Tenure] = @Tenure, [Plot_Size] = @Plot_Size, [Building_Gross_Internal] = @Building_Gross_Internal, [Building_Net_Internal] = @Building_Net_Internal, [Location] = @Location, [Description] = @Description, [Accommodation] = @Accommodation, [Address] = @Address, [Post_Code] = @Post_Code, [Price] = @Price, [Geographical_Area] = @Geographical_Area, [Type] = @Type, [Status] = @Status, [date_Added] = @date_Added, [thumbnail] = @thumbnail, [date_sold] = @date_sold WHERE [Property_ID] = @Property_ID">
                <DeleteParameters>
                    <asp:Parameter Name="Property_ID" Type="Int32" />
                </DeleteParameters>
                <InsertParameters>
                    <asp:Parameter Name="Property_Title" Type="String" />
                    <asp:Parameter Name="Short_Description" Type="String" />
                    <asp:Parameter Name="Tenure" Type="Int32" />
                    <asp:Parameter Name="Plot_Size" Type="String" />
                    <asp:Parameter Name="Building_Gross_Internal" Type="String" />
                    <asp:Parameter Name="Building_Net_Internal" Type="String" />
                    <asp:Parameter Name="Location" Type="String" />
                    <asp:Parameter Name="Description" Type="String" />
                    <asp:Parameter Name="Accommodation" Type="String" />
                    <asp:Parameter Name="Address" Type="String" />
                    <asp:Parameter Name="Post_Code" Type="String" />
                    <asp:Parameter Name="Price" Type="Decimal" />
                    <asp:Parameter Name="Geographical_Area" Type="Int32" />
                    <asp:Parameter Name="Type" Type="Int32" />
                    <asp:Parameter Name="Status" Type="Int32" />
                    <asp:Parameter Name="date_Added" Type="DateTime" />
                    <asp:SessionParameter Name="thumbnail" SessionField="DataCS" Type="String" />
                    <asp:Parameter Name="date_sold" Type="DateTime" />
                </InsertParameters>
                <UpdateParameters>
                    <asp:Parameter Name="Property_Title" Type="String" />
                    <asp:Parameter Name="Short_Description" Type="String" />
                    <asp:Parameter Name="Tenure" Type="Int32" />
                    <asp:Parameter Name="Plot_Size" Type="String" />
                    <asp:Parameter Name="Building_Gross_Internal" Type="String" />
                    <asp:Parameter Name="Building_Net_Internal" Type="String" />
                    <asp:Parameter Name="Location" Type="String" />
                    <asp:Parameter Name="Description" Type="String" />
                    <asp:Parameter Name="Accommodation" Type="String" />
                    <asp:Parameter Name="Address" Type="String" />
                    <asp:Parameter Name="Post_Code" Type="String" />
                    <asp:Parameter Name="Price" Type="Decimal" />
                    <asp:Parameter Name="Geographical_Area" Type="Int32" />
                    <asp:Parameter Name="Type" Type="Int32" />
                    <asp:Parameter Name="Status" Type="Int32" />
                    <asp:Parameter Name="date_Added" Type="DateTime" />
                    <asp:SessionParameter Name="thumbnail" SessionField="DataCS" Type="String" />
                    <asp:Parameter Name="date_sold" Type="DateTime" />
                    <asp:Parameter Name="Property_ID" Type="Int32" />
                </UpdateParameters>
        </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSourceArea" runat="server" 
        ConnectionString="<%$ ConnectionStrings:proprovsConnectionString %>" 
        SelectCommand="SELECT * FROM [tbl_geographic_area]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSourceType" runat="server" 
        ConnectionString="<%$ ConnectionStrings:proprovsConnectionString %>" 
        SelectCommand="SELECT * FROM [tbl_property_type]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSourceStatus" runat="server" 
        ConnectionString="<%$ ConnectionStrings:proprovsConnectionString %>" 
        SelectCommand="SELECT * FROM [tbl_status]"></asp:SqlDataSource>
      
        <asp:SqlDataSource ID="SqlDataSourceTenure" runat="server" 
            ConnectionString="<%$ ConnectionStrings:proprovsConnectionString %>" 
            SelectCommand="SELECT * FROM [tbl_tenure]"></asp:SqlDataSource>
      
        <telerik:RadGrid runat="server" ID="RadGrid1" AllowPaging="True" AllowSorting="True"
                AutoGenerateColumns="False" Width="97%" 
            DataSourceID="SqlDataSourceProperty" AllowAutomaticInserts="True"
                AllowAutomaticUpdates="True" AllowAutomaticDeletes="True" OnUpdateCommand="RadGrid1_UpdateCommand"
                OnInsertCommand="RadGrid1_InsertCommand" Skin="Web20" OnItemDataBound="RadGrid1_ItemDataBound"
                ShowStatusBar="True" GridLines="None" AutoGenerateDeleteColumn="True" 
            AutoGenerateEditColumn="True" CellSpacing="0" AutoGenerateHierarchy="True" OnSelectedIndexChanged="RadGrid1_SelectedIndexChanged">
            <ClientSettings>
                <Selecting AllowRowSelect="True" />
            </ClientSettings>
<MasterTableView AutoGenerateColumns="False" DataKeyNames="Property_ID" CommandItemDisplay="TopAndBottom" 
                NoDetailRecordsText="No records to display." 
                DataSourceID="SqlDataSourceProperty">
    <DetailTables>
        <telerik:GridTableView runat="server" DataSourceID="SqlDataSourceTransport" 
            Caption="Transport Opions" AllowPaging="False" AllowSorting="False" CommandItemDisplay="Top" 
            DataKeyNames="transportOptionID,property_ID">
            <ParentTableRelation>
                <telerik:GridRelationFields DetailKeyField="property_ID" 
                    MasterKeyField="Property_ID" />
            </ParentTableRelation>
            <CommandItemSettings ExportToPdfText="Export to PDF" />
            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
            </RowIndicatorColumn>
            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridDropDownColumn DataField="option_ID" 
                    DataSourceID="SqlDataSourceTransportOptions" 
                    FilterControlAltText="Filter transportOptionDD column" 
                    HeaderText="Transport Option" ListTextField="transtport_type" 
                    ListValueField="transport_option_ID" UniqueName="transportOptionDD">
                </telerik:GridDropDownColumn>
                <telerik:GridBoundColumn DataField="description" 
                    FilterControlAltText="Filter description column" HeaderText="Description" 
                    UniqueName="description">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="property_ID" Display="False" 
                    FilterControlAltText="Filter property_ID column" HeaderText="Property ID" 
                    ReadOnly="True" UniqueName="property_ID">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="transportOptionID" 
                    FilterControlAltText="Filter propertyTransportOptionID column" 
                    HeaderText="Property Transport ID" ReadOnly="True" 
                    UniqueName="propertyTransportOptionID">
                </telerik:GridBoundColumn>
            </Columns>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
            </EditFormSettings>
        </telerik:GridTableView>
        <telerik:GridTableView runat="server" 
            DataKeyNames="galleryImageID,propertyID" 
            DataSourceID="SqlDataSourceGallery" AllowAutomaticDeletes="True" 
            AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowSorting="False"
            CommandItemDisplay="Top" >
            <ParentTableRelation>
                <telerik:GridRelationFields DetailKeyField="PropertyId" 
                    MasterKeyField="Property_ID" />
            </ParentTableRelation>
            <CommandItemSettings ExportToPdfText="Export to PDF" />
            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
            </RowIndicatorColumn>
            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridTemplateColumn HeaderText="FolderName" UniqueName="FolderName" 
                    DataField="PropertyID" >
                    <ItemTemplate>
                        <asp:Label runat="server" ID="LblFolder" Text='<%# Eval("PropertyId") %>'></asp:Label>
                    </ItemTemplate>
                    <editItemTemplate>
                        <asp:Label runat="server" ID="LblFolder" Text='<%# Eval("PropertyId") %>'></asp:Label>
                     </editItemTemplate>
                </telerik:GridTemplateColumn>
              
                <telerik:GridBoundColumn DataField="Filename" 
                    FilterControlAltText="Filter Filename column" HeaderText="Filename" 
                    UniqueName="Filename" ReadOnly="True">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Height" 
                    FilterControlAltText="Filter Height column" HeaderText="Height" 
                    UniqueName="Height">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="width" 
                    FilterControlAltText="Filter width column" HeaderText="Width" 
                    UniqueName="width">
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn DataField="filename" 
                    FilterControlAltText="Filter Image column" HeaderText="Image" 
                    UniqueName="Image">
                    <EditItemTemplate>
                        <telerik:RadUpload ID="RadUpload2" Runat="server" 
                AllowedFileExtensions=".jpg,.png,.gif,.wmv" ControlObjectsVisibility="None" 
                InitialFileInputsCount="1" MaxFileInputsCount="1" MaxFileSize="10000000" 
                Skin="Windows7" OverwriteExistingFiles="True">
                </telerik:RadUpload>
                    </EditItemTemplate>
                    <ItemTemplate>
                      <img src="media/gallery/<%# Eval("PropertyId") %>/<%# Eval("Filename") %>" alt="Image" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="PropertyID" Display="False" 
                    FilterControlAltText="Filter PropertyID column" HeaderText="Property ID" 
                    ReadOnly="True" UniqueName="PropertyID">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Size" Display="False" 
                    FilterControlAltText="Filter size column" HeaderText="Size" UniqueName="size" 
                    Visible="False">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="GalleryImageID" Display="False" 
                    FilterControlAltText="Filter galleryImageID column" HeaderText="Image" 
                    ReadOnly="True" UniqueName="galleryImageID">
                </telerik:GridBoundColumn>
            </Columns>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
            </EditFormSettings>
        </telerik:GridTableView>
    </DetailTables>
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
  
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
</RowIndicatorColumn>
  
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" 
        Visible="True">
</ExpandCollapseColumn>
  
    <Columns>
        <telerik:GridBoundColumn DataField="Property_ID" 
            FilterControlAltText="Filter Property_ID column" HeaderText="Property_ID" 
            SortExpression="Property_ID" UniqueName="Property_ID" 
            DataType="System.Int32" ReadOnly="True">
        </telerik:GridBoundColumn>
  
        <telerik:GridTemplateColumn HeaderText="Thumbnail" UniqueName="Upload" 
            DataField="thumbnail">
            <ItemTemplate>
            <img src="media/thumbnails/<%# Eval("Thumbnail") %>" alt="thumbnail" />
             
            </ItemTemplate>
            <EditItemTemplate>
                <telerik:RadUpload ID="RadUpload1" Runat="server" 
                AllowedFileExtensions=".jpg,.png,.gif,.wmv" ControlObjectsVisibility="None" 
                InitialFileInputsCount="1" MaxFileInputsCount="1" MaxFileSize="10000000" 
                Skin="Windows7" OverwriteExistingFiles="True">
                </telerik:RadUpload>
            </EditItemTemplate>
       </telerik:GridTemplateColumn>
  
        <telerik:GridBoundColumn DataField="Property_Reference" 
            FilterControlAltText="Filter Property_Reference column" 
            HeaderText="Property_Reference" SortExpression="Property_Reference" 
            UniqueName="Property_Reference">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Property_Title" 
            FilterControlAltText="Filter Property_Title column" 
            HeaderText="Property_Title" SortExpression="Property_Title" 
            UniqueName="Property_Title">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Short_Description" 
            FilterControlAltText="Filter Short_Description column" HeaderText="Short_Description" 
            SortExpression="Short_Description" UniqueName="Short_Description" 
            Display="False">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Plot_Size" 
            FilterControlAltText="Filter Plot_Size column" HeaderText="Plot_Size" 
            SortExpression="Plot_Size" UniqueName="Plot_Size" Display="False">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Building_Gross_Internal" 
            FilterControlAltText="Filter Building_Gross_Internal column" HeaderText="Building_Gross_Internal" 
            SortExpression="Building_Gross_Internal" 
            UniqueName="Building_Gross_Internal" Display="False">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Building_Net_Internal" 
            FilterControlAltText="Filter Building_Net_Internal column" 
            HeaderText="Building_Net_Internal" SortExpression="Building_Net_Internal" 
            UniqueName="Building_Net_Internal" Display="False">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Location" 
            FilterControlAltText="Filter Location column" 
            HeaderText="Location" SortExpression="Location" 
            UniqueName="Location" Display="False">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Description" 
            FilterControlAltText="Filter Description column" 
            HeaderText="Description" SortExpression="Description" 
            UniqueName="Description" Display="False">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Accommodation" 
            FilterControlAltText="Filter Accommodation column" HeaderText="Accommodation" 
            SortExpression="Accommodation" UniqueName="Accommodation" Display="False">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Address" 
            FilterControlAltText="Filter Address column" HeaderText="Address" 
            SortExpression="Address" UniqueName="Address">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Post_Code" 
            FilterControlAltText="Filter Post_Code column" HeaderText="Post_Code" 
            SortExpression="Post_Code" UniqueName="Post_Code">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Price" 
            FilterControlAltText="Filter Price column" HeaderText="Price" 
            SortExpression="Price" UniqueName="Price" DataType="System.Decimal">
        </telerik:GridBoundColumn>
        <telerik:GridDropDownColumn DataField="Geographical_Area" 
            DataSourceID="SqlDataSourceArea" Display="False" 
            FilterControlAltText="Filter geoArea column" HeaderText="Geographic Area" 
            ListTextField="area" ListValueField="geographic_ID" UniqueName="geoArea">
        </telerik:GridDropDownColumn>
        <telerik:GridDropDownColumn DataField="Status" 
            DataSourceID="SqlDataSourceStatus" Display="False" 
            FilterControlAltText="Filter Status column" HeaderText="Status" 
            ListTextField="status_type" ListValueField="status_id" UniqueName="Status">
        </telerik:GridDropDownColumn>
        <telerik:GridDropDownColumn DataField="Tenure" 
            DataSourceID="SqlDataSourceTenure" FilterControlAltText="Filter Tenure column" 
            HeaderText="Tenure" ListTextField="tenure_type" ListValueField="tenure_ID" 
            UniqueName="Tenure">
        </telerik:GridDropDownColumn>
        <telerik:GridDropDownColumn DataField="Type" DataSourceID="SqlDataSourceType" 
            FilterControlAltText="Filter Type column" HeaderText="Type" 
            ListTextField="property_type" ListValueField="type_ID" UniqueName="Type">
        </telerik:GridDropDownColumn>
        <telerik:GridDateTimeColumn DataField="Date_Added" 
            FilterControlAltText="Filter DataAdded column" HeaderText="Date Added" 
            UniqueName="DataAdded">
        </telerik:GridDateTimeColumn>
        <telerik:GridDateTimeColumn DataField="date_sold" 
            FilterControlAltText="Filter dateSold column" HeaderText="Date Sold" 
            UniqueName="dateSold">
        </telerik:GridDateTimeColumn>
    </Columns>
  
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column" 
        UniqueName="EditCommandColumn1"></EditColumn>
</EditFormSettings>
</MasterTableView>
  
<FilterMenu EnableImageSprites="False"></FilterMenu>
  
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
        </telerik:RadGrid>
  
        </telerik:RadAjaxPanel>
  
      
        <asp:SqlDataSource ID="SqlDataSourceTransport" runat="server" 
            ConnectionString="<%$ ConnectionStrings:proprovsConnectionString %>" 
              
              
              
            SelectCommand="SELECT * FROM [tbl_property_transport_options] WHERE ([property_ID] = @property_ID)" 
            DeleteCommand="DELETE FROM [tbl_property_transport_options] WHERE [transportOptionID] = @transportOptionID" 
            InsertCommand="INSERT INTO [tbl_property_transport_options] ([property_ID], [option_ID], [description]) VALUES (@property_ID, @option_ID, @description)" 
            UpdateCommand="UPDATE [tbl_property_transport_options] SET [property_ID] = @property_ID, [option_ID] = @option_ID, [description] = @description WHERE [transportOptionID] = @transportOptionID">
            <DeleteParameters>
                <asp:Parameter Name="transportOptionID" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="property_ID" Type="Int32" />
                <asp:Parameter Name="option_ID" Type="Int32" />
                <asp:Parameter Name="description" Type="String" />
            </InsertParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="RadGrid1" Name="property_ID" 
                    PropertyName="SelectedValue" Type="Int32" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="property_ID" Type="Int32" />
                <asp:Parameter Name="option_ID" Type="Int32" />
                <asp:Parameter Name="description" Type="String" />
                <asp:Parameter Name="transportOptionID" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
  
      
    </div>
  
    <asp:SqlDataSource ID="SqlDataSourceGallery" runat="server" 
        ConnectionString="<%$ ConnectionStrings:proprovsConnectionString %>" 
        SelectCommand="SELECT * FROM [gallery] WHERE ([PropertyId] = @PropertyId)" 
        DeleteCommand="DELETE FROM [gallery] WHERE [GalleryImageID] = @GalleryImageID" 
        InsertCommand="INSERT INTO [gallery] ([PropertyId], [Filename], [Width], [Height], [Size]) VALUES (@PropertyId, @Filename, @Width, @Height, @Size)" 
        UpdateCommand="UPDATE [gallery] SET [PropertyId] = @PropertyId, [Filename] = @Filename, [Width] = @Width, [Height] = @Height, [Size] = @Size WHERE [GalleryImageID] = @GalleryImageID">
        <DeleteParameters>
            <asp:Parameter Name="GalleryImageID" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="PropertyId" Type="Int32" />
             <asp:SessionParameter Name="Filename" SessionField="DataCS" Type="String" />
            <asp:Parameter Name="Width" Type="Int32" />
            <asp:Parameter Name="Height" Type="Int32" />
            <asp:Parameter Name="Size" Type="Int32" />
        </InsertParameters>
        <SelectParameters>
            <asp:ControlParameter ControlID="RadGrid1" Name="PropertyId" 
                PropertyName="SelectedValue" Type="Int32" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="PropertyId" Type="Int32" />
            <asp:SessionParameter Name="Filename" SessionField="DataCS" Type="String" />
            <asp:Parameter Name="Width" Type="Int32" />
            <asp:Parameter Name="Height" Type="Int32" />
            <asp:Parameter Name="Size" Type="Int32" />
            <asp:Parameter Name="GalleryImageID" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
  
    </form>
    </body>
</html>
CS Code

using System;
using System.IO;
using System.Data;
using System.Collections;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using Telerik.Web.UI;
public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
  
  
  
    }
  
    protected void RadGrid1_SelectedIndexChanged(object sender, EventArgs e)
    {
        //Display te primary key value of the selected row.
        Label1.Text = "The primary key value of the selected row is " +
            RadGrid1.SelectedValue.ToString() + ".";
    }
  
  
  
    
  
  
  
    protected void RadGrid1_UpdateCommand(object source, GridCommandEventArgs e)
    {
        InitializeUpdateParameter((RadUpload)e.Item.FindControl("RadUpload1"));
  
        RadUpload upload = e.Item.FindControl("RadUpload2") as RadUpload;
        string foldername = (e.Item.FindControl("LblFolder") as Label).Text;
         InitializeUpdateParameterGallery(upload, foldername);
  
  
    }
  
    protected void RadGrid1_InsertCommand(object source, GridCommandEventArgs e)
    {
  
        InitializeUpdateParameter((RadUpload)e.Item.FindControl("RadUpload1"));
          
          
        RadUpload upload = e.Item.FindControl("RadUpload2") as RadUpload;
  
        GridEditableItem editedItem = e.Item as GridEditableItem;
  
  
        string foldername = "";
      
        InitializeUpdateParameterGallery(upload, foldername);
          
      
          
    }
  
  
  
  
    private void InitializeUpdateParameterGallery(RadUpload currentUpload, string foldername)
    {
        if (currentUpload != null && currentUpload.UploadedFiles.Count > 0)
        {
            byte[] data = new byte[currentUpload.UploadedFiles[0].ContentLength];
            currentUpload.UploadedFiles[0].InputStream.Read(data, 0, data.Length);
            Session["DataCS"] = currentUpload.UploadedFiles[0].GetName();
  
              
  
            string target = Server.MapPath("~/media/gallery/" + foldername + "/" );
            System.Drawing.Image.GetThumbnailImageAbort thumbnailImageAbortDelegate = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
  
             
  
            UploadedFile file = currentUpload.UploadedFiles[0];
  
            using (Bitmap originalImage = new Bitmap(file.InputStream))
            {
                decimal newWidth, newHeight;
  
                newWidth = 411;
                newHeight = 0; // Will get calculated
  
                scaleImage(originalImage.Width, originalImage.Height, ref newWidth, ref newHeight);
  
                using (System.Drawing.Image thumbnail = originalImage.GetThumbnailImage(Convert.ToInt32(newWidth), Convert.ToInt32(newHeight), thumbnailImageAbortDelegate, IntPtr.Zero))
                {
                    string thumbnailFileName = Path.Combine(target, string.Format("{0}{1}", file.GetNameWithoutExtension(), file.GetExtension()));
                      
                    thumbnail.Save(thumbnailFileName);
  
                }
            }
        }
    }
      
      
      
      
    private void InitializeUpdateParameter(RadUpload currentUpload)
    {
        if (currentUpload != null && currentUpload.UploadedFiles.Count > 0)
        {
            byte[] data = new byte[currentUpload.UploadedFiles[0].ContentLength];
            currentUpload.UploadedFiles[0].InputStream.Read(data, 0, data.Length);
            Session["DataCS"] = currentUpload.UploadedFiles[0].GetName();
  
            string target = Server.MapPath("~/media/thumbnails");
            System.Drawing.Image.GetThumbnailImageAbort thumbnailImageAbortDelegate = new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
              
            UploadedFile file = currentUpload.UploadedFiles[0];
  
            using (Bitmap originalImage = new Bitmap(file.InputStream))
            {
                decimal newWidth, newHeight;
  
                newWidth = 125;
                newHeight = 0; // Will get calculated
  
                scaleImage(originalImage.Width, originalImage.Height, ref newWidth, ref newHeight);
  
                using (System.Drawing.Image thumbnail = originalImage.GetThumbnailImage(Convert.ToInt32(newWidth), Convert.ToInt32(newHeight), thumbnailImageAbortDelegate, IntPtr.Zero))
                {
                    string thumbnailFileName = Path.Combine(target, string.Format("{0}_thumb{1}", file.GetNameWithoutExtension(), file.GetExtension()));
                    thumbnail.Save(thumbnailFileName);
                }
            }
        }
    }
  
    public bool ThumbnailCallback()
    {
        return false;
    }
  
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
      
        if(RadGrid1.SelectedItems.Count != 0) {
            Response.Write(RadGrid1.SelectedItems[0].OwnerTableView.DataKeyValues[RadGrid1.SelectedItems[0].ItemIndex]["Property_ID"]);
        }
      
        if (e.Item is GridEditableItem && e.Item.IsInEditMode)
        {
  
            RadUpload upload = (RadUpload)e.Item.FindControl("RadUpload1");
              
            if(upload != null) {
                RadAjaxPanel1.ResponseScripts.Add(string.Format("window['UploadId'] = '{0}';", upload.ClientID));
            }
  
            upload = (RadUpload)e.Item.FindControl("RadUpload2");
  
            if (upload != null)
            {
                RadAjaxPanel1.ResponseScripts.Add(string.Format("window['UploadId'] = '{0}';", upload.ClientID));
                 
            }
        }
    }
  
    #region GetTelerikGridSelections
    public ArrayList GetTelerikGridSelections(Telerik.Web.UI.RadGrid grid)
    {
        ArrayList selectedItems = new ArrayList();
        if (grid.MasterTableView.DataKeyNames.Length > 0)
        {
            string key = grid.MasterTableView.DataKeyNames[0];
            for (int i = 0; i < grid.SelectedItems.Count; i++)
            {
                selectedItems.Add(grid.MasterTableView.DataKeyValues[grid.SelectedItems[i].ItemIndex][key]);
            }
        }
        return selectedItems;
    }
    #endregion 
  
    public void scaleImage(decimal currentWidth, decimal currentHeight, ref decimal newWidth, ref decimal newHeight)
    {
  
        // Supply either newWidth or newHeight, not both  
  
        decimal height = 0;
        decimal ratio = 0;
  
        if (newWidth == 0)
        { // Scale based on new height
  
            ratio = currentWidth / currentHeight;
            newWidth = newHeight * ratio;
  
        }
        else
        { // Scale based on new width
  
            ratio = currentHeight / currentWidth;
            newHeight = newWidth * ratio;
  
        }
  
    }
  
  
     
}
Genti
Telerik team
 answered on 24 Jun 2011
1 answer
92 views
Hi, 

Just wondering if there is a way to disable the Drag in-between functionality for a paticular node in the TreeView.

I can stop dragging over by setting the nodes AllowDrop property to false but if EnableDragAndDropBetweenNodes is turned on then it can still be dragged under the node - this setting appears to be global and not settable per node.

So is there a way to do it? Or do I need to catch this in the OnNodeDrop method? This is not an ideal way to do it as it would appear to the user as if they could do it because it wouldn't have the "no drop" icon.    

Thanks in advance
Kev
Princy
Top achievements
Rank 2
 answered on 24 Jun 2011
1 answer
83 views
Hi,
Currently i use  tab.ImageUrl property to set the image. Is it possible to add more than one image to the tab?

Thanks,
Mani
Princy
Top achievements
Rank 2
 answered on 24 Jun 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?