Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
133 views
Hi There

I am using a radcombobox box as below:-
 <telerik:RadComboBox ID="radComboFullname" AllowCustomText="true" runat="server" AutoPostBack="true" SkinID="fullnamesearchdropdown" 
                        CausesValidation="False" OnClientItemsRequesting="RequestingHandler" EnableLoadOnDemand="true" 
                        HighlightTemplatedItems="true" ItemRequestTimeout="750" DataSourceID="objDSClientSmartSearch" 
                        DataTextField="fullname" DataValueField="id" TabIndex="1" OnItemsRequested="radComboFullname_ItemsRequested" 
                        OnSelectedIndexChanged="radComboFullname_SelectedIndexChanged"   
                        ShowMoreResultsBox="true" MaxLength="100" IsCaseSensitive="false" LoadingMessage="Searching. Please Wait..." > 
                    </telerik:RadComboBox> 

When the user types more than 2 characters we go off and try to bring back results to display and that works just fine - when niothing is found however we see the text No Matches which is great, but what I need to have happen is for focus to leave this rad combobox from the code behind within :-
protected void radComboFullname_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
{
    if (e.Text.Trim().Length >= 2)
    {
    }
    else
    {
        //move focus off the control
    }
}            

How can i accomplish this?


The javascript we use is also as follows:-
function RequestingHandler(sender, eventArgs) {
            //restrict ajax request until after 2 chars
            if (eventArgs.get_text().length < 2)
                eventArgs.set_cancel(true)
            else
                eventArgs.set_cancel(false);
        }
Simon
Telerik team
 answered on 23 Jun 2010
1 answer
77 views
I Need to add an image or line in order to separate between 1st and last image in the rotator.
How can i do that?
Fiko
Telerik team
 answered on 23 Jun 2010
1 answer
178 views
A couple feature requests I would like to see.

FileExplorer to be able to work with UNC urls.

To be able to box/unbox FileItems and DirectoryItems from FileInfo and DirectoryInfo objects.
Fiko
Telerik team
 answered on 23 Jun 2010
1 answer
461 views
I am having problems with setting the selected value of a RadCombobox that loads items on demand.

I have a RadComboBox as a templated item within a RadGrid and the page I have is geared towards batch updates in a Radgrid and based on this example: http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/clienteditbatchupdates/defaultcs.aspx, except for some very important differences in the type of drop down used which may be contributing to the issues.

Unlike the example, I use a RadCombobox that loads items on demand instead of a regular dropdown and I want to bind the RadCombobox to a nullable item.  I am unable to bind the SelectedValue property of the RadComboBox to the value I want, AccountID, using a simple Bind("AccountID") statement because the value can (and often is) null (which is valid in my scenario).

When I double click a row to put it in "edit mode", e.g. display the Radcombobox and hide the Label, no items are loaded into the combobox until I click on it (due to the load on demand).  I have been unable to get the RadCombobox to have it's selected value initially set to a SelectedValue because of this and I wondering what I am doing wrong/missing.

I can tell that cb.SelectedValue is being set to the correct value in the RadGrid's ItemDatabound event, but at that time there are 0 items loaded into a RadCombobox for a particular row.  I have also tried commenting out ClearSelection in the item load in the RadCombobox's ItemsRequested method, but that has no effect.

One thing I thought is that, since lblAccountID also contains the value I would want to bind/select in the RadCombobox there could be a JavaScript solution to this, where after the items are loaded on demand, the corresponding lblAccountID label for the particular row could be checked and used to set the selected value in the cboAccountID in a delayed manner.


            <telerik:GridTemplateColumn UniqueName="AccountID" SortExpression="AccountID" HeaderText="Account" ConvertEmptyStringToNull="true"> 
                    <ItemTemplate> 
                             <asp:Label ID="lblAccountID" runat="server" Text='<%# Eval("AccountID") %>' Width="305px" /> 
            <telerik:radcombobox id="cboAccountID" runat="server"   
                        Width="305px" Height="200px"  
                        EnableVirtualScrolling="true"  
                        HighlightTemplatedItems="true" 
                        EnableLoadOnDemand="true" 
                        DataValueField="AccountID" 
                        OnItemsRequested="cboAccountID_ItemsRequested"  
                        Style="display: none" 
                        EmptyMessage="Select a Account" > 
                        <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
                        <HeaderTemplate> 
                                    <table style="width: 275px" cellspacing="0" cellpadding="0"> 
                                        <tr> 
                                            <td style="width: 20%;"> 
                                                AccountID</td> 
                                            <td style="width: 80%"> 
                                                Account Alias and ControlSrc</td> 
                                            <td style="width: 20%"> 
                                                Is Active?</td> 
                                        </tr> 
                                    </table> 
                                </HeaderTemplate> 
                                <ItemTemplate> 
                                    <table style="width: 275px" cellspacing="0" cellpadding="0"> 
                                        <tr> 
                                            <td style="width: 20%;"> 
                                                <%#DataBinder.Eval(Container, "Attributes['AccountID']")%> 
                                            </td> 
                                            <td style="width: 80%;"> 
                                                <%#DataBinder.Eval(Container, "Attributes['AccountAliasAndControlSrc']")%> 
                                            </td> 
                                            <td style="width: 20%;"> 
                                                <%# DataBinder.Eval(Container, "Attributes['IsActive']")%> 
                                            </td> 
                                        </tr> 
                                    </table> 
                                </ItemTemplate> 
                        </telerik:radcombobox> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
                 

