Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
244 views

.aspx page

<telerik:RadClientDataSource runat="server" ID="RadClientDataSource1">
        <DataSource>
            <WebServiceDataSourceSettings ServiceType="OData">
                <Select Url="Products" DataType="JSON" />
            </WebServiceDataSourceSettings>
        </DataSource>
        <Schema DataName="d.results">
        </Schema>
    </telerik:RadClientDataSource>

    <div >
        <telerik:RadComboBox ID="RadComboBox1" runat="server" ClientDataSourceID="RadClientDataSource1"
            EnableLoadOnDemand="true" DataTextField="ProductName" DataValueField="ProducasdtID"
            ShowMoreResultsBox="true" ItemsPerRequest="10" EnableVirtualScrolling="true" Width="300px">
        </telerik:RadComboBox>
    </div>

.cs Page

 protected void Page_Load(object sender, EventArgs e)
        {
            RadClientDataSource1.DataSource.WebServiceDataSourceSettings.BaseUrl = ResolveUrl("http://demos.telerik.com/aspnet-ajax/combobox/examples/populatingwithdata/client-side-data-binding/Services/NorthwindWcfService.svc/");
        }

 

how to bind this in page base event instated of webserviceDatasourcesetting but in my another application i am use this code

<telerik:RadComboBox ID="cbCommodity" Height="100px" Width="200px" 
                                    runat="server" ItemsPerRequest="10" ShowMoreResultsBox="true" EnableVirtualScrolling="true"
                                    EnableAutomaticLoadOnDemand="true" AccessKey="T" MarkFirstMatch="true" EmptyMessage="Select"
                                    HighlightTemplatedItems="true">
                                    <HeaderTemplate>
                                        <ul>
                                            <li class="col1">HS Code</li>
                                            <li class="col2">Description</li>
                                        </ul>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <ul>
                                            <li class="col1">
                                                <%# DataBinder.Eval(Container.DataItem, "HSCode")%></li>
                                            <li class="col2">
                                                <%# DataBinder.Eval(Container.DataItem, "Description")%></li>
                                        </ul>
                                    </ItemTemplate>
                                </telerik:RadComboBox>

 

Can i do databind at client side using page base method please give me any demo

Hristo Valyavicharski
Telerik team
 answered on 12 May 2015
9 answers
328 views
Hi,

I implemented a custom gantt provider just like in the code library for a custom gantt provider. This worked perfectly well. But when I try to set the end date of a child task after the end date of the parent task, the update of the tasks do work but the task aren't shown any more inside the gantt control. I do have the same problem if I try to delete or to add the child task of my root element -> No tasks are shown inside the gantt control anymore.

My second problem is that I want to set a information message inside a label if inserting, updating or deleting of a task is successful or not. But the text of the label doesn't change wether I place the label inside the same radajaxpanel or place it outside of the radajaxpanel which contains the gantt control because changing the tasks does not trigger a full postback. Can someone help me with my problems? Thanks.

Regards,
Michael
Felix
Top achievements
Rank 1
 answered on 12 May 2015
1 answer
57 views

Hello everyone,

 

I have a project with a radgrid and checklist filtering. I need the selected values to be stored aswell as loaded after a refresh of the page.

The page is refreshed automatically via JQuery after 30 seconds.

 

Thanks for your help.

Angel Petrov
Telerik team
 answered on 12 May 2015
1 answer
348 views

My ASP.NET site coded in C# is running fine on my local system but when I uploaded the files on the httpdocs folder through Plesk control panel. I have a shared accounts at http://hostforlife.eu/ and I got the following error:

