Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
94 views
When I click the edit button, I will get javascript error for "value of 1/1/0001 12:00:00AM is not valid for selecteddate. should between mInDate and MasDate, parameter name "SelectedDate".
My date field "ProcessedDate" is a read only field, not sure why I got this error and how to solve it?

<telerik:GridBoundColumn DataField="ProcessedDate" FilterControlAltText="Filter ProcessDate column"
                                               HeaderText="ProcessDate0" UniqueName="ProcessDate"  
                                              DataFormatString="{0:d}"  ReadOnly="True">
                                           </telerik:GridBoundColumn>
Thanks
Tsvetina
Telerik team
 answered on 09 Mar 2012
2 answers
174 views
Dear Sir,

I am unable to access controls inside a radmenu dynamic template. I am want to handle radlistbox selectedindexchanged event or access selectedvalue property when the menu item is clicked. Please help 

Private Sub mnuRoom_ItemClick(sender As Object, e As Telerik.Web.UI.RadMenuEventArgs) Handles mnuRoom.ItemClick
        If e.Item.Level = 0 Then
            Response.Redirect("~/Pages/Products.aspx?category=" & e.Item.Value)
        Else
            Dim lstCat As RadListBox = DirectCast(e.Item.FindControl("lstCategories"), RadListBox)
            Response.Redirect("~/Pages/Products.aspx?category=" & lstCat.SelectedValue)
        End If
    End Sub


   Private Sub Page_PreRender(sender As Object, e As System.EventArgs) Handles Me.PreRender
Using dbContext As New familia.OpenAccess.EntitiesModel
            mnuRoom.Items.Clear()
            Dim room As IQueryable(Of ProductCategory)
            room = From r In dbContext.ProductCategories Where r.IsActive = True And r.ParentCategory = 0 Select r
            For Each r In room
                Dim roomitem As New Telerik.Web.UI.RadMenuItem
                roomitem.DataItem = r
                roomitem.Value = r.CategoryID
                mnuRoom.Items.Add(roomitem)
                Dim mainmenuItemTemplate As New MainMenuItemTemplate()
                mainmenuItemTemplate.InstantiateIn(roomitem)
                Dim childItem As New RadMenuItem()
                childItem.CssClass = "mainmenudropdown"
                childItem.ItemTemplate = New MenuItemTemplate()
 roomitem.Items.Add(childItem)
Next
        End Using
End Sub



Class MenuItemTemplate
    Implements ITemplate
#Region "ITemplate Members"

    Public Sub InstantiateIn(container As Control) Implements ITemplate.InstantiateIn
        Dim parentItem As RadMenuItem = DirectCast(container.Parent, RadMenuItem)
        Dim room As ProductCategory = DirectCast(parentItem.DataItem, ProductCategory)
        'Dim div As New HtmlGenericControl("div")

        Dim contents As New Panel

       contents.CssClass = "menucontents"
        container.Controls.Add(contents)

        Dim categories As New Panel
        categories.CssClass = "menucategorypanel"

        Dim l As New Label
        l.ForeColor = System.Drawing.ColorTranslator.FromHtml("#1B75BC")
        l.Font.Size = 14
        l.Font.Bold = True
        l.Text = room.CategoryName

        categories.Controls.Add(l)

        Dim cat As New RadListBox

        cat.CssClass = "menucategorylist"
        Using dbContext As New familia.OpenAccess.EntitiesModel