Code-behind:
   Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound 
 
        Dim cbo As RadComboBox = e.Item.FindControl("cboAccountID") 
        If Not cbo Is Nothing Then 
            If Not DataBinder.Eval(e.Item.DataItem, "AccountID") Is Nothing And IsDBNull(DataBinder.Eval(e.Item.DataItem, "AccountID")) = False Then 
                Try 
                    cbo.SelectedValue = DataBinder.Eval(e.Item.DataItem, "AccountID").ToString 
                Catch ex As ArgumentOutOfRangeException 
 
                Catch ex As Exception 
 
                End Try 
  
            End If 
        End If 
 
        Dim lbl As Label = e.Item.FindControl("lblAccountID") 
        If Not lbl Is Nothing Then 
            If Not DataBinder.Eval(e.Item.DataItem, "AccountID") Is Nothing And IsDBNull(DataBinder.Eval(e.Item.DataItem, "AccountID")) = False Then 
                If Not String.IsNullOrEmpty(lbl.Text) Then 
                    Me.ToolTipManager.TargetControls.Add(lbl.ClientID, DataBinder.Eval(e.Item.DataItem, "AccountID").ToString, True) 
                End If 
            End If 
        End If 
    End Sub 

Protected Sub cboAccountID_ItemsRequested(ByVal sender As Object, ByVal e As RadComboBoxItemsRequestedEventArgs) 
        Dim reader As SqlDataReader = SqlHelper.ExecuteReader(ConfigurationManager.ConnectionStrings("LocalSqlServer").ConnectionString, _ 
                        Data.CommandType.StoredProcedure, "proc_ConfigAccounts_GetAllAccounts") 
 
        Dim comboBox As RadComboBox = DirectCast(sender, RadComboBox) 
        comboBox.Items.Clear() 
        comboBox.ClearSelection() 
        While reader.Read 
            Dim item As New RadComboBoxItem() 
 
            item.Text = reader("AccountID").ToString & " | " & reader("AccountAliasAndControlSrc") & " | " & reader("IsActive").ToString 
            item.Value = reader("AccountID") 
 
            Dim AccountAliasAndControlSrc As String = reader("AccountAliasAndControlSrc") 
            Dim isActive As Boolean = reader("IsActive") 
 
            item.Attributes.Add("AccountID", reader("AccountID").ToString) 
 
            item.Attributes.Add("AccountAliasAndControlSrc", AccountAliasAndControlSrc.ToString()) 
            item.Attributes.Add("IsActive", isActive.ToString()) 
 
            comboBox.Items.Add(item) 
            item.DataBind() 
        End While 
        reader.Close() 
 
 
        ' ''Add default list item 
        ''Dim DefaultItem As New RadComboBoxItem() 
        ''DefaultItem.Text = TryCast(GetGlobalResourceObject("CommonTerms", "EmptyDropdownItem"), String) 
        ''DefaultItem.Value = String.Empty 
        ''comboBox.Items.Insert(0, DefaultItem) 
    End Sub 

Simon
Telerik team
 answered on 23 Jun 2010
1 answer
143 views
I use Radgrid which contain template columns. In template column i use item Template With ASP:Imagebutton & ASP:label.
When i click on first image button then RadGrid_Itemcommand Is fired. After that i click on second image button is also fine. But after that when i again click on first image button then item_Command not fired.
Please give me solution it's very urgent. Thanks in advance.
I Post my code.
ProductCatalog.aspx

<%

@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="ProductCatalog.aspx.vb" Inherits="ProductCatalog" EnableViewStateMac="false" %>

 

 <%

@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

 

 <%

@ Register Src="ProductDetails(vb).ascx" TagName="ProductDetails" TagPrefix="uc1" %>

 

 

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

 

 

<html xmlns="http://www.w3.org/1999/xhtml">

 

     

<head></head>

 

     

<body>

 

         

