Telerik Forums
UI for ASP.NET AJAX Forum
7 answers
937 views
Hi,

I try on the server site to reset the selected date ( textbox need to be empty).

The definition of my RadDatePicker is :
<telerik:RadDatePicker ID="txt_DateFrom" runat="server" Culture="nl-NL" MinDate="2010-02-15" 
                                MaxDate="" ShowPopupOnFocus="true" /> 

I try to use this but whithout effect !

txt_DateFrom.DateInput.Text = string.empty;

I try to find a solution on the demo area, documentation and forum but nothing founded!

Can you me please help with this?

In advance thanks,

Regards,

Edwin.
bdk0172
Top achievements
Rank 1
 answered on 17 Aug 2010
1 answer
111 views
I have a SQLDataAdapter with a data relation defined thusly:
        Dim cnn As SqlConnection = New SqlConnection(Application("ConnStr"))
        Dim cmd1 As SqlDataAdapter = New SqlDataAdapter("select * from topic_Areas Order by Topic_Name ASC", cnn)
        Dim ds As DataSet = New DataSet()
        cmd1.Fill(ds, "topic_Areas")
        Dim cmd2 As SqlDataAdapter = New SqlDataAdapter("select * from vw_DCMP_Topics_Subjects Order by Subject_Name ASC", cnn)
        cmd2.Fill(ds, "vw_DCMP_Topics_Subjects")
        ds.Relations.Add("myrelation", ds.Tables("topic_Areas").Columns("Topic_Num"), ds.Tables("vw_DCMP_Topics_Subjects").Columns("Topic_Num"))
       'some form of setting the Treeview datasource on this line
        Page.DataBind()
        cnn.Close()

I would like to have the Parent nodes populated with the topic_areas and the child nodes for each parent node filled with the vw_DCMP_Topics_Subjects related data.

Is if possible to do this with the Treeview and if so how would one do this?

Thanks in advance.

swells
Top achievements
Rank 1
 answered on 17 Aug 2010
2 answers
115 views
Hello,

I am developing a web application that is accessed two ways: through a LAN and through a gateway.  It works fine when accessed over the LAN, but breaks when accessed over the gateway because of the AJAX in the application.  Of course the AJAX is there because there is substantial use of Telerik controls :)

The problem is that there is a directory structure in the gateway URL.  When it tries to load the objects, it looks for /ScriptResource.axd?d=blob&t=timestamp and cannot find it, so none of the Telerik AJAX controls work properly.

Anyway, I've read that you can force the ScriptManager to use static files.  I've set it to use a static Telerik.Web.UI file (as shown in the static client side library), but I see that isn't the only Telerik script that is loaded.  On one particular page (on which there are about 10 Telerik controls) I see there are numerous other calls to ScriptResource.axd that generate client side code to handle the Telerik controls.  Is there any way I can reference those in the <scripts> section of the <scriptmanager>, and perhaps save them as static files as well? 

Or is there another solution to this gateway problem? 

Thanks!!
Diego
Top achievements
Rank 1
 answered on 17 Aug 2010
1 answer
61 views
On a custom toolbar button click I would like to insert a start html tag at begining of  selected content and and an close tag at the end of the selection.

There is a help on inserting HTML tag at the beginning of the selection, the problem is inserted the close tag at the end of the selection

for example a user selcts some text in content area;
Telerik.Web.UI.Editor.CommandList["MyTestButton"] = function(commandName, editor, args)
{
   editor.pasteHtml(
'<TagBegin>');

       /*some way to find end of selection ???*/

   editor.pastHtml('<TagEnd>');
 
};

Thanks in advanced

-----addendum-----
---Never mind... This is clearly addressed in the help---

http://www.telerik.com/help/aspnet-ajax/obtainingcurrenteditorselectionashtml.html
John
Top achievements
Rank 1
 answered on 17 Aug 2010
2 answers
120 views
I have a problem with geting vaules form the Edit / Popup Form.
The underlying datasource is an Object.

I can Insert the values in the form, but my code gets only emtpy values.