room.RoomID))
            cat.DataSource = From c In dbContext.ProductCategories Where c.IsActive = True And c.ParentCategory = room.CategoryID Select c
            cat.DataTextField = "CategoryName"
            cat.DataValueField = "CategoryID"
            cat.ID = "lstCategories"
            cat.Width = 231
            cat.DataBind()

      End Using
       AddHandler cat.SelectedIndexChanged, New EventHandler(AddressOf lstCategories_SelectedIndexChanged)
        cat.Font.Size = 12
        categories.Controls.Add(cat)

        contents.Controls.Add(categories)

        Dim brands As New Panel
        brands.CssClass = "menubrandpanel"

        Dim b As New Label
        b.ForeColor = System.Drawing.ColorTranslator.FromHtml("#6B6B6B")
        b.Font.Size = 14
        b.Font.Bold = True
        b.Text = "TOP BRANDS"

        brands.Controls.Add(b)

        Dim bnd As New RadListBox
        bnd.CssClass = "menucategorylist"
        Using dbContext As New familia.OpenAccess.EntitiesModel
            bnd.DataSource = dbContext.ProductBrands.Where(Function(c) c.TopBrand = True And c.ProductCategories.Any(Function(r) r.CategoryID = room.CategoryID))

            bnd.DataTextField = "BrandName"
            bnd.DataValueField = "BrandID"
            bnd.Width = 231
            bnd.DataBind()
        End Using

        bnd.Font.Size = 12
        brands.Controls.Add(bnd)

        contents.Controls.Add(brands)

        Dim bottom As New Panel

        bottom.CssClass = "menucategorybottom"

        Dim bimg As New RadBinaryImage
        bimg.ImageUrl = "/images/layout/brand.png"
        bimg.ResizeMode = BinaryImageResizeMode.Fit
        bimg.Width = 20
        bimg.Height = 20
        bimg.CssClass = "buttonimage"
        bottom.Controls.Add(bimg)
        Dim brand As New RadButton
        brand.ButtonType = RadButtonType.LinkButton
        brand.CssClass = "brandbutton"
        brand.Font.Bold = True
        brand.Font.Size = 10
        brand.Text = "All Brands"
        bottom.Controls.Add(brand)

        Dim bdimg As New RadBinaryImage
        bdimg.ImageUrl = "/images/layout/BestDeals.png"
        bdimg.ResizeMode = BinaryImageResizeMode.Fit
        bdimg.Width = 20
        bdimg.Height = 20
        bdimg.CssClass = "buttonimage"

        bottom.Controls.Add(bdimg)

        Dim deals As New RadButton
        deals.ButtonType = RadButtonType.LinkButton

        deals.CssClass = "brandbutton"
        deals.Font.Bold = True
        deals.Font.Size = 10
        deals.Text = "Best Deals"
        bottom.Controls.Add(deals)

        Dim psimg As New RadBinaryImage
        psimg.ImageUrl = "/images/layout/Premimum.png"
        psimg.ResizeMode = BinaryImageResizeMode.Fit
        psimg.Width = 20
        psimg.Height = 20
        psimg.CssClass = "buttonimage"

        bottom.Controls.Add(psimg)

        Dim pre As New RadButton
        pre.ButtonType = RadButtonType.LinkButton
        pre.CssClass = "brandbutton"
        pre.Font.Bold = True
        pre.Font.Size = 10
        pre.Text = "Premium Selections"
        bottom.Controls.Add(pre)

        Dim nimg As New RadBinaryImage
        nimg.ImageUrl = "/images/layout/new.png"
        nimg.ResizeMode = BinaryImageResizeMode.Fit
        nimg.Width = 20
        nimg.Height = 20
        nimg.CssClass = "buttonimage"

        bottom.Controls.Add(nimg)

        Dim ne As New RadButton
        ne.ButtonType = RadButtonType.LinkButton
        ne.CssClass = "brandbutton"
        ne.Font.Bold = True
        ne.Font.Size = 10
        ne.Text = "Recently Added"
        bottom.Controls.Add(ne)
        contents.Controls.Add(bottom)

  End Sub

    Private Sub lstCategories_SelectedIndexChanged(sender As Object, e As System.EventArgs)

    End Sub
#End Region
End Class
Zafar
Top achievements
Rank 1
 answered on 09 Mar 2012
1 answer
93 views
I am having a RadTreeList control in my page. I need to validate that every first hierarchy items(0th Nested Level items) can have only 5 levels of children( not 5 children) i.e., each 0th Nested Level items can have 5 hierarchical levels. I am using both item creation method and drag-drop method. While dragging from some item to an item, I need to validate that the destination item has only 5 hierarchical levels after dropping. If the sum of hierarchical levels is equal or greater than 5, then the dragged item should not be allowed to drop to the destination item.
Can anyone help for this.

Thanks in Advance,
Abilash
Daniel
Telerik team
 answered on 09 Mar 2012
7 answers
127 views
Hi,