<asp:UpdatePanel ID="updatepanel2" runat="server" UpdateMode="Conditional" >

 

 

            <ContentTemplate>

 

 

            <script type="text/javascript">

 

 

             

 function CloseActiveToolTip() {

 

 

            setTimeout(

 

            function() {

 

            var tooltip = Telerik.Web.UI.RadToolTip.getCurrent();

 

 

             

if (tooltip) tooltip.hide();

 

 

             }, 1000);

        }

         

</script>

 

 

 

 

 

<telerik:RadToolTipManager runat="server" ID="RadToolTipManager1" Position= "Center" BorderWidth="1px" RelativeTo= "Element" Width="500px" Height="300px" HideEvent="FromCode" Skin="WebBlue" ShowEvent="OnClick" VisibleOnPageLoad="true" Modal="true" OnAjaxUpdate="OnAjaxUpdate" BackColor="#EEEEEE" Animation= "Fade" >

 

 

</telerik:RadToolTipManager>

 

 

<telerik:RadSplitter ID="RadSplitter1" Runat="server" Width="1015px" Height="886px" BackColor="Black" Skin="WebBlue" >

 

 

<telerik:RadPane id="Radpane1" runat="server" width="22px" Collapsed="false" scrolling="None" minwidth="22" CssClass="Radpane" BackColor="#EEEEEE" Height="16px"><telerik:RadSlidingZone ID="SlidingZone1" runat="server" BackColor="#EEEEEE" clicktoopen="true" Visible="true" width="22" DockedPaneId="Contacts" >

 

 

<telerik:RadSlidingPane ID="Contacts" runat="server" Visible="true" width="190px" Height="400px" >

 

 

<telerik:RadTreeView ID="RadTreeView1" runat="server" BackColor="Black" Font-Names="Tahoma" Font-Size="13px" Skin="Hay" Height="900px" Width="175px" ForeColor="White"></telerik:RadTreeView></telerik:RadSlidingPane></telerik:RadSlidingZone></telerik:RadPane>

 

 

<telerik:RadSplitBar id="RadSplitbar1" runat="server" CollapseMode="Forward" BackColor="#EEEEEE"></telerik:RadSplitBar>

 

 

<telerik:RadPane id="RadPane2" runat="server" scrolling="y" style="z-index: 1; left: 1px; top: 329px; position: absolute; height: 653px; width: 856px"><table cellpadding="0" cellspacing="0" ><tr><td>

 

 

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" BackColor="Black" Font-Names="Verdana" Font-Size="Medium" ForeColor="#800040" GridLines="None" Height="624px" Skin="Black" style="margin-bottom: 0px; margin-top: 0px;" Visible="False" Width="990px" OnItemCommand="radgrid1_itemcommand" >

 

 

<headercontextmenu enabletheming="true"><collapseanimation duration="200" type="OutQuint" />

 

 

</headercontextmenu><mastertableview DataKeyNames="srno"><rowindicatorcolumn><HeaderStyle Width="20px" /></rowindicatorcolumn>

 

 

<expandcollapsecolumn><HeaderStyle Width="20px" /></expandcollapsecolumn>

 

 

<Columns>

 

 

<telerik:GridTemplateColumn HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="10px" HeaderText="" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px" UniqueName="TemplateColumn" >

 

 

<ItemTemplate>

 

 

<asp:ImageButton ID="Image1" Runat="server" CommandName="Image1" Height="130px" ImageAlign="Middle" ImageUrl='<%#""& Container.DataItem("imag1")&"" %>' Width="140px" AlternateText='<%#""& Container.DataItem("style1")&"" %>' />

 

 

<asp:Label ID="label1" runat="server" Font-Names="Tahoma" Font-Size="13px" ForeColor="White" Width="140px" Text='<%#""& Container.DataItem("style1")&"" %>' />

 

 

</ItemTemplate>

 

 

    <HeaderStyle Width="10px" /><ItemStyle Width="100px" />

 

 

    </telerik:GridTemplateColumn>

 

 

    <telerik:GridTemplateColumn HeaderStyle-Width="10px" HeaderText="" ItemStyle-Width="100px"     UniqueName="TemplateColumn"     ItemStyle-HorizontalAlign="Center" >

 

 

<ItemTemplate>

 

 

<asp:ImageButton ID="Image2" Runat="server" AlternateText='<%#""& Container.DataItem("style2")&"" %>' BorderColor="#eeeeee" BorderWidth="0px" CommandName="Image2" Height="130px" ImageAlign="Middle" ImageUrl='<%#""& Container.DataItem("imag2")&"" %>' Width="140px" />

 

 

<asp:Label ID="label2" runat="server" ForeColor="White" Font-Names="Tahoma" Font-Size="13px" Width="140px" Text='<%#""& Container.DataItem("style2")&"" %>' />

 

 