Server Error in '/' Application.
________________________________________
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.Compiler Error Message: CS0246: The type or namespace name 'Xyz' could not be found (are you missing a using directive or an assembly reference?)Source Error:Line 1: <%@ Application Language="C#" %>
Line 2: <%@ Import Namespace="mydomain" %>
Line 3: <%@ Import Namespace="System.Web.Optimization" %>
Line 4: <%@ Import Namespace="System.Web.Routing" %>Source File: g:\PleskVhosts\mydomain.com\httpdocs\Xyz\Global.asax Line: 2Show Detailed Compiler Output:C:\Windows\SysWOW64\inetsrv> "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" /t:library /utf8output /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Deployment\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.Deployment.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Services\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Extensions\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Extensions.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.WorkflowServices\v4.0_4.0.0.0__31bf3856ad364e35\System.WorkflowServices.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Web\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.DynamicData\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.DynamicData.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.Activities.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.ApplicationServices\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.ApplicationServices.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.IdentityModel\v4.0_4.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.DataSetExtensions\v4.0_4.0.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activation\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activation.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ComponentModel.DataAnnotations\v4.0_4.0.0.0__31bf3856ad364e35\System.ComponentModel.DataAnnotations.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activities.dll" /out:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\ba70df64\8ad7fdd9\App_global.asax.8gpjfmvi.dll" /debug- /optimize+ /w:4 /nowarn:1659;1699;1701;612;618 /warnaserror- "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\ba70df64\8ad7fdd9\App_global.asax.8gpjfmvi.0.cs" "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\ba70df64\8ad7fdd9\App_global.asax.8gpjfmvi.1.cs"Microsoft (R) Visual C# Compiler version 4.0.30319.17929for Microsoft (R) .NET Framework 4.5
Copyright (C) Microsoft Corporation. All rights reserved.g:\PleskVhosts\mydomain.com\httpdocs\Xyz\Global.asax(2,11): error CS0246: The type or namespace name 'Xyz' could not be found (are you missing a using directive or an assembly reference?)
g:\PleskVhosts\mydomain.com\httpdocs\Xyz\Global.asax(3,22): error CS0234: The type or namespace name 'Optimization' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
g:\PleskVhosts\mydomain.com\httpdocs\Xyz\Web.config(24,21): error CS0234: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)________________________________________
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18056

David
Top achievements
Rank 1
Iron
Veteran
Iron
 answered on 11 May 2015
7 answers
530 views

I'm updating an application from  the Classic controls to the newest version. Some of the scripts are working correctly. I need to set the border and background of a RadCombobox to Red to signify its a required field. I used to do the following:

 RadAjaxPanelContacts.ResponseScripts.Add("LoadCombobox(" & rcbContactTxt.ClientID & ");")

 function LoadCombobox(combobox)
{
combobox.InputDomElement.style.border = "solid 1px #a80532";
combobox.InputDomElement.style.color = "#a80532";
combobox.InputDomElement.style.background = "white";
}

 

This now triggers a javascript error type error element undefined. I tried replacing with:

 

function LoadCombobox(combobox)
{
    combobox.element.style.border = "solid 1px #ff0000";
    combobox.element.style.color = "#ff0000";
    combobox.element.style.background = "white";
}

 

 Doesn't work either. How do I do what the old code does with the newer version of the controls?

Magdalena
Telerik team
 answered on 11 May 2015
3 answers
60 views

Which is prefered and recommended way to create custom skins?

I know that i can create skin with Visual Style Builder and compile it with acTelerikStylesAssembly to DLL library, which i can attache to SkinManager etc.

I know that i can copy files from C:\Program Files (x86)\Telerik\UI for ASP.NET AJAX Q1 2015\Skins, rename it with acTelerikStylesRenaming or manual and place them in App_Themes folder etc.

But...

In C:\Program Files (x86)\Telerik\UI for ASP.NET AJAX Q1 2015\Skins subfolders i have more folders and files than in skin *.zip file downloaded from VisualStyleBuilder. Why? If i create two skins by two different ways, my application will be working in the same way and looks great with both skins?

I must create four skins for my application (light and dark for normal users and two high contrast for users with some dysfunction), and this will be hard work for me, that i must know how to make it with minimal effort.

P.S. Sorry for my bad English.

Magdalena
Telerik team
 answered on 11 May 2015