I am using Rad Scheduler to show the appointment on daily basis. What i want is, that if there is no appointment for a particular slot then that slot should not be created.
for example i have this on datatable  
9:00 Am to 10:00 Am | Do something
10:00 Am to 11:00 Am | Do nothing
and then
1:00 Pm to 2:00 Pm | Do something Again

so what i did, i have set 9:00 Am as start time and 2:00 Pm as end time
it had also created time slot for 11:00 to 12:00 and 12:00 to 1:00 which are not in Datatable.

i did tried 
 if (e.TimeSlot.Appointments.Count < 1)
        {
            e.TimeSlot.Control.Visible = false;
          }
but still i can see hours on Hours Column and blank space in between the time slot.
is there any way i can stop the time slot from creating or create timeslot according to slot's in Datatable.
Please help.
Thanks 
Prashant Rawat
 
Plamen
Telerik team
 answered on 09 Mar 2012
1 answer
67 views
maybe through vsto
Slav
Telerik team
 answered on 09 Mar 2012
1 answer
274 views
I have the following setup as shown in the markup below. There is an ajaxified panel which contains an imagebutton and a hyperlink. Clicking on either of these opens a rad Window, which has a close handler. The close handler initiates the "click" event of a hidden button in order for me to be able to run some server-side code after the window closes. When I open the radwindow using the hyperlink, everything works as expected. When I do so using the image button, I get the following non-descript javascript error when the hidden button .click event is raised.

Error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 405

This error doesn not occur if I don't ajaxify the panel.

I have tried to research this error and track down the cause, but to no avail. When I look at this in Fiddler, I notice the URL that fiddler errors on is .{my path}/javascript:void(0);. I don't know where the javascript:void(0); comes from... but I obviously include that in the Imagebutton PostbackUrl to prevent a postback when the imagebutton is clicked. I also don't know why this piece of the imagebutton declaration would have anything to do with this since the error occurs on the attempt to raise the hidden button's click event.

Any Idea why the image button implementation wouldn't work, while the hyperlink does?

Markup:

<telerik:RadCodeBlock ID="rcb1" runat="server">
          
        <script language="javascript">
  
            function OpenDialog() {
                var oWin = radopen('http://www.yahoo.com', ''); 
                oWin.add_close(Refresh);            
             }
  
            function Refresh() {
                $get('<%= tiReloader.ClientID %>').click();
            }
              
  
        </script>
  
    </telerik:RadCodeBlock>
      
<asp:ScriptManager ID="MyScriptManager" runat="server" AsyncPostBackTimeout="7200"></asp:ScriptManager>
<telerik:RadAjaxLoadingPanel id="lpGlobal" Runat="server" Transparency="18" CssClass="AjaxLoadingProgress"></telerik:RadAjaxLoadingPanel>
<asp:Panel id="pnlT" runat="Server" height="400px">
    <asp:Button ID="tiReloader" runat="server" Text="Button" style="display:none;" />
    <asp:ImageButton id="ib" runat="Server" ImageUrl="~/global/images/icons/edit.png" AlternateText="Open Dialog from Image Button" ImageAlign="AbsMiddle" PostBackUrl="javascript:void(0);" OnClientClick="OpenDialog()" /><br/><br/>
    <asp:Hyperlink id="hl" runat="Server" target="_self" navigateurl="javascript:OpenDialog();" >Open Dialog from Hyperlink</asp:Hyperlink>
</asp:Panel>


In code-behind, I ajaxify the panel using an ajaxmanager which is part of my page base class:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        SetAjaxManagerSettings()
    End Sub
  
    Private Sub SetAjaxManagerSettings()
        Me.AddAjaxSetting(pnlT, pnlT, lpGlobal, Unit.Percentage(100), Web.UI.UpdatePanelRenderMode.Block )
    End Sub
  
    Private Sub tiReloader_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles tiReloader.Click
        Threading.Thread.Sleep(500)
    End Sub
  