</ItemTemplate><HeaderStyle Width="10px" /><ItemStyle Width="100px" />

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridTemplateColumn HeaderStyle-Font-Bold="true" HeaderStyle-ForeColor="Aqua" HeaderStyle-Font-Names="Tahoma" HeaderStyle-Font-Size="15px" HeaderText="Product Catalog" ItemStyle-Width="100Px" UniqueName="TemplateColumn" ItemStyle-HorizontalAlign="Center">

 

 

<ItemTemplate>

 

 

<asp:ImageButton ID="Image3" Runat="server" AlternateText='<%#""& Container.DataItem("style3")&"" %>' BorderColor="#eeeeee" BorderWidth="0px" CommandName="Image3" Height="130px" ImageAlign="Middle" ImageUrl='<%#""& Container.DataItem("imag3")&"" %>' Width="140px" />

 

 

<asp:Label ID="label3" runat="server" ForeColor="White" Font-Names="Tahoma" Font-Size="13px" Width="140px" Text='<%#""& Container.DataItem("style3")&"" %>' />

 

 

</ItemTemplate><HeaderStyle Font-Bold="True" /><ItemStyle Width="100px" />

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridTemplateColumn HeaderText="" ItemStyle-Width="100Px" UniqueName="TemplateColumn" ItemStyle-HorizontalAlign="Center">

 

 

<ItemTemplate>

 

 

<asp:ImageButton ID="Image4" Runat="server" AlternateText='<%#""& Container.DataItem("style4")&"" %>' BorderColor="#eeeeee" BorderWidth="0px" CommandName="Image4" Height="130px" ImageAlign="Middle" ImageUrl='<%#""& Container.DataItem("imag4")&"" %>' Width="140px" />

 

 

<asp:Label ID="label4" runat="server" ForeColor="White" Font-Names="Tahoma" Font-Size="13px" Width="140px" Text='<%#""& Container.DataItem("style4")&"" %>' />

 

 

</ItemTemplate><ItemStyle Width="100px" />

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridTemplateColumn HeaderText="" ItemStyle-Width="100Px" UniqueName="TemplateColumn" ItemStyle-HorizontalAlign="Center">

 

 

<ItemTemplate>

 

 

<asp:ImageButton ID="Image5" Runat="server" AlternateText='<%#""& Container.DataItem("style5")&"" %>' BorderColor="#eeeeee" BorderWidth="0px" CommandName="Image5" Height="130px" ImageAlign="Middle" ImageUrl='<%#""& Container.DataItem("imag5")&"" %>' Width="140px" />

 

 

<asp:Label ID="label5" runat="server" ForeColor="White" Font-Names="Tahoma" Font-Size="13px" Width="140px" Text='<%#""& Container.DataItem("style5")&"" %>' />

 

 

</ItemTemplate><ItemStyle Width="100px" />

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridTemplateColumn HeaderText="" ItemStyle-Width="100Px" UniqueName="TemplateColumn" ItemStyle-HorizontalAlign="Center">

 

 

<ItemTemplate>

 

 

<asp:ImageButton ID="Image6" Runat="server" AlternateText='<%#""& Container.DataItem("style6")&"" %>' BorderColor="#eeeeee" BorderWidth="0px" CommandName="Image5" Height="130px" ImageAlign="Middle" ImageUrl='<%#""& Container.DataItem("imag6")&"" %>' Width="140px" />

 

 

<asp:Label ID="label6" runat="server" ForeColor="White" Font-Names="Tahoma" Font-Size="13px" Width="140px" Text='<%#""& Container.DataItem("style6")&"" %>' />

 

 

</ItemTemplate><ItemStyle Width="100px" />

 

 

</telerik:GridTemplateColumn>

 

 

</Columns>

 

 

</mastertableview>

 

 

<clientsettings enablepostbackonrowclick="true">

 

 

<selecting allowrowselect="true" />

 

 

</clientsettings><HeaderStyle Height="1px" />

 

 

<filtermenu enabletheming="True"><collapseanimation duration="200" type="OutQuint" /></filtermenu>

 

 

</telerik:RadGrid></td></tr></tr></table></telerik:RadPane>

 

 

</telerik:RadSplitter>

 

 

</div>

 

 

</ContentTemplate>

 

 

</asp:UpdatePanel>

 

 <

asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel2" >

 

 

<ProgressTemplate>

 

 

<div id="OuterTableCellOverlay">

 

 

<div id="InnerTableCellOverlay" style="color:Blue" ><B>... LOADING PLEASE WAIT...</B>&nbsp;<BR />

 

 

<asp:Image id="LoadImage1" runat="server" ImageUrl="~/Images/ajax-loader.gif"></asp:Image>

 

 

</div>

 

 

</div>

 

 

</ProgressTemplate>

 

 

</asp:UpdateProgress>

 

 </

 

body>

 

 </

 

html>

 

 

</asp:Content>

 

 

 


ProductCatalog.aspx.vb

 

 

 Imports

 