What can be wrong

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Arbeitsprofile.aspx.cs" Inherits="Web.Stammdaten.Arbeitsprofile" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <telerik:RadAjaxManager ID="AjaxManager" runat="server" 
                DefaultLoadingPanelID="AjaxLoadingPanel" EnableHistory="True">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="grdArbeitsprofile">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="grdArbeitsprofile" 
                        LoadingPanelID="AjaxLoadingPanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="AjaxLoadingPanel" runat="server" Skin="Default" 
                Transparency="70">
    </telerik:RadAjaxLoadingPanel
    <telerik:RadGrid ID="grdArbeitsprofile" runat="server" AllowSorting="True" 
        AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True" GridLines="None" 
        Skin="Sitefinity" OnInsertCommand="grdArbeitsprofile_InsertCommand">
        <MasterTableView AutoGenerateColumns="False" EditMode="EditForms" CommandItemDisplay="Top" DataKeyNames="ID">
         <Columns>
          <telerik:GridBoundColumn
            DataField="Bezeichnung"
            HeaderText="Bezeichnung"
            SortExpression="Bezeichnung"
            UniqueName="Bezeichnung" />
          <telerik:GridBoundColumn
            DataField="Bemerkung"
            HeaderText="Bemerkung"
            SortExpression="Bemerkung"
            UniqueName="Bemerkung" />
         </Columns>
             <EditFormSettings EditFormType="AutoGenerated"  InsertCaption="Neues Arbeitsprofil" CaptionFormatString="Arbeitsprofil: {0}" CaptionDataField="Bezeichnung">                   
</EditFormSettings>
        </MasterTableView>
        <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
            <Selecting AllowRowSelect="True" />
 </ClientSettings>
     </telerik:RadGrid>   
    </asp:Content>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Pepperhost.Greifplaner.Web.Data;
using Telerik.Web.Design;
using Telerik.Web.UI;
  
  
namespace Web.Stammdaten
{
    using DTO=Pepperhost.Greifplaner.Web.Data.DataTransferobjects;
    public partial class Arbeitsprofile : System.Web.UI.Page
    {
        DataProvider db = new DataProvider();
  
        protected void Page_Load(object sender, EventArgs e)
        {
            grdArbeitsprofile.UpdateCommand+= new GridCommandEventHandler(grdArbeitsprofile_UpdateCommand);
           // grdArbeitsprofile.InsertCommand+= new GridCommandEventHandler(grdArbeitsprofile_InsertCommand);
            grdArbeitsprofile.NeedDataSource+=new GridNeedDataSourceEventHandler(grdArbeitsprofile_NeedDataSource);
              
            grdArbeitsprofile.DataSource = db.GetArbeitsprofilListe();
            grdArbeitsprofile.DataBind();
  
        }
  
        protected void grdArbeitsprofile_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName == RadGrid.PerformInsertCommandName)
            {
                 GridEditableItem item = e.Item as GridEditableItem;  
          
                try
                {
                    DTO.Arbeitsprofil arbeitsprofil = new DTO.Arbeitsprofil();
  
                   arbeitsprofil.Bemerkung = (item["Bemerkung"].Controls[0] as TextBox).Text;
                   arbeitsprofil.Bezeichnung = (item["Bezeichnung"].Controls[0] as TextBox).Text;
                   db.CreateArbeitsprofil(arbeitsprofil);
                }
                catch (Exception ex)
                {
                    grdArbeitsprofile.Controls.Add(new LiteralControl("Unable to update Employee. Reason: " + ex.Message));
                    e.Canceled = true;
                }
  
            }
             
        }
  
        protected void grdArbeitsprofile_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
  
            try
            {
                grdArbeitsprofile.DataSource = db.GetArbeitsprofilListe();
                grdArbeitsprofile.DataBind();
            }
            catch (Exception ex)
            {
                grdArbeitsprofile.MasterTableView.NoRecordsTemplate = new NoRecordsTemplate(ex.Message);
            }
            finally
            {
                  
            }
  
        }
        protected void grdArbeitsprofile_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {  
           GridEditableItem item = e.Item as GridEditableItem;
  
           try
           {
               DTO.Arbeitsprofil arbeitsprofil = new DTO.Arbeitsprofil();
               arbeitsprofil.ID=(int)item.OwnerTableView.DataKeyValues[item.ItemIndex]["ID"];
               arbeitsprofil.Bemerkung = (item["Bemerkung"].Controls[0] as TextBox).Text;
               arbeitsprofil.Bezeichnung = (item["Bezeichnung"].Controls[0] as TextBox).Text;
               db.UpdateArbeitsprofil(arbeitsprofil);
           }
           catch (Exception ex)
           {
               grdArbeitsprofile.Controls.Add(new LiteralControl("Unable to update Employee. Reason: " + ex.Message));
               e.Canceled = true;
           }
        }
       }
    class NoRecordsTemplate : ITemplate
    {
        private string _Message;
        public NoRecordsTemplate(string Message)
        {
            _Message = Message;
        }
  
        public void InstantiateIn(Control container)
        {
            Label lbl = new Label();
            lbl.ID = "Label1";
            lbl.Text = _Message;
            lbl.ForeColor = System.Drawing.Color.RoyalBlue;
            container.Controls.Add(lbl);
        }
    }
  
}
Daniel
Telerik team
 answered on 17 Aug 2010