1 answer
115 views

I am trying to save multiple files to my database, and for whatever reason, it is not doing so. Any help will be greatly appreciated.

 ASP:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CAF_Detail.aspx.cs" Inherits="DetailViews_CAF_Detail" MasterPageFile="~/EUEMain.master" %>
 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphLeftNav" runat="Server">
    <asp:HyperLink ID="HomeLink" runat="server" NavigateUrl="..\Default.aspx" Text="Home" />
</asp:Content>
 
<asp:Content ID="Content2" ContentPlaceHolderID="cphContent" runat="Server">
    <h1>CAF Tracking System</h1>
     
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
     
    <h7>Please make sure to leave your initials at the end of any comments you make.</h7>
    <h5> </h5>
    <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">
        <script type="text/javascript">
            var manager;
            Sys.Application.add_load(function () {
                manager = $find('<%= RadAjaxManager.GetCurrent(Page).ClientID %>');
            });
        </script>
    </telerik:RadCodeBlock>
    <script type="text/javascript" src="../DetailViews/Scripts.js"></script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid2" LoadingPanelID="RadAjaxLoadingPanel1"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </telerik:RadAjaxLoadingPanel>
    <div>
        <telerik:RadGrid ID="RadGrid2" DataSourceID="SqlDataSource1" AllowPaging="False" Width="100%"
            runat="server" AutoGenerateColumns="False" AllowSorting="True"
            AllowAutomaticInserts="true" AllowAutomaticUpdates="true" OnItemDataBound="RadGrid2_ItemDataBound" OnItemCommand="RadGrid2_ItemCommand" OnUpdateCommand="RadGrid2_OnUpdateCommand" >
 
            <MasterTableView DataKeyNames="Unique, ChangeLog" AutoGenerateColumns="False" CommandItemDisplay="Top" DataSourceID="SqlDataSource1" EditMode="EditForms">
                <NestedViewTemplate>
                    <asp:Panel runat="server" ID="InnerContainer" Visible="False"></asp:Panel>
                    <telerik:RadMultiPage runat="server" ID="Multipage1" SelectedIndex="0" RenderSelectedPageOnly="False">
 
                        <telerik:RadPageView runat="server" ID="Details">
                            <asp:Label ID="Label1" Font-Bold="true" Font-Italic="true" Text='<%# Bind("Unique") %>'
                                Visible="False" runat="server"></asp:Label>
                            <telerik:RadGrid runat="server" ID="SubNotesGrid" DataSourceID="SqlDataSource3" ShowFooter="true"
                                AllowSorting="true" EnableLinqExpressions="false">
                                <MasterTableView ShowHeader="true" AutoGenerateColumns="False" AllowPaging="true"
                                    DataKeyNames="Unique, Changelog" PageSize="25" HierarchyLoadMode="Client">
 
                                    <Columns>
                                        <telerik:GridBoundColumn UniqueName="CAF_Number" DataField="CAF_Number" HeaderText="CAF Number" AllowFiltering="false" />
                                        <telerik:GridBoundColumn UniqueName="CAF_Rev" DataField="CAF_Rev" HeaderText="Revision" />
                                        <telerik:GridBoundColumn UniqueName="CAF_Approved" DataField="CAF_Approved" HeaderText="Approved" />
                                        <telerik:GridBoundColumn UniqueName="CAF_System" DataField="CAF_System" HeaderText="CAF System" />
                                        <telerik:GridBoundColumn UniqueName="CAF_Build" DataField="CAF_Build" HeaderText="Build" />
                                        <telerik:GridBoundColumn UniqueName="CAF_BNSF" DataField="CAF_BNSF" HeaderText="Affecting BNSF" />
                                        <telerik:GridBoundColumn UniqueName="CAF_Desc" DataField="CAF_Desc" HeaderText="CAF Description" AllowFiltering="False" />
                                        <telerik:GridBoundColumn UniqueName="CAF_Post_Date" DataField="CAF_Post_Date" HeaderText="Post Date" DataFormatString="{0:MM/dd/yyyy}" />
                                        <telerik:GridBoundColumn UniqueName="CAF_Due_Date" DataField="CAF_Due_Date" HeaderText="Due Date" DataFormatString="{0:MM/dd/yyyy}" />
                                        <telerik:GridBoundColumn UniqueName="Target_Date" DataField="Target_Date" HeaderText="Target Review Date" DataFormatString="{0:MM/dd/yyyy}" />
                                        <telerik:GridBoundColumn UniqueName="Comments" DataField="Comments" HeaderText="Comments" />
                                        <telerik:GridBoundColumn UniqueName="ChangeLog" DataField="ChangeLog" HeaderText="ChangeLog" />
 
                                    </Columns>
                                </MasterTableView>
                            </telerik:RadGrid>
                            <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings: PtcDbModelEntities %>"
                                SelectCommand="SELECT * FROM [PtcDbTracker].[dbo].[CAFTable] as t0
                                Inner join [PtcDbTracker].[dbo].[CafFileTable] as t1 on t0.[Unique] = t1.[Unique1] where t0.[Unique] = @Unique">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="Label1" Name="Unique" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                        </telerik:RadPageView>
                    </telerik:RadMultiPage>
                </NestedViewTemplate>
 
                <Columns>
                    <telerik:GridEditCommandColumn />
                    <telerik:GridBoundColumn UniqueName="CAF_Number" DataField="CAF_Number" HeaderText="CAF Number" AllowFiltering="false" />
 
                    <telerik:GridTemplateColumn UniqueName="CAF_Desc" DataField="CAF_Desc" HeaderText="Description" AllowFiltering="False">
                        <ItemTemplate>
                            <asp:Label runat="server" ID="caf_desc" Text='<%# Bind("CAF_Desc") %>' Width="350px"></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox runat="server" ID="CAF_Desc_TextBox" Width="300px" Height="75px" Text='<%# Bind("CAF_Desc") %>' Wrap="True" TextMode="MultiLine"></asp:TextBox>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
 
                    <telerik:GridTemplateColumn UniqueName="CAF_System" Visible="False" HeaderText="System">
                        <EditItemTemplate>
                            <asp:DropDownList ID="Label6" runat="server" SelectedValue='<%# Bind("CAF_System") %>'
                                DataSource='<%# (new[] { "OB", "BOS", "EM"}) %>'
                                AppendDataBoundItems="True"
                                CausesValidation="False">
                                <asp:ListItem Selected="True" Text="Select" Value="">
                                </asp:ListItem>
                            </asp:DropDownList>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn UniqueName="CAF_Rev" DataField="CAF_Rev" HeaderText="Revision" Visible="True" />
                    <telerik:GridTemplateColumn UniqueName="Comments" DataField="Comments" HeaderText="Comments" AllowFiltering="False" Visible="False">
                        <EditItemTemplate>
                            <asp:TextBox runat="server" ID="Comments_TextBox" Width="400px" Height="150px" Text='<%# Bind("Comments") %>' Wrap="True" TextMode="MultiLine"></asp:TextBox>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridDateTimeColumn UniqueName="CAF_Post_Date" DataField="CAF_Post_Date" PickerType="DatePicker" HeaderText="Post Date" Visible="False" />
                    <telerik:GridDateTimeColumn UniqueName="CAF_Due_Date" DataField="CAF_Due_Date" PickerType="DatePicker" Visible="False" HeaderText="Due Date" />
                    <telerik:GridDateTimeColumn UniqueName="Target_Date" DataField="Target_Date" PickerType="DatePicker" Visible="True" HeaderText="Target Review Date" />
 
                    <telerik:GridBoundColumn UniqueName="CAF_Build" DataField="CAF_Build" Visible="False" HeaderText="Build" />
                    <telerik:GridTemplateColumn UniqueName="CAF_BNSF" Visible="True" HeaderText="Affecting BNSF">
                        <EditItemTemplate>
                            <asp:DropDownList ID="Label5" runat="server" SelectedValue='<%# Bind("CAF_BNSF") %>'
                                DataSource='<%# (new[] { "None", "Low", "Medium", "High"}) %>'
                                AppendDataBoundItems="True"
                                CausesValidation="False">
                                <asp:ListItem Selected="True" Text="Select" Value="">
                                </asp:ListItem>
                            </asp:DropDownList>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn UniqueName="CAF_Approved" DataField="CAF_Approved" Visible="True" HeaderText="Approved">
                        <ItemTemplate>
                            <asp:Label runat="server" ID="caf_approved" Text='<%#Bind("CAF_Approved") %>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:DropDownList ID="Label12" runat="server" SelectedValue='<%# Bind("CAF_Approved") %>'
                                DataSource='<%# (new[] { "Approved", "Not Approved"}) %>'
                                AppendDataBoundItems="True"
                                CausesValidation="False">
                                <asp:ListItem Selected="True" Text="Select" Value="">
                                </asp:ListItem>
                            </asp:DropDownList>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
 
                    <telerik:GridAttachmentColumn SortExpression="FileName" UploadControlType="RadAsyncUpload" DataSourceID="SqlDataSource5"
                        EditFormHeaderTextFormat="Upload File:" HeaderText="Attachment Column" AttachmentDataField="BinaryData"
                        AttachmentKeyFields="Unique" FileNameTextField="FileName" DataTextField="FileName"
                        UniqueName="AttachmentColumn" />
                    
 
                    <telerik:GridBoundColumn UniqueName="ChangeLog" DataField="ChangeLog" HeaderText="ChangeLog" ReadOnly="True" Visible="True" />
                     
 