System.Data

 

 

Imports System.Data.SqlClient

 

 

Imports System.Data.Sql

 

 

Imports System.Web.UI

 

 

 Imports Telerik.Web.UI

 

 

 Imports ASP

 

 

 Imports cls1

 

 

 Imports Microsoft.Vbe.Interop

 

 

 Imports Telerik.Web

 

 

Imports  System

 

 

 Imports System.Configuration

 

 

Imports System.Collections

 

 

Imports System.Web

 

 

Imports System.Web.Security

 

 

Imports  System.Web.UI.WebControls

 

 

Imports System.Web.UI.WebControls.WebParts

 

 

Imports System.Web.UI.HtmlControls

 

 

 

 

Partial

 

Class ProductCatalog

 

 

Inherits System.Web.UI.Page

 

 

 

Dim db As clsDBLayer

 

 

Dim temp As Telerik.Web.UI.RadTreeNode

 

Dim temp1 As Telerik.Web.UI.RadTreeNode

 

Dim newvalue As String

 

Dim dsfillgrid As New DataSet

 

Dim getgroupid As Integer

 

Dim dt As DataTable

 

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

 

 

'If userid=null then goto login page

 

If Session("Userid") = "" Then

 

Response.Redirect("Login.aspx", False)

 

 

End If

 

 

filltreeview()
End Sub

 

 

 

 

 

'this function used to fill the grid with style

 

 

 

 

Protected Sub RadTreeView1_NodeClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTreeNodeEventArgs) Handles RadTreeView1.NodeClick

 

 

 

Dim str1 As String

 

 

Try

 

 

' if the clicked node is last child Node then checked

 

 

 

 

If e.Node.Nodes.Count = 0 Then

 

 

RadGrid1.Visible =

True

 

 

str1 = RadTreeView1.SelectedValue

 

Session(

"LastGroup") = RadTreeView1.SelectedValue

 

 getgroupid = CommonFunction.UDGetSingleValue(

"select groupid from groupmaster where name='" & str1 & "'", True,clsStartUp.Conjewel)

 

 

db = New clsDBLayer

 

 dsfillgrid = db.GetDataset(

"SET QUOTED_IDENTIFIER OFF ; Exec PROC_Teststylegridmatrix " & getgroupid & " SET QUOTED_IDENTIFIER on", "Grid")

 

 

Session(

"Fillgrid") = dsfillgrid

 

 RadGrid1.DataSource = dsfillgrid.Tables(

"Grid")

 

 RadGrid1.DataBind()

 

Me.RadToolTipManager1.Visible = False

 

 

Else

 

 

RadGrid1.Columns.Clear()

 

RadGrid1.Controls.Clear()

RadGrid1.Visible =

False

 

 

End If

 

 

 

 

 

Catch ex As Exception

 

 

End Try

 

 

 

 

End Sub

 

 

 

'This function used to display the tooltip when we click on image(Style)

 

 

 

Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand

 

 

Dim ColNo As String = Right(e.CommandName, 1)

 

 

Dim image As Control = e.Item.FindControl("Image" & ColNo)

 

 

Dim currentRow As ImageButton = DirectCast(e.CommandSource, ImageButton)

 

 

Try

 

 

'When clicked on image show tooltip with selected item

 

 

Me.RadToolTipManager1.Visible = True

 

 

 

clsStartUp.GridEdit =

False

 

 

 

clsStartUp.vieworder =

False '21nov

 

 

clsStartUp.submitorder = False '21nov

 

 

clsStartUp.imagepath = currentRow.ImageUrl

 

Session(

"imagename") = currentRow.AlternateText

 

 

 

If LTrim(Session("imagename")) <> "" Then

 

 

Session("styleid") = CommonFunction.UDGetSingleValue("select styleid from stylemaster where name='" & Session("imagename") & "'", True, clsStartUp.Conjewel)

 

 

Me.RadToolTipManager1.TargetControls.Add(image.ClientID, currentRow.ID, True)

 

 

 

Dim ctrl As Control = Page.LoadControl("ProductDetails(vb).ascx")

 

 

End If

 

 

If LTrim(Session("imagename")) = "" Then

 

 

Me.RadToolTipManager1.Visible = False

 

 

End If

 

 

Catch ex As Exception

 

 

 

 

End Try

 

 

End Sub

 

 

 

 

Protected Sub OnAjaxUpdate(ByVal sender As Object, ByVal args As ToolTipUpdateEventArgs)

 

Me.UpdateToolTip(args.Value, args.UpdatePanel)

 

 

End Sub

 

 

 

 

Private Sub UpdateToolTip(ByVal elementID As String, ByVal panel As UpdatePanel)

 

Dim ctrl As Control = Page.LoadControl("ProductDetails(vb).ascx")

 