Public Sub AddAjaxSetting(ByVal initiatorControl As Control, ByVal updatedControl As Control, ByVal loadingPanel As RadAjaxLoadingPanel, ByVal updatePanelHeight As Unit, ByVal updatePanelRenderMode As UpdatePanelRenderMode)
  
            Dim ajaxManager As RadAjaxManager = Telerik.Web.UI.RadAjaxManager.GetCurrent(Me)
  
            If ajaxManager IsNot Nothing Then
  
                If initiatorControl IsNot Nothing And updatedControl IsNot Nothing Then
  
                    Dim setting As AjaxSetting = New AjaxSetting
  
                    ajaxManager.AjaxSettings.Add(setting)
  
                    setting.AjaxControlID = initiatorControl.ID
  
                    Dim ajxUpdatedControl As New AjaxUpdatedControl()
  
                    ajxUpdatedControl.ControlID = updatedControl.ID
  
                    If loadingPanel IsNot Nothing Then
  
                        ajxUpdatedControl.LoadingPanelID = loadingPanel.ID
  
                    End If
  
                    setting.UpdatedControls.Add(ajxUpdatedControl)
  
                    ajxUpdatedControl.UpdatePanelRenderMode = updatePanelRenderMode
  
                    If Not updatePanelHeight.IsEmpty Then
  
                        ajxUpdatedControl.UpdatePanelHeight = updatePanelHeight
  
                    End If
  
                Else
  
                    Throw New Exception("The initiatorControl or updatedControl is NULL. Cannot add AjaxSetting.")
  
                End If
  
            Else
  
                Throw New Exception("Telerik RadAjaxManager not found on page. Set UseSharedAjaxManager property to True in Page_Init event or add a Telerik RadAjaxManager control to the page.")
  
            End If
  
        End Sub
Maria Ilieva
Telerik team
 answered on 09 Mar 2012
2 answers
126 views
We use the RAD Tab strip to divide the form under various sections and noticed that when we try to set a textbox value of one tab with value entered in another tab, we get an overlapping style in the target textbox.

This happens if the target textbox has a empty message set. I've attached the markup code below:

<%@ 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" />
    <script type="text/javascript" id="telerikClientEvents1">
//<![CDATA[
 
        function txtTab1Title_ClientOnBlur(sender, args) {
            //Add JavaScript handler code here
            var ctrl1 = $("input[id$='txtTab2Title']");
            var txtTab2Title = $find(ctrl1.get(0).id);
            txtTab2Title.set_value(sender.get_value());
        }
 
        function txtTab2Title_ClientOnBlur(sender, args) {
            //Add JavaScript handler code here
            var ctrl1 = $("input[id$='txtTab1Title']");
            var txtTab1Title = $find(ctrl1.get(0).id);
            txtTab1Title.set_value(sender.get_value());
        }
//]]>
    </script>
</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>
    <div class="MasterContainer">
        <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1"
            SelectedIndex="0" Skin="Hay" Width="100%">
            <Tabs>
                <telerik:RadTab runat="server" Text="Tab1" Value="Tab1" Owner="RadTabStrip1"
                    Selected="True" PageViewID="rpvTab1" />
                <telerik:RadTab runat="server" Text="Tab2" Value="Tab2" Owner="RadTabStrip1" PageViewID="rpvTab2" />
            </Tabs>
        </telerik:RadTabStrip>
        <telerik:RadMultiPage ID="RadMultiPage1" runat="server">
            <telerik:RadPageView ID="rpvTab1" runat="server" Selected="true" Width="100%">
                <h4>
                    Tab1 Tab Contents</h4>
                <div class="FormContainer">
                    <telerik:RadTextBox ID="txtTab1Title" runat="server" EmptyMessage="Tab1 Title"
                        Label="Title:" Width="400px">
                        <ClientEvents OnBlur="txtTab1Title_ClientOnBlur" />
                    </telerik:RadTextBox>
                </div>
            </telerik:RadPageView>
            <telerik:RadPageView ID="rpvTab2" runat="server" Width="100%">
                <h4>
                    Tab2 Tab Contents</h4>
                <div class="FormContainer">
                    <telerik:RadTextBox ID="txtTab2Title" runat="server" EmptyMessage="Tab2 Tab Title"
                        Label="Title:" Width="400px">
                        <ClientEvents OnBlur="txtTab2Title_ClientOnBlur" />
                    </telerik:RadTextBox>
                </div>
            </telerik:RadPageView>
        </telerik:RadMultiPage>
    </div>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    </form>