<%--                    <telerik:GridAttachmentColumn SortExpression="FileName2" UploadControlType="RadAsyncUpload" DataSourceID="SqlDataSource6"
                        EditFormHeaderTextFormat="Upload File:" HeaderText="Additional Attachment" AttachmentDataField="BinaryData2"
                        AttachmentKeyFields="Unique" FileNameTextField="FileName2" DataTextField="FileName2"
                        UniqueName="AttachmentColumn2" />--%>
                     
 
                </Columns>
            </MasterTableView>
            <ClientSettings>
                <ClientEvents OnCommand="gridCommand"></ClientEvents>
            </ClientSettings>
        </telerik:RadGrid>
        <br />
    </div>
 <%--OnInserted="SqlDataSource2_Inserted"
        OnUpdated="SqlDataSource2_Updated"--%>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings: PtcDbModelEntities %>"
        
        InsertCommand="INSERT INTO [PtcDbTracker].[dbo].[CAFTable] ([CAF_Number], [CAF_System], [CAF_Rev], [CAF_Build], [CAF_BNSF], [CAF_Desc], [Comments]
        , [CAF_Post_Date], [CAF_Due_Date], [Target_Date], [CAF_Approved])
        VALUES (@CAF_Number, @CAF_System, @CAF_Rev, @CAF_Build, @CAF_BNSF, @CAF_Desc, @Comments, @CAF_Post_Date, @CAF_Due_Date, @Target_Date, @CAF_Approved) SET @InsertedID = SCOPE_IDENTITY()"
        SelectCommand="SELECT * FROM [PtcDbTracker].[dbo].[CAFTable] as t0
                                Inner join [PtcDbTracker].[dbo].[CafFileTable] as t1 on t0.[Unique] = t1.Unique1 Order By [CAF_Number] DESC, [CAF_Rev] DESC"
        UpdateCommand="UPDATE [PtcDbTracker].[dbo].[CAFTable]
      SET [CAF_Number] = @CAF_Number
        , [CAF_System] = @CAF_System
        , [CAF_Rev] = @CAF_Rev
        , [CAF_Build] = @CAF_Build
        , [CAF_BNSF] = @CAF_BNSF
        , [CAF_Desc] = @CAF_Desc
        , [Comments] = @Comments
        , [CAF_Due_Date] = @CAF_Due_Date
        , [CAF_Post_Date] = @CAF_Post_Date
        , [CAF_Approved] = @CAF_Approved
        WHERE [Unique] = @Unique">
        <DeleteParameters>
            <asp:Parameter Name="Unique" Type="Int32"></asp:Parameter>
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="CAF_Number" Type="String"></asp:Parameter>
            <asp:Parameter Name="CAF_System" Type="String"></asp:Parameter>
            <asp:Parameter Name="CAF_Rev" Type="String"></asp:Parameter>
            <asp:Parameter Name="CAF_Build" Type="String"></asp:Parameter>
            <asp:Parameter Name="CAF_BNSF" Type="String"></asp:Parameter>
            <asp:Parameter Name="CAF_DESC" Type="String"></asp:Parameter>
            <asp:Parameter Name="Comments" Type="String"></asp:Parameter>
            <asp:Parameter Name="CAF_Post_Date" DbType="Date"></asp:Parameter>
            <asp:Parameter Name="CAF_Due_Date" DbType="Date"></asp:Parameter>
            <asp:Parameter Name="Target_Date" DbType="Date"></asp:Parameter>
            <asp:Parameter Name="CAF_Approved" Type="String" />
           <asp:Parameter Name="ChangeLog" Type="String" />
            <asp:Parameter Name="InsertedID" Type="Int32" Direction="Output"></asp:Parameter>
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="CAF_Number" Type="String"></asp:Parameter>
            <asp:Parameter Name="CAF_System" Type="String"></asp:Parameter>
            <asp:Parameter Name="CAF_Rev" Type="String"></asp:Parameter>
            <asp:Parameter Name="CAF_Build" Type="String"></asp:Parameter>
            <asp:Parameter Name="CAF_BNSF" Type="String"></asp:Parameter>
            <asp:Parameter Name="CAF_DESC" Type="String"></asp:Parameter>
            <asp:Parameter Name="Comments" Type="String"></asp:Parameter>
            <asp:Parameter Name="CAF_Post_Date" DbType="Date"></asp:Parameter>
            <asp:Parameter Name="CAF_Due_Date" DbType="Date"></asp:Parameter>
            <asp:Parameter Name="Target_Date" DbType="Date"></asp:Parameter>
            <asp:Parameter Name="CAF_Approved" Type="String" />
            <asp:Parameter Name="ChangeLog" Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource5" runat="server" ConnectionString="<%$ ConnectionStrings:PtcDbModelEntities %>"
        SelectCommand="SELECT t1.[Unique1], t1.[BinaryData] FROM [PtcDbTracker].[dbo].[CAFTable] as t0
                                Inner join [PtcDbTracker].[dbo].[CafFileTable] as t1 on t0.[Unique] = t1.Unique1 WHERE t1.[Unique1] = @Unique">
        <SelectParameters>
            <asp:Parameter Name="Unique" Type="Int32"></asp:Parameter>
        </SelectParameters>
    </asp:SqlDataSource>
     