panel.ContentTemplateContainer.Controls.Add(ctrl)

 

End Sub

 

 

 

End

 

Class

 

 

 

Veli
Telerik team
 answered on 23 Jun 2010
1 answer
247 views

We use scheduler control .

To the  appointment we use  advanced form user control  that contain resources  user control.

The advanced form code here:

 

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="AdvancedFormCS.ascx.cs" 
    Inherits="SchedulerTemplatesCS.AdvancedForm" %> 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
<%@ Register TagPrefix="scheduler" TagName="ResourceControl" Src="ResourceControlCS.ascx" %> 
<div class="rsAdvancedEdit" style="position: relative; top: -15px; left: -10px;">  
    <div class="rsAdvTitle">  
        <h1 class="rsAdvInnerTitle">  
            עריכת פגישה</h1> 
        <asp:LinkButton runat="server" ID="AdvancedEditCloseButton" CssClass="rsAdvEditClose" 
            CommandName="Cancel" CausesValidation="false" ToolTip='<%# Owner.Localization.AdvancedClose %>'>  
            <%= Owner.Localization.AdvancedClose %> 
        </asp:LinkButton> 
    </div> 
    <div class="rsAdvContentWrapper">  
        <div class="rsAdvOptionsScroll">  
            <asp:Panel runat="server" ID="BasicControlsPanel" CssClass="rsAdvBasicControls">  
                <table> 
                    <tr> 
                        <td> 
                            <label for="<%= StartDate.ClientID %>_dateInput_text">  
                                זמן התחלה</label> 
                            <telerik:RadDatePicker ID="StartDate" runat="server" CssClass="rsAdvDatePicker" Culture="<%# Owner.Culture %>" 
                                MinDate="1900-01-01" SharedCalendarID="SharedCalendar" Skin="<%# Owner.Skin %>" 
                                Width="83px">  
                                <DatePopupButton Visible="False" /> 
                                <DateInput ID="DateInput2" runat="server" DateFormat="<%# Owner.AdvancedForm.DateFormat %>" 
                                    EmptyMessage=" " EmptyMessageStyle-CssClass="radInvalidCss_Default" /> 
                            </telerik:RadDatePicker> 
                            <telerik:RadTimePicker ID="StartTime" runat="server" CssClass="rsAdvTimePicker" Culture="<%# Owner.Culture %>" 
                                Skin="<%# Owner.Skin %>" Width="65px">  
                                <DateInput ID="DateInput3" runat="server" EmptyMessage=" " EmptyMessageStyle-CssClass="radInvalidCss_Default" /> 
                                <TimePopupButton Visible="false" /> 
                                <TimeView ID="TimeView1" runat="server" Columns="2" EndTime="18:00" Interval="00:30" 
                                    ShowHeader="false" StartTime="08:00" /> 
                            </telerik:RadTimePicker> 
                        </td> 
                        <td> 
                            <label for="<%= EndDate.ClientID %>_dateInput_text">  
                                זמן סיום</label> 
                            <telerik:RadDatePicker ID="EndDate" runat="server" CssClass="rsAdvDatePicker" Culture="<%# Owner.Culture %>" 
                                MinDate="1900-01-01" SharedCalendarID="SharedCalendar" Skin="<%# Owner.Skin %>" 
                                Width="83px">  
                                <DatePopupButton Visible="False" /> 
                                <DateInput ID="DateInput4" runat="server" DateFormat="<%# Owner.AdvancedForm.DateFormat %>" 
                                    EmptyMessage=" " EmptyMessageStyle-CssClass="radInvalidCss_Default" /> 
                            </telerik:RadDatePicker> 
                            <telerik:RadTimePicker ID="EndTime" runat="server" CssClass="rsAdvTimePicker" Culture="<%# Owner.Culture %>" 
                                Skin="<%# Owner.Skin %>" Width="65px">  
                                <DateInput ID="DateInput5" runat="server" EmptyMessage=" " EmptyMessageStyle-CssClass="radInvalidCss_Default" /> 
                                <TimePopupButton Visible="false" /> 
                                <TimeView ID="TimeView2" runat="server" Columns="2" EndTime="18:00" Interval="00:30" 
                                    ShowHeader="false" StartTime="08:00" /> 
                            </telerik:RadTimePicker> 
                        </td> 
                    </tr> 
                    <asp:CheckBox runat="server" ID="AllDayEvent" CssClass="rsAdvChkWrap" Checked="false" 
                        Text="כל היום" Visible="false" /> 
                    <asp:RequiredFieldValidator ID="StartDateValidator" runat="server" ControlToValidate="StartDate" 
                        CssClass="rsValidatorMsg" Display="None" EnableClientScript="true" /> 
                    <asp:RequiredFieldValidator ID="StartTimeValidator" runat="server" ControlToValidate="StartTime" 
                        CssClass="rsValidatorMsg" Display="None" EnableClientScript="true" /> 
                    <asp:RequiredFieldValidator ID="EndDateValidator" runat="server" ControlToValidate="EndDate" 
                        CssClass="rsValidatorMsg" Display="None" EnableClientScript="true" /> 
                    <asp:RequiredFieldValidator ID="EndTimeValidator" runat="server" ControlToValidate="EndTime" 
                        CssClass="rsValidatorMsg" Display="None" EnableClientScript="true" /> 
                    <asp:CustomValidator ID="DurationValidator" runat="server" ControlToValidate="StartDate" 
                        CssClass="rsValidatorMsg rsInvalid" Display="Dynamic" EnableClientScript="false" 
                        OnServerValidate="DurationValidator_OnServerValidate" /> 
                    <%-- RESOURCE CONTROLS --%> 
                    <tr> 
                        <td> 
                           <scheduler:ResourceControl ID="ResInspector" runat="server" Label="פקח:" Skin="<%# Owner.Skin %>" 
                                Type="Inspector" /> 
                             
                        </td> 
                        <td> 
                           <scheduler:ResourceControl ID="ResTest" runat="server" Label="סוג בדיקה:" Skin="<%# Owner.Skin %>" 
                                Type="Test" /> 
                            
                        </td> 
                    </tr> 
                    <tr> 
                        <td> 
                             
                        </td> 
                        <td> 
                            
                          <scheduler:ResourceControl ID="ResSite" runat="server" Label="אתר:" Skin="<%# Owner.Skin %>" 
                                Type="Site" /> 
                        </td> 
                    </tr> 
                    <tr> 
                        <td> 
                            <scheduler:ResourceControl ID="ResStatus" runat="server" Label="סטאטוס:" Skin="<%# Owner.Skin %>" 
                                Type="Status" /> 
                       
                        </td> 
                    </tr> 
                    <tr> 
                        <td colspan="2">  
                            <telerik:RadTextBox ID="DescriptionText" runat="server" Label="הערה:" TextMode="MultiLine" 
                                Rows="5" Width="100%" Text='<%# Eval("Description") %>' /> 
                        </td> 
                    </tr> 
                    <tr> 
                        <td> 
                            <asp:HiddenField ID="OriginalRecurrenceRule" runat="server" /> 
                            <telerik:RadCalendar ID="SharedCalendar" runat="server" CultureInfo="<%# Owner.Culture %>" 
                                RangeMinDate="1900-01-01" ShowRowHeaders="false" Skin="<%# Owner.Skin %>" /> 
                        </td> 
                    </tr> 
                </table> 
            </asp:Panel> 
        </div> 
        <asp:Panel runat="server" ID="ButtonsPanel" CssClass="rsAdvancedSubmitArea">  
            <div class="rsAdvButtonWrapper">  
                <asp:LinkButton runat="server" ID="UpdateButton" CssClass="rsAdvEditSave""> 
                    <span>שמור</span> 
                </asp:LinkButton> 
                <asp:LinkButton runat="server" ID="CancelButton" CssClass="rsAdvEditCancel" CommandName="Cancel" 
                    CausesValidation="false">  
                    <span>בטל</span> 
                </asp:LinkButton> 
            </div> 
        </asp:Panel> 
    </div> 
