Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
93 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
288 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
280 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
106 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
68 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
66 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
1 answer
160 views
Hello there.

I am trying to get separate client validation messages for AsyncUpload depending upon whether it was a fail due to filesize or extention type.

At the moment i can only get a generic message using :

 function validationFailed(sender, eventArgs) {
              
            //var RadProgressArea1 = $('#<%= RadProgressArea1.ClientID %>');
//             $.each(sender, function(i, n) {
//                            alert("Name: " + i + ", Value: " + n);
//                        });    
            $("#errorHolder").append("<p>Validation failed for '" + eventArgs.get_fileName() + "'.</p>").fadeIn("slow");
        }

I want seperate messages for those two cases.

i have also tried to not specify maxfilesize in asyncupload and catch filesize error in 

function ClientProgressUpdating(sender, args)  {
           
           if(args.get_data().fileSize > 3145728)
           {                          
                sender.deleteFileInputAt(0);
                  $("#errorHolder").append("<p>file size if more than max for '" + eventArgs.get_fileName() + "'.</p>").fadeIn("slow");
//                if(confirm("Are you sure"))
//                {
//                   //validationFailed(sender, args);
//                   return false;
//                     $("#errorHolder").append("<p>Validation failed for '" + eventArgs.get_fileName() + "'.</p>").fadeIn("slow");
//                }
               
           }
//            
        }

it stops the fileupload but hangs at the screen where the progress bar is not moving forward and doesnt set the error message label

Thank you for helping.
Peter Filipov
Telerik team
 answered on 24 Jun 2011
3 answers
315 views
Hello,

I've been struggling with this problem for many hours now.  Basically I'm interested in finding out how to have resizable detail table columns which don't mess up the grid size and scrolling when you resize them.

I've attached a small demo that shows the problem.  If you expand a detail record and then resize a column in it, the grid basically loses scrolling and resizes itself.  I have not enabled resize grid on column resize.

Help would be very much appreciated!  If there is a demo out there somewhere that shows resizable columns in a hierarchy that would be helpful as well.  I cannot find any demo on the Telerik site which shows hierarchy and resizable columns at the same time!

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <Scripts>
            <%--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:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" CellSpacing="0"
        GridLines="None" OnDetailTableDataBind="RadGrid1_DetailTableDataBind" OnNeedDataSource="RadGrid1_NeedDataSource"
        Skin="Vista" Width="800px">
        <ClientSettings>
            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
            <Resizing AllowColumnResize="True" />
        </ClientSettings>
        <MasterTableView>
            <DetailTables>
                <telerik:GridTableView runat="server">
                    <CommandItemSettings ExportToPdfText="Export to PDF" />
                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                        <HeaderStyle Width="20px" />
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                        <HeaderStyle Width="20px" />
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridBoundColumn FilterControlAltText="Filter column column" HeaderText="DetailCol0"
                            UniqueName="column">
                            <HeaderStyle Width="300px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn FilterControlAltText="Filter column1 column" HeaderText="DetailCol1"
                            UniqueName="column1">
                            <HeaderStyle Width="300px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn FilterControlAltText="Filter column2 column" HeaderText="DetailCol2"
                            UniqueName="column2">
                            <HeaderStyle Width="300px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn FilterControlAltText="Filter column3 column" HeaderText="DetailCol3"
                            UniqueName="column3">
                            <HeaderStyle Width="300px" />
                        </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">
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn FilterControlAltText="Filter column column" HeaderText="MasterCol0"
                    UniqueName="column">
                    <HeaderStyle Width="300px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn FilterControlAltText="Filter column1 column" HeaderText="MasterCol1"
                    UniqueName="column1">
                    <HeaderStyle Width="300px" />
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn FilterControlAltText="Filter column2 column" HeaderText="MasterCol2"
                    UniqueName="column2">
                    <HeaderStyle Width="300px" />
                </telerik:GridBoundColumn>
            </Columns>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
            </EditFormSettings>
        </MasterTableView>
        <FilterMenu EnableImageSprites="False">
        </FilterMenu>
        <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
        </HeaderContextMenu>
    </telerik:RadGrid>
    </form>
</body>
</html>

public partial class Default : System.Web.UI.Page
{
    protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        List<string> theList = new List<string> { "a", "b", "c" };
        RadGrid1.DataSource = theList;
    }
 
    protected void RadGrid1_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e)
    {
        List<string> theList2 = new List<string> { "d", "e", "f" };
        e.DetailTableView.DataSource = theList2;
    }
}
Niall
Top achievements
Rank 1
 answered on 24 Jun 2011
1 answer
128 views
I'm using the RadAsyncUpload on a webform that have several components to perform certain operations. Initially, when I load the file, the FileUploaded is fired on the first postback as expected, and the file is copied to the intended directory in the server. This is my code for this part:

protected void AsyncUpload1_FileUploaded(object sender, Telerik.Web.UI.FileUploadedEventArgs e)
        {
            using (Stream stream = e.File.InputStream)
            {
                bool fileSaved = false;
                Random objRand = new Random();
                while (!fileSaved)
                {
                    string strUploadFileName = "~/tmp/" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";
 
                    if (!File.Exists(Server.MapPath(strUploadFileName)))
                    {
                        byte[] xlsData = new byte[stream.Length];
                        stream.Read(xlsData, 0, (int)stream.Length);
 
                        FileStream fs = new FileStream(Server.MapPath(strUploadFileName), FileMode.Create, FileAccess.ReadWrite);
                        BinaryWriter bw = new BinaryWriter(fs);
                        bw.Write(xlsData);
                        bw.Close();
 
                        ViewState["currXLFile"] = Server.MapPath(strUploadFileName);
                        //read contents now...
                        LoadData();
 
                        fileSaved = true;
                    }               
                 
                }              
                 
            }
        }


The problem is that there are other components that fire the postback event on the same page after the file upload, which fires over and over again the FileUploaded event, with the big problem that after the second time it postbacks it generates an exception at this line:

using (Stream stream = e.File.InputStream)

Which has sense since the file was copied already on the first postback, so the InputStream is not usable anymore. Can you recommend me a way to make sure that this line is excuted only when a file was actually uploaded and not on every single postback event? hopefully something more elegant of what I did for now: just putting a try-catch block and ignoring the error.

Thanks,
Peter Filipov
Telerik team
 answered on 24 Jun 2011
6 answers
187 views
Hi all
I am developing an ASP.NET MVC application. I have radScheduler in one page connected to a web service which pulls appoinments from the database. There are different appoinment types and there is one appoinment which can be moved across time slots. I need to show that appoinment in the scheduler when the page is loaded(initially and dynamically with other client side events). In order to do that I need to set "TimelineView-StartTime" property. It is a serverside property and I cannot find the corresponding JavaScript property. Since this is an MVC application I cannot set the property within server side tags. Could you please tell me how to set this "TimelineView-StartTime" property in ASP.NET MVC application dynamically? I cannot find the corresponding JavaScript property.
Thanks in advance
Kushil
Veronica
Telerik team
 answered on 24 Jun 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?