</asp:Content>

 

And C#:

 

using System.Collections;
using System.Runtime.InteropServices;
using System.Text;
using Telerik.Web.UI;
using System;
using xi = Telerik.Web.UI.ExportInfrastructure;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;
using System.IO;
using MultipleFileSelection = Telerik.Web.UI.AsyncUpload.MultipleFileSelection;
 
public partial class DetailViews_CAF_Detail : BNSF.EUECommonApplication.EUEBasePage
{
    int fileId;
    byte[] fileData;
    string fileName;
    string mystring1;
    private string oldChangeLogValue;
     
 
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
        }
    }
    protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
    {
        var editItem = e.Item as GridEditFormItem;
        if (editItem != null && editItem.IsInEditMode)
        {
            var datePicker = editItem["CAF_Post_Date"].Controls[0] as RadDatePicker;
            datePicker.Width = Unit.Pixel(100);
            var datePicker2 = editItem["CAF_Due_Date"].Controls[0] as RadDatePicker;
            datePicker2.Width = Unit.Pixel(100);
            var datePicker3 = editItem["Target_Date"].Controls[0] as RadDatePicker;
            datePicker3.Width = Unit.Pixel(100);
            var attachment = editItem["AttachmentColumn"].Controls[0] as RadAsyncUpload;
            attachment.MultipleFileSelection = MultipleFileSelection.Automatic;
 
        }
    }
 
    protected void RadAsyncUpload1_FileUploaded1(object sender, FileUploadedEventArgs e)
    {
        string path = Server.MapPath("~/Uploads/");
        e.File.SaveAs(path + e.File.GetName());
    }
 
    protected void SqlDataSource2_Inserted(object sender, SqlDataSourceStatusEventArgs e)
    {
 
        var mystring = new StringBuilder();
        mystring.Append(EUEUser.DisplayName + ' ' + DateTime.Now);
        fileId = (int)e.Command.Parameters["@InsertedID"].Value;
        UpdateFileData("UPDATE [PtcDbTracker].[dbo].[CAFTable] SET [ChangeLog] = @Changelog WHERE [Unique] = @Unique", fileId, mystring.ToString());
    }
 
    protected void SqlDataSource2_Updated(object sender, SqlDataSourceStatusEventArgs e)
    {
        var mystring = new StringBuilder(oldChangeLogValue + "<br />");
        mystring.AppendLine(EUEUser.DisplayName + ' ' + DateTime.Now);
        UpdateFileData("UPDATE [PtcDbTracker].[dbo].[CAFTable] SET [ChangeLog] = @ChangeLog WHERE [Unique] = @Unique", fileId, mystring.ToString());
    }
 
    private void UpdateFileData(string command, int fileId, string mystring)
    {
        using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["PtcDbModelEntities"].ConnectionString))
        {
            using (SqlCommand comm = new SqlCommand(command, conn))
            {
                if (fileData != null && fileData.Length > 0)
                {
                    //comm.Parameters.Add(new SqlParameter("Unique", fileId));
                    //comm.Parameters.Add(new SqlParameter("BinaryData", fileData));
                    //comm.Parameters.Add(new SqlParameter("FileName", fileName));
                    comm.Parameters.Add(new SqlParameter("ChangeLog", mystring));
                    conn.Open();
                    comm.ExecuteNonQuery();
                }
            }
        }
    }
 
    protected void RadGrid2_ItemCommand(object source, GridCommandEventArgs e)
    {
        var mystring = new StringBuilder(oldChangeLogValue + "<br />");
        mystring.AppendLine(EUEUser.DisplayName + ' ' + DateTime.Now);
        if (e.CommandName == RadGrid.UpdateCommandName ||
            e.CommandName == RadGrid.PerformInsertCommandName)
        {
            var item = e.Item as GridEditableItem;
 
            if (!(item is GridEditFormInsertItem))
            {
                fileId = (int)item.GetDataKeyValue("Unique");
            }
            var asyncUpload = item["AttachmentColumn"].Controls[0] as RadAsyncUpload;
            if (asyncUpload != null && asyncUpload.UploadedFiles.Count > 0)
            {
                var uploadedFile = asyncUpload.UploadedFiles[0];
                fileData = new byte[uploadedFile.ContentLength];
                fileName = uploadedFile.FileName;
                using (Stream str = uploadedFile.InputStream)
                {
                    str.Read(fileData, 0, (int)uploadedFile.ContentLength);
                }
 
                foreach (UploadedFile file in asyncUpload.UploadedFiles)
                {
                    byte[] bytes = new byte[file.ContentLength];
 
                    using (
                        SqlConnection conn1 =
                            new SqlConnection(
                                ConfigurationManager.ConnectionStrings["PtcDbModelEntities"].ConnectionString))
                    {
                        using (
                            SqlCommand comm1 =
                                new SqlCommand(
                                    "Insert into [PtcDbTracker].[dbo].[CAFFileTable] ([Unique1], [BinaryData], [FileName]) Values (?,?,?)",
                                    conn1))
                        {
                            comm1.Parameters.AddWithValue("@Unique1", fileId);
                            comm1.Parameters.AddWithValue("@BinaryData", bytes);
                            comm1.Parameters.AddWithValue("@FileName", fileName);
                        }
                    }
                }
            }
        }
    }
 
    protected void RadGrid2_OnUpdateCommand(object sender, GridCommandEventArgs e)
    {
        oldChangeLogValue = (e.Item as GridEditableItem).GetDataKeyValue("ChangeLog").ToString();
    }
}