</div> 
 

The  resources   code here:



<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ResourceControlCS.ascx.cs" 
    Inherits="SchedulerTemplatesCS.ResourceControl" %> 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
<asp:Label runat="server" ID="ResourceLabel" AssociatedControlID="ResourceValue" 
    Text='<%# Label %>' CssClass="rsAdvResourceLabel" /> 
<telerik:RadComboBox runat="server" ID="ResourceValue" CssClass="rsAdvResourceValue" 
    Skin='<%# Skin %>' /> 
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="ResourceValue" 
    ErrorMessage="שדה חובה" runat="server" SetFocusOnError="true" Display="Dynamic" > 
</asp:RequiredFieldValidator> 
 

to the resources   user control controls, when I in the advanced form  on client side

I want to do :

·         Events

·          Default  values

·         Validations

How can I do that ?

Dimitar Milushev
Telerik team
 answered on 23 Jun 2010
3 answers
110 views
Hi there,

I need to update some of the values of the item being edited in my code-behind based on some values in a custom Edit Form on our Rad Grid. Can I access the item (and update some values) from one of the Grid's event handlers? Currently I'm storing the values in temporary variables and then injecting the new values in the ObjectDataSource's Inserting/Updating event handlers, but it would be much nicer if I could do it all in one spot. (I can't do it all in the ObjectDataSource event handlers as I can't access the controls inside my Grid's Edit Form.)

I've been playing with the ExtractValues and UpdateValues methods of the GridEditableItem object, but I'm not having any luck.