2 answers
95 views
Hi telerik team

i need to call custom validation function on insert- edit event of appointment.

in scheduler i used Advanced edit/insert template (Advanced Edit/Insert template). but i can't add onclientclick event on Save Linkbutton.

is there any other way to call custom function on save to which i can pass the form controls. Actually i need to check for various required field's values and i dont want to use RequiredFieldValidator in the form.

if you need any other info, please let me know.

Regards
Manmeet Singh
Manmeet
Top achievements
Rank 1
 answered on 17 Aug 2010
2 answers
93 views
I want to use the HeaderContextMenu for a RadGrid, but there are several TemplateColumns and they are being ignored by the HeaderContextMenu commands.

I am able to sort, group and filter by the normal BoundColumns, but if I try to do anything with one of the TemplateColumns it doesn't work. I added SortExpression and UniqueName to each of the templates, but still no dice.

Is there anything else I need to do to make it work?

Thanks

<telerik:RadGrid ID="rgLoads" runat="server" AutoGenerateColumns="false" AllowPaging="true" AllowSorting="true" AllowFilteringByColumn="true" OnItemCommand="rgLoads_ItemCommand" EnableHeaderContextMenu="true" EnableHeaderContextFilterMenu="true" OnItemDataBound="rgLoads_ItemDataBound" OnGroupsChanging="rgLoads_GroupsChanging" OnPageIndexChanged="rgLoads_PageIndexChanged">
        <HeaderContextMenu OnItemClick="HeaderContextMenu_ItemClick" />
        <GroupingSettings CaseSensitive="false" />        
        <MasterTableView IsFilterItemExpanded="false" EnableHeaderContextMenu="true" Width="100%">
            <Columns>
                <telerik:GridBoundColumn DataField="UrgHours" HeaderText="Urg Hrs" SortExpression="UrgHours" UniqueName="UrgHours" />
                <telerik:GridTemplateColumn HeaderText="LD Code" SortExpression="LoadCode" UniqueName="LoadCode">
                    <ItemTemplate>
                        <asp:HyperLink ID="LDCodeTarget" runat="server" NavigateUrl="#" Text='<%# Eval("LoadCode") %>' />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="SpotLight" HeaderText="Spotlight" SortExpression="SpotLight" UniqueName="SpotLight" />
                <telerik:GridTemplateColumn HeaderText="PRO" SortExpression="ProNo" UniqueName="ProNo">
                    <ItemTemplate>
                        <asp:HyperLink ID="ProTarget" runat="server" NavigateUrl="#" Text='<%# Eval("ProNo") %>' />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="LoadSegment" HeaderText="Load Seg" SortExpression="LoadSegment" UniqueName="LoadSegment" />
                <telerik:GridBoundColumn DataField="SendFromCity" HeaderText="Origin City" SortExpression="SendFromCity" UniqueName="SendFromCity" />
                <telerik:GridBoundColumn DataField="SendFromStateProv" HeaderText="Origin State" SortExpression="SendFromStateProv" UniqueName="SendFromStateProv" />
                <telerik:GridBoundColumn DataField="SendToCity" HeaderText="Dest City" SortExpression="SendToCity" UniqueName="SendToCity" />
                <telerik:GridBoundColumn DataField="SendToStateProv" HeaderText="Dest State" SortExpression="SendToStateProv" UniqueName="SendToStateProv" />
                <telerik:GridBoundColumn DataField="PickupDate" HeaderText="PU Dt" SortExpression="PickupDate" UniqueName="PickupDate" />
                <telerik:GridBoundColumn DataField="PickupTime" HeaderText="PU Tm" SortExpression="PickupTime" UniqueName="PickupTime" />                
                <telerik:GridBoundColumn DataField="LOH" HeaderText="LOH" SortExpression="LOH" UniqueName="LOH" />
                <telerik:GridBoundColumn DataField="MoveType" HeaderText="Move Type" SortExpression="MoveType" UniqueName="MoveType" />
                <telerik:GridBoundColumn DataField="STerm" HeaderText="STerm" SortExpression="STerm" UniqueName="STerm" />
                <telerik:GridBoundColumn DataField="DH" HeaderText="DH" SortExpression="DH" UniqueName="DH" />
                <telerik:GridTemplateColumn HeaderText="Assgn Code" SortExpression="AssignmentCode" UniqueName="AssignmentCode">
                    <ItemTemplate>
                        <asp:HyperLink ID="AssignmentCodeTarget" runat="server" NavigateUrl="#" Text='<%# Eval("AssignmentCode") %>' />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Error Code" SortExpression="ErrorCode" UniqueName="ErrorCode">
                    <ItemTemplate>
                        <asp:HyperLink ID="ErrorCodeTarget" runat="server" NavigateUrl="#" Text='<%# Eval("ErrorCode") %>' />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Recom" SortExpression="Recom" UniqueName="Recom">
                    <ItemTemplate>
                        <asp:Literal ID="litRecom" runat="server" Text='<%# Eval("Recom") %>' />
                        <asp:HyperLink ID="RecomTarget" runat="server" NavigateUrl="#" Text='<%# Eval("Recom") %>' />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Driver Code" SortExpression="DriverCode" UniqueName="DriverCode">
                    <ItemTemplate>
                        <asp:HyperLink ID="DriverCodeTarget" runat="server" NavigateUrl="#" Text='<%# Eval("DriverCode") %>' />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="MinsOfferSent" HeaderText="Mins Offer Sent" SortExpression="MinsOfferSent" UniqueName="MinsOfferSent" />
                <telerik:GridBoundColumn DataField="HTDaysOut" HeaderText="HT Days Out" SortExpression="HTDaysOut" UniqueName="HTDaysOut" />
                <telerik:GridBoundColumn DataField="TruckSize" HeaderText="Truck Size" SortExpression="TruckSize" UniqueName="TruckSize" />
                <telerik:GridBoundColumn DataField="DIV" HeaderText="DIV" SortExpression="DIV" UniqueName="DIV" />
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
Daniel
Telerik team
 answered on 17 Aug 2010