Matthew
Top achievements
Rank 1
 answered on 11 May 2015
3 answers
306 views

I am using several pages with grids all with Word, CSV, Excel and PDF export
All export the column headers (i.e. field labels) except the PDF exportI
have tried a multitude of settings without result although I think this
used to work before we moved to using GridTemplateColumn

Currently these are the export settings in aspx

<ExportSettings ExportOnlyData="True" IgnorePaging="true" FileName="TimesheetList" OpenInNewWindow="true" HideStructureColumns="true"
    Pdf-DisableContentEncryption="true" Pdf-Title="Timesheet list" UseItemStyles="false" Word-Format="Html" Pdf-PaperSize="A4" Excel-Format="Html">
    <Pdf PageHeight="297mm" PageWidth="420mm" PageTopMargin="20mm"
        PageRightMargin="10mm" PageLeftMargin="10mm"
        BorderStyle="Thin" BorderColor="#666666" PaperSize="A4" ForceTextWrap="True">
    </Pdf>
</ExportSettings>

And here is the code behind

case "exportpdf":               

    isExport = true;
    RadGridTimesheets.MasterTableView.ExportToPdf();
 
    Response.AppendCookie(CustomNavigationHelper.CreateExportCookie());
    break;

Any ideas what I am doing wrong?

 