Any tips would be greatly appreciated :)
Iana Tsolova
Telerik team
 answered on 23 Jun 2010
6 answers
2.4K+ views
Hi, I have a website with a lot of telerik Controls.

I have a master page with the radScriptManager in it :

    <telerik:RadScriptManager ID="RadScriptManager2" runat="server"> 
    </telerik:RadScriptManager> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> 
    </telerik:RadAjaxManager> 

And in my content page i have :

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> 
    <link href="Css/Global.css" rel="stylesheet" type="text/css" /> 
     <script type="text/javascript"> 
      // A lot of functions here 
</script> 


Is it enough to make it work properly?
Are all the javascript of telerik control already managed by the radscript manager or do i have to declare something else inside?
Will the Javascript of my Content page be managed by default by the radscriptmanager?
If i have Custom Css ON the content page like this

  <style type="text/css"> 
        .rcbHeader ul, 
.rcbFooter ul, 
.rcbItem ul, .rcbHovered ul, .rcbDisabled ul 
{ 
    width: 100%; 
    display: inline-block; 
    margin: 0; 
    padding: 0; 
    list-style-type: none; 
} 
</style> 

and also ONE css file (and just one) in the Css Folder.

Does I need to declare the radstylesheetmanager?
Basel Nimer
Top achievements
Rank 2
 answered on 23 Jun 2010
3 answers
123 views
Hi Telerik team

My scenario is I had a custom button in the editor toolbar which will popup my custom radwindow, I want to pass the current editor value to the popup and do a regular expression search during page load event inside popup. I am trying to assign the whole editor content into a hidden field in a javascript on popup window first, then retrieve the content from radwindow page load event, unfortunately I can't get this value from the hidden field in page load event from radwindow, but I can get the value if there is a postback event fired on the radwindow.

Here is my javascript on my popup radwindow

<script type="text/javascript"> 
 
    Sys.Application.add_load(loadData); 
 
    function loadData() { 
        var currentWindow = GetRadWindow().BrowserWindow; 
        hidInput = $('#<%=hidContent.ClientID %>'); 
        alert(hidInput.val()); 
        alert(currentWindow.sm5_editor._editor.get_html(false)); 
        //alert(currentWindow.sm5_editor._editor.get_html(false)); 
        hidInput.val(currentWindow.sm5_editor._editor.get_html(false)); 
    } 
</script> 
    <div style="padding-top:20px">Please select a bookmark</div> 
    <div style="padding-top:5px;"> 
        <telerik:RadComboBox ID="rcbInsertBookmarkLink" runat="server" Width="340"></telerik:RadComboBox> 
    </div> 
    <div style="position:absolute; top:40px; left:362px;"> 
        <img runat="server" id="imgRedAlert" visible="false" src="~/App_Themes/Modern/images/Icons/16x16/redalert.gif" /> 
    </div> 
<input type="hidden" id="hidContent" value="sadfsadf " runat="server" /> 
</asp:Content> 


Here is my code behind
        protected void Page_Load(object sender, EventArgs e) 
        { 
            Master.cmdOk.Click += cmdOk_Click; 
            if (!IsPostBack) 
            { 
                BindBookmarks(); 
            } 
        } 
 
        protected void BindBookmarks() 
        { 
            //EmailsInfo email = EmailsManager.GetEmail(SmartmailQuerystring.EmailId); 
            string emailContent = HttpUtility.UrlDecode(hidContent.Value); 
 
            var reg = new Regex(EditorText.BookmarkRegex, GetRegOptions()); 
            var bs = (from Match item in reg.Matches(emailContent) 
                      select new BookmarkInfo 
                                 { 
                                     BookmarkName = item.Result("$1"), BookmarkType = BookmarkType.EmailBookmark, BookmarkId = Guid.NewGuid().ToString().Replace("-", "") 
                                 }).ToList(); 
 
            rcbInsertBookmarkLink.DataTextField = "BookmarkName"; 
            rcbInsertBookmarkLink.DataValueField = "BookmarkId"; 
            rcbInsertBookmarkLink.DataSource = bs; 
            rcbInsertBookmarkLink.DataBind(); 
        } 


Vincent
Top achievements
Rank 1
 answered on 23 Jun 2010
9 answers
251 views
Hi!

My problem are that the first time I load the website the Grid shows all the rows with data correct.

Then I want to search for a specific name but it return rows that the grid doesn't show.

The count of Items and total pages are right.

In IE7 all works fine.

Can it be the Databind?

To another problem
 The export to excel function in grid doesn't work in IE8. 
This function work in IE7.

How can i solve this two problems?

Best Regards

Christopher Svensson
System Developer
atespintop.com
Christopher Svensson
Top achievements
Rank 1
 answered on 23 Jun 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?