</body>
</html>


Vasil
Telerik team
 answered on 09 Mar 2012
1 answer
141 views
Hi everybody, i created, a site map dinamically, but all the nodes assume tha same navigateUrl.

Is possible to make that dinamically ? if so, how?
thnkz
<telerik:RadSiteMap runat="server" ID="RadSiteMap1"
    DataFieldID="ID" DataFieldParentID="ParentID" DataTextField="Text" ShowNodeLines="true">
    <DataBindings>
        <telerik:RadSiteMapNodeBinding NavigateUrl="#" />
    </DataBindings>
</telerik:RadSiteMap>
protected void Page_Load(object sender, EventArgs e)
       {
           RadSiteMap1.DataSource = SiteDataItem.GetSiteData();
           RadSiteMap1.DataBind();
       }
       /// <summary>
       /// Método que encapsula os atributos e monta a lista.
       /// </summary>
       public class SiteDataItem
       {
           private string _text;
           private int _parentId;
           private int prvID;
           private string prvLink;
 
           /// <summary>
           /// Descrição dos nodes
           /// </summary>
           public string Text
           {
               get { return _text; }
               set { _text = value; }
           }
           /// <summary>
           /// ID do node
           /// </summary>
           public int ID
           {
               get { return prvID; }
               set { prvID = value; }
           }
           /// <summary>
           /// ID de node pai
           /// </summary>
           public int ParentID
           {
               get { return _parentId; }
               set { _parentId = value; }
           }
           /// <summary>
           /// Atribui valor aos campos.
           /// </summary>
           /// <param name="ID"></param>
           /// <param name="nivel0"></param>
           /// <param name="nivel1"></param>
           /// <param name="nivel2"></param>
           /// <param name="nivel3"></param>
           /// <param name="nivel4"></param>
           /// <param name="text"></param>
           /// int ID, int nivel0, int nivel1, int nivel2, int nivel3, int nivel4,
           public SiteDataItem(int id, int parentId, string text)
           {
               //prvNivel0 = nivel0;
               //prvNivel1 = nivel1;
               //prvNivel2 = nivel2;
               //prvNivel3 = nivel3;
               //prvNivel4 = nivel4;
               prvID = id;
               _parentId = parentId;
               _text = text;
           }
           /// <summary>
           /// Monta a lista TreeView.
           /// </summary>
           /// <returns>Lista com dados TreeView.</returns>
           public static List<SiteDataItem> GetSiteData()
           {
               List<SiteDataItem> siteData = new List<SiteDataItem>();
 
               siteData.Add(new SiteDataItem(1, 0, "Products"));
               siteData.Add(new SiteDataItem(2, 1, "RadControls for ASP.NET Ajax"));
               siteData.Add(new SiteDataItem(3, 1, "RadControls for Silverlight"));
               siteData.Add(new SiteDataItem(4, 2, "RadGrid"));
               siteData.Add(new SiteDataItem(5, 2, "RadScheduler"));
               siteData.Add(new SiteDataItem(6, 2, "RadEditor"));
               siteData.Add(new SiteDataItem(7, 3, "RadGrid"));
               siteData.Add(new SiteDataItem(8, 3, "RadMenu"));
               siteData.Add(new SiteDataItem(9, 3, "RadEditor"));
 
               return siteData;
           }
       }
Peter
Telerik team
 answered on 09 Mar 2012
1 answer
129 views
Hi,
 In the following demo on telerik site if I click on html file in attachment column for downloading it in IE and click open option, it redirects me to that page instead of opening a new window. I have a requirement wherein new window should be opened for attachment if it is html file.

http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/gridattachmentcolumn/defaultcs.aspx 

Regards,
mahesh
Andrey
Telerik team
 answered on 09 Mar 2012
2 answers
86 views
Hi,

We would like to change the forecolor of WeightItem of the tag cloud control, currently weightitem has been set with grey color, the issue is, we have background image(see the screen shot) for cloud control and it also has the grey color so weight item is not visible properly. we will be able to solve this if we can change the color of the weight item.

Thanks
Venkat
Venkatakrishna
Top achievements
Rank 1
 answered on 09 Mar 2012
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?