9 answers
328 views
I have read throught he forum and see that a number of people do not like the feature of the RadDatePicker auto correcting.

To rehash:

If I enter 13/12/2010 I DO NOT want the control to automatically change it to 12/13/2010.

I have tried adding the following:

 

 

<telerik:RadScriptBlock runat="server">  
 
    <script type="text/javascript">  
 
        Telerik.Web.UI.RadDateInput.prototype.parseDate = function(value, baseDate) {  
 
            if (new Date(value) != "NaN")  
 
                return value;  
 
            }   
 
    </script>   
 
</telerik:RadScriptBlock> 
 


However, while this certainly causes the dates to no longer change it also prevents me from putting in VALID dates and prevents me from using the calendar control. I would appreciate any clarification I may be missing.

Thanks,

Chris Lynch
Top achievements
Rank 1
 answered on 17 Aug 2010
2 answers
591 views
Hi,

I am trying to capitalise the text that has been input into a RadTextBox when focus is moved out of the control.

This is my code:
<telerik:RadTextBox ID="txtPostcode" runat="server" MaxLength="8">
<ClientEvents OnBlur="this.set_value(this.get_value().toUpperCase())" />
</telerik:RadTextBox>

This throws an obscure ajax javascript error when the form is first loaded:
Microsoft JScript runtime error: Object doesn't support this property or method.
This is on line 3 at

a(

 

this,b.EventArgs.Empty)

 

of the MicrosoftAjax.js that is generated dynamically by the Telerik.Web.UI assembly. 

Can you tell me what's wrong?

Thanks.
Craig Wallace
Top achievements
Rank 1
 answered on 17 Aug 2010
2 answers
191 views
I have a column in my RadGrid whose visibility is dependant on a checkbox on the page. When the user checks the checkbox, the column appears. When they uncheck, it disappears. Both the checkbox and the grid are in an ajax panel. Works fine.

My problem is when the user sets a filter for the column in question and then unchecks the checkbox, the filter persists. It's not apparent to the user that data is being filtered because the column with the filter is no longer visible.

So I want to reset the column filter when the user toggles the visiblity of the column. To do this, I have the following code in my checkbox's CheckChanged event handler:

if(chkShowInActive.Checked)
{
    myGrid.Columns.FindByUniqueName("IsActive").Visible = true;
}
else
{
    myGrid.Columns.FindByUniqueName("IsActive").Visible = false;
}
  
myGrid.Columns.FindByUniqueName("IsActive").CurrentFilterFunction = GridKnownFunction.NoFilter;
myGrid.Rebind();

This doesn't seem to have any effect. The grid still filters the data. What am I doing wrong?
Robert
Top achievements
Rank 1
 answered on 17 Aug 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?