Kostadin
Telerik team
 answered on 11 May 2015
1 answer
224 views

Hello,

I want to translate project built by DevExpress into Telerik, So I looking To corresponding features and functions, and my project is a fully dynamic controls and dynamic data source and a fully ajax treatment after rendering the controls as HTML and CSS,my code in DevExpress 

 newcontrol = new ASPxGridLookup();

(newcontrol as ASPxGridLookup).DataSource = rep.GetDataSource(ListQuery, "", ""); //ListQuery = select * from ...

(newcontrol as ASPxGridLookup).KeyFieldName = ListID; //ListID = "ID" for all tables

(newcontrol as ASPxGridLookup).AutoGenerateColumns = true; 

(newcontrol as ASPxGridLookup).IncrementalFilteringMode = IncrementalFilteringMode.Contains;

(newcontrol as ASPxGridLookup).DataBind();

 

 the code above will give me something like the link below with AutoGenerateColumns  and auto design  width & height

https://demos.devexpress.com/ASPxGridViewDemos/ASPxGridLookup/FilterServerMode.aspx 

I see that you have this below but not easy as the above code (is it right corresponding? )

http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multicolumncombo/defaultcs.aspx

or this

http://www.telerik.com/support/code-library/dynamic-multi-column-template

 I need it without any PostBack with auto design for dynamic tables and fields

So please I need the help to move to Telerik UI (ASP.net).

Ivan Danchev
Telerik team
 answered on 11 May 2015
1 answer
64 views

Hello,

    I am facing the issue in radeditor control which capital letter not come after full stop. The requirement is capital letter should auto come after full stop when I typing in radeditor control like MS Word.

I think this functionality should be there in radeditor control.

 

Pl. help me as soon as possible.

Thanks

 Jiten Mutum

 

 

Vessy
Telerik team
 answered on 11 May 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?