Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
112 views
Hi all,
I have a problem with a scenario I didn't find in all your demo, kb, and stuff.
I made a user control who work using radajaxmanagerproxy: it's a quite simple form for editing data, some textbox and a couple of combobox, with save and cancel button. If I use this control in an .aspx page, declaring a radajaxmanager, everything works fine.
But, if a create a page with a datalist, and declare the usercontrol inside the item template of the datalist, the ajax stuff don't work so well: the first time I try to use it, it's simply not ajaxified. From the second time on, the ajax stuff works.
I'll put the code of the page and the usercontrol: there are both cases (direct usercontrol declaration and datalist itemtemplate) on the same page. The user control is decalred directly for creating new item, and inside the datalist itemtemplate for editing.
Mainpage:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="ShowControl.aspx.vb" Inherits="test_ShowControl" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<%@ Register Src="../AttiviDetailsControl/Controparti.ascx" TagName="Controparti" 
    TagPrefix="uc1" %> 
<%@ Register Src="../AttiviDetailsControl/ContropartiItem.ascx" TagName="Contropartiitem" 
    TagPrefix="uc1" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title></title>  
</head> 
<body> 
    <form id="form1" runat="server">  
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
    </telerik:RadScriptManager> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">          
    </telerik:RadAjaxManager> 
    <span>Create new item</span> 
    <uc1:Contropartiitem idAttivo="12" createNew="true" runat="server" ID="cpi1" /> 
    <br /> 
    <span>Editing</span> 
    <asp:Panel ID="editPanel" runat="server">  
        <asp:DataList ID="DataList1" runat="server" DataSourceID="LinqDataSource1" DataKeyField="IdControparte">  
            <ItemTemplate> 
                <uc1:Contropartiitem ID="ControPartiItem1" runat="server" createNew="false" idControparte='<%# Bind("IdControparte") %>' 
                    idAttivo='<%# Bind("IdAttivo") %>' cap='<%# Bind("CoCap") %>' idCompagnia='<%# Bind("IdCompagniaControparte") %>' 
                    idIspettorato='<%# Bind("IdIspettorato") %>' indirizzo='<%# Bind("CoIndirizzo") %>' 
                    localita='<%# Bind("CoLocalita") %>' marca='<%# Bind("Marca") %>' modello='<%# Bind("Modello") %>' 
                    nominativo='<%# Bind("NominativoControparte") %>' pr='<%# Bind("CoPR") %>' responsabileSx='<%# Bind("ResponsabileSiNo") %>' 
                    targa='<%# Bind("Targa") %>' telefoni='<%# Bind("CoTel") %>' /> 
            </ItemTemplate> 
        </asp:DataList> 
        <asp:LinqDataSource ID="LinqDataSource1" runat="server" EnableUpdate="true" ContextTypeName="ClaimsDataContext" 
            TableName="Contropartis">  
        </asp:LinqDataSource> 
    </asp:Panel> 
    </form> 
</body> 
</html> 
 

UserControl.aspx
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="ControPartiItem.ascx.vb" 
    Inherits="AttiviDetailsControl_ControPartiItem" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">  
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="btnSave">  
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="controparteItemPanel"   
                    LoadingPanelID="lp1" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
        <telerik:AjaxSetting AjaxControlID="btnCancel">  
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="controparteItemPanel"   
                    LoadingPanelID="lp1" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
        <telerik:AjaxSetting AjaxControlID="btnCreate">  
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="controparteItemPanel"   
                    LoadingPanelID="lp1" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
        <telerik:AjaxSetting AjaxControlID="pVeicolo">  
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="pVeicolo" LoadingPanelID="lp1" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
    </AjaxSettings> 
</telerik:RadAjaxManagerProxy> 
 
<telerik:RadAjaxLoadingPanel ID="lp1" runat=server Skin="Sunset">  
</telerik:RadAjaxLoadingPanel> 
<asp:HiddenField ID="hfIdControparte" runat="server" /> 
<asp:HiddenField ID="hfIdAttivo" runat="server" /> 
<telerik:RadCodeBlock ID="rcb1" runat=server>  
<span><%=Now%></span>  
</telerik:RadCodeBlock> 
 
<asp:Panel ID="controparteItemPanel" runat="server">  
    <table> 
        <tr> 
            <td> 
                <label id="label1" runat="server" style="color: #990000">  
                    Veicolo</label> 
            </td> 
            <td> 
                <table width="100%">  
                    <tr> 
                        <td align="left">  
                            <label id="label2" runat="server" style="color: #990000">  
                                Controparte</label> 
                        </td> 
                        <td align="right">  
                            <label id="label3" runat="server">  
                                Responsabile del sinistro?</label> 
                            <telerik:RadComboBox ID="rcbResponsabileSx" runat="server" Width="50px">  
                                <Items> 
                                    <telerik:RadComboBoxItem Text="Si" Value="S" /> 
                                    <telerik:RadComboBoxItem Text="No" Value="N" /> 
                                </Items> 
                            </telerik:RadComboBox> 
                        </td> 
                    </tr> 
                </table> 
            </td> 
        </tr> 
        <tr> 
            <td> 
                <asp:Panel ID="pVeicolo" runat="server" BorderStyle="Solid" BorderColor="LightGray" 
                    BorderWidth="1px" Style="padding: 3px">  
                    <label id="label4" runat="server">  
                        Targa</label> 
                    &nbsp;&nbsp;&nbsp;&nbsp;  
                    <asp:TextBox ID="tbTarga" runat="server" BackColor="LightYellow" Width="80px"></asp:TextBox> 
                    <label id="label14" runat="server">  
                        Marca</label> 
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:TextBox ID="tbMarca" runat="server"></asp:TextBox> 
                    <table> 
                        <tr> 
                            <td> 
                                <label id="label5" runat="server">  
                                    Modello</label> 
                            </td> 
                            <td> 
                                <asp:TextBox ID="tbModello" runat="server" Width="246px"></asp:TextBox> 
                            </td> 
                        </tr> 
                        <tr> 
                            <td> 
                                <label id="label6" runat="server">  
                                    N° polizza</label> 
                            </td> 
                            <td> 
                                <asp:TextBox ID="tbPolizza" runat="server" Width="246px"></asp:TextBox> 
                            </td> 
                        </tr> 
                        <tr> 
                            <td> 
                                <label id="label7" runat="server">  
                                    Compagnia</label> 
                            </td> 
                            <td> 
                                <telerik:RadComboBox ID="rcbCompagnia" runat="server" Width="250px" DataSourceID="ldsCompagnia" 
                                    DataTextField="RagioneSocialeCompagnia" DataValueField="IdCompagnia" Skin="Sunset" 
                                    AutoPostBack="true">  
                                </telerik:RadComboBox> 
                            </td> 
                        </tr> 
                        <tr> 
                            <td> 
                                <label id="label8" runat="server">  
                                    Ispettorato</label> 
                            </td> 
                            <td> 
                                <telerik:RadComboBox ID="rcbIspettorato" runat="server" Width="250px" Skin="Sunset" 
                                    DataSourceID="ldsIspettorato" DataTextField="RagioneSocialeIspettorato" DataValueField="IdIspettorato">  
                                </telerik:RadComboBox> 
                            </td> 
                        </tr> 
                    </table> 
                </asp:Panel> 
            </td> 
            <td> 
                <asp:Panel ID="pControparte" runat="server" BorderStyle="Solid" BorderColor="LightGray" 
                    BorderWidth="1px" Height="140px">  
                    <table> 
                        <tr> 
                            <td> 
                                <label id="label9" runat="server">  
                                    Nominativo</label> 
                            </td> 
                            <td> 
                                <asp:TextBox ID="tbNominativo" runat="server" Width="246px"></asp:TextBox> 
                            </td> 
                        </tr> 
                        <tr> 
                            <td> 
                                <label id="label10" runat="server">  
                                    Indirizzo</label> 
                            </td> 
                            <td> 
                                <asp:TextBox ID="tbIndirizzo" runat="server" Width="246px"></asp:TextBox> 
                            </td> 
                        </tr> 
                        <tr> 
                            <td> 
                            </td> 
                            <td> 
                                <table style="border-collapse: collapse; padding: 0px; margin: 0px;">  
                                    <tr> 
                                        <td> 
                                            <label id="label12" runat="server">  
                                                C.A.P.</label> 
                                        </td> 
                                        <td> 
                                            <label id="label13" runat="server">  
                                                Località</label> 
                                        </td> 
                                        <td> 
                                            <label id="label15" runat="server">  
                                                PR</label> 
                                        </td> 
                                    </tr> 
                                    <tr> 
                                        <td> 
                                            <asp:TextBox ID="tbCAP" runat="server" Width="40px"></asp:TextBox> 
                                        </td> 
                                        <td> 
                                            <asp:TextBox ID="tbLocalita" runat="server" Width="170px"></asp:TextBox> 
                                        </td> 
                                        <td> 
                                            <asp:TextBox ID="tbPR" runat="server" Width="20px"></asp:TextBox> 
                                        </td> 
                                    </tr> 
                                </table> 
                            </td> 
                        </tr> 
                        <tr> 
                            <td> 
                                <label id="label11" runat="server">  
                                    Telefoni</label> 
                            </td> 
                            <td> 
                                <asp:TextBox ID="tbTelefoni" runat="server" Width="246px"></asp:TextBox> 
                            </td> 
                        </tr> 
                    </table> 
                </asp:Panel> 
            </td> 
        </tr> 
    </table> 
</asp:Panel> 
<asp:Panel ID="pEditButtons" runat=server > 
    <asp:Button ID="btnSave" runat="server" Text="Salva" /> 
    &nbsp;  
    <asp:Button ID="btnCancel" runat="server" Text="Annulla" /> 
</asp:Panel> 
<asp:Panel ID="pNewButtons" runat=server > 
    <asp:Button ID="btnCreate" runat="server" Text="Inserisci" /> 
</asp:Panel> 
 
<asp:LinqDataSource ID="ldsCompagnia" runat="server" ContextTypeName="ClaimsDataContext" 
    TableName="TabCompagnies">  
</asp:LinqDataSource> 
<asp:LinqDataSource ID="ldsIspettorato" runat="server" ContextTypeName="ClaimsDataContext" 
    TableName="TabIspettoratiCompagnies">  
</asp:LinqDataSource> 
 
usercontrol.vb
Imports System.Linq  
Imports System.Data.Linq  
Imports Telerik.Web.UI  
 
Partial Class AttiviDetailsControl_ControPartiItem  
    Inherits System.Web.UI.UserControl
#Region " property non visibili"  
 
    Public Property idControparte() As Integer 
        Get 
            If IsNumeric(hfIdControparte.Value) Then 
                Return hfIdControparte.Value  
            Else 
                Return -1  
            End If 
        End Get 
        Set(ByVal value As Integer)  
            hfIdControparte.Value = value  
        End Set 
    End Property 
 
    Public Property idAttivo() As Integer 
        Get 
            If IsNumeric(hfIdAttivo.Value) Then 
                Return hfIdAttivo.Value  
            Else 
                Return -1  
            End If 
        End Get 
        Set(ByVal value As Integer)  
            hfIdAttivo.Value = value  
        End Set 
    End Property 
 
    Public Property createNew() As Boolean 
        Get 
            Return ViewState("createNew")  
        End Get 
        Set(ByVal value As Boolean)  
            ViewState("createNew") = value  
        End Set 
    End Property
#End Region  
 
#Region " property sezione veicolo" 
 
    Public Property targa() As String 
        Get 
            Return tbTarga.Text  
        End Get 
        Set(ByVal value As String)  
            tbTarga.Text = value  
        End Set 
    End Property 
 
    Public Property marca() As String 
        Get 
            Return tbMarca.Text  
        End Get 
        Set(ByVal value As String)  
            tbMarca.Text = value  
        End Set 
    End Property 
 
    Public Property modello() As String 
        Get 
            Return tbModello.Text  
        End Get 
        Set(ByVal value As String)  
            tbModello.Text = value  
        End Set 
    End Property 
 
    Public Property polizza() As String 
        Get 
            Return tbPolizza.Text  
        End Get 
        Set(ByVal value As String)  
            tbPolizza.Text = value  
        End Set 
    End Property 
 
    Public Property idCompagnia() As Nullable(Of Integer)  
        Get 
            If IsNumeric(rcbCompagnia.SelectedValue) Then 
                Return rcbCompagnia.SelectedValue  
            Else 
                Return -1  
            End If 
        End Get 
        Set(ByVal value As Nullable(Of Integer))  
            If Not value Is Nothing Then 
                rcbCompagnia.SelectedValue = value  
            End If 
        End Set 
    End Property 
 
    Public Property idIspettorato() As Nullable(Of Integer)  
        Get 
            If IsNumeric(rcbIspettorato.SelectedValue) Then 
                Return rcbIspettorato.SelectedValue  
            Else 
                Return -1  
            End If 
        End Get 
        Set(ByVal value As Nullable(Of Integer))  
            If Not value Is Nothing Then 
                rcbIspettorato.SelectedValue = value  
            End If 
        End Set 
    End Property
#End Region  
 
#Region " property sezione controparte" 
 
    Public Property responsabileSx() As String 
        Get 
            Return rcbResponsabileSx.SelectedValue  
        End Get 
        Set(ByVal value As String)  
            rcbResponsabileSx.SelectedValue = value  
        End Set 
    End Property 
 
    Public Property nominativo() As String 
        Get 
            Return tbNominativo.Text  
        End Get 
        Set(ByVal value As String)  
            tbNominativo.Text = value  
        End Set 
    End Property 
 
    Public Property indirizzo() As String 
        Get 
            Return tbIndirizzo.Text  
        End Get 
        Set(ByVal value As String)  
            tbIndirizzo.Text = value  
        End Set 
    End Property 
 
    Public Property cap() As String 
        Get 
            Return tbCAP.Text  
        End Get 
        Set(ByVal value As String)  
            tbCAP.Text = value  
        End Set 
    End Property 
 
    Public Property pr() As String 
        Get 
            Return tbPR.Text  
        End Get 
        Set(ByVal value As String)  
            tbPR.Text = value  
        End Set 
    End Property 
 
    Public Property localita() As String 
        Get 
            Return tbLocalita.Text  
        End Get 
        Set(ByVal value As String)  
            tbLocalita.Text = value  
        End Set 
    End Property 
 
    Public Property telefoni() As String 
        Get 
            Return tbTelefoni.Text  
        End Get 
        Set(ByVal value As String)  
            tbTelefoni.Text = value  
        End Set 
    End Property
#End Region  
 
    Protected Sub ldsCompagnia_Selecting(ByVal sender As ObjectByVal e As System.Web.UI.WebControls.LinqDataSourceSelectEventArgs) Handles ldsCompagnia.Selecting  
        Dim db As New ClaimsDataContext()  
        Dim sel = From comp In db.TabCompagnies _  
                  Where comp.Attivi = True _  
                  Or comp.IdCompagnia = idCompagnia _  
                  Order By comp.RagioneSocialeCompagnia _  
                  Select comp  
        e.Result = sel  
    End Sub 
 
    Protected Sub ldsIspettorato_Selecting(ByVal sender As ObjectByVal e As System.Web.UI.WebControls.LinqDataSourceSelectEventArgs) Handles ldsIspettorato.Selecting  
        Dim db As New ClaimsDataContext()  
        Dim sel = From isp In db.TabIspettoratiCompagnies _  
                  Where isp.IdCompagnia = idCompagnia Or isp.IdIspettorato = idIspettorato _  
                  Order By isp.RagioneSocialeIspettorato _  
                  Select isp  
        e.Result = sel  
    End Sub 
 
    Protected Sub rcbCompagnia_SelectedIndexChanged(ByVal o As ObjectByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles rcbCompagnia.SelectedIndexChanged  
        rcbIspettorato.DataBind()  
    End Sub 
 
    Protected Sub btnSave_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles btnSave.Click  
        Try 
            'si recupera la controparte corrente  
            Dim db As New ClaimsDataContext()  
            Dim controparte As Controparti = (From c In db.Contropartis _  
                              Where c.IdControparte = idControparte _  
                              Select c).FirstOrDefault()  
            'vengono aggiornati i valori  
            controparte.CoCAP = cap  
            controparte.CoIndirizzo = indirizzo  
            controparte.CoLocalita = localita  
            controparte.CoPR = pr  
            controparte.CoTel = telefoni  
            controparte.IdCompagniaControparte = idCompagnia  
            controparte.IdIspettorato = idIspettorato  
            controparte.Marca = marca  
            controparte.Modello = modello  
            controparte.NominativoControparte = nominativo  
            controparte.NumeroPolizzaControparte = polizza  
            controparte.ResponsabileSiNo = responsabileSx  
            controparte.Targa = targa  
            'vengono rese persistenti (su db) le modifiche  
            db.SubmitChanges()  
            Alekso.Log.Logger.write("Salvataggio controparte id=" & idControparte & " avvenuto correttamente", _  
                                    Alekso.Log.Category.DATABASE, Alekso.Log.Severity.INFO, _  
                                    Session.getUser.nominativo)  
        Catch ex As Exception  
            Alekso.Log.Logger.write("Errore durante il salvataggio di una controparte, id=" & idControparte, _  
                                    Alekso.Log.Category.DATABASE, Alekso.Log.Severity.CRITICAL, _  
                                    Session.getUser.nominativo)  
        End Try 
 
    End Sub 
 
    Protected Sub btnCancel_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles btnCancel.Click  
        Try 
            'si recupera la controparte corrente  
            Dim db As New ClaimsDataContext()  
            Dim controparte As Controparti = (From c In db.Contropartis _  
                              Where c.IdControparte = idControparte _  
                              Select c).FirstOrDefault()  
            'vengono aggiornati i valori  
            cap = controparte.CoCAP  
            indirizzo = controparte.CoIndirizzo  
            localita = controparte.CoLocalita  
            pr = controparte.CoPR  
            telefoni = controparte.CoTel  
            idCompagnia = controparte.IdCompagniaControparte  
            idIspettorato = controparte.IdIspettorato  
            marca = controparte.Marca  
            modello = controparte.Modello  
            nominativo = controparte.NominativoControparte  
            polizza = controparte.NumeroPolizzaControparte  
            responsabileSx = controparte.ResponsabileSiNo  
            targa = controparte.Targa  
 
            Alekso.Log.Logger.write("Recuperata controparte id=" & idControparte & " a seguito di annullamento modifica", _  
                                    Alekso.Log.Category.DATABASE, Alekso.Log.Severity.DEBUG, _  
                                    Session.getUser.nominativo)  
        Catch ex As Exception  
            Alekso.Log.Logger.write("Errore durante il recupero di una controparte, id=" & idControparte, _  
                                    Alekso.Log.Category.DATABASE, Alekso.Log.Severity.ERROR, _  
                                    Session.getUser.nominativo)  
        End Try 
    End Sub 
 
    Protected Sub btnCreate_Click(ByVal sender As ObjectByVal e As System.EventArgs) Handles btnCreate.Click  
        Try 
            'creazione nuova controparte  
            Dim db As New ClaimsDataContext()  
            Dim controparte As New Controparti()  
            'valorizzazione campi  
            controparte.IdAttivo = idAttivo  
            controparte.CoCAP = cap  
            controparte.CoIndirizzo = indirizzo  
            controparte.CoLocalita = localita  
            controparte.CoPR = pr  
            controparte.CoTel = telefoni  
            controparte.IdCompagniaControparte = idCompagnia  
            controparte.IdIspettorato = idIspettorato  
            controparte.Marca = marca  
            controparte.Modello = modello  
            controparte.NominativoControparte = nominativo  
            controparte.NumeroPolizzaControparte = polizza  
            controparte.ResponsabileSiNo = responsabileSx  
            controparte.Targa = targa  
            'persistenza nuovo elemento  
            db.Contropartis.InsertOnSubmit(controparte)  
            db.SubmitChanges()  
            Alekso.Log.Logger.write("Salvataggio nuova controparte avvenuto correttamente", _  
                                    Alekso.Log.Category.DATABASE, Alekso.Log.Severity.INFO, _  
                                    Session.getUser.nominativo)  
        Catch ex As Exception  
            Alekso.Log.Logger.write("Errore durante il salvataggio di una nuova controparte", _  
                                    Alekso.Log.Category.DATABASE, Alekso.Log.Severity.CRITICAL, _  
                                    Session.getUser.nominativo)  
        End Try 
    End Sub 
 
    Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
        If Not IsPostBack Then 
            pEditButtons.Visible = Not createNew  
            pNewButtons.Visible = createNew  
 
        End If 
    End Sub 
 
End Class 
 


Moreover ther are some minor issues too.
If you try to use the "create new item" instance of the user control, you'll see that the ajax behaviour works fine but the rest of the page's layout is somehow... shaked for some moments. And this happen just the first time a postback occurs.

Not included in the sample attached, I have some problem also trying to put some ajax behaviour also on the .aspx page: if I declare in the radajaxmanager an ajaxsetting involving the single usercontrol instance to update the datalist panel (view following code snippet)
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="cpi1">  
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="cpi1" LoadingPanelID="lp2" /> 
                <telerik:AjaxUpdatedControl ControlID="editPanel" LoadingPanelID="lp2" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
    </AjaxSettings> 
</telerik:RadAjaxManager> 
<telerik:RadAjaxLoadingPanel ID="lp2" runat=server Skin="Sunset">  
</telerik:RadAjaxLoadingPanel> 
 it simply disable ajax everywhere... and I have nomore ajax behaviour avalable.

Need some help please
Marco

Yavor
Telerik team
 answered on 12 Aug 2009
1 answer
152 views
Hi All,

I am using RadControl Q1 2009.
I am using RadEditor control.

I have the following questions

1)How can i get the pdf content to save the pdf in database ?
2)How can i get the exportpdf content ?
3)While exporting it is not showing the table from editor, how can i export all the content from editor ?

4) It is possible to show the pdf and asp button on same aspx page?
 5) The event OnExportContent="RadEditor1_ExportContent"  not present with q1 2009 version?


Thanks,








Rumen
Telerik team
 answered on 12 Aug 2009
1 answer
97 views
Hi

I would like to configure my radeditor manager dialogs in dotnetnuke, so the user can upload files, but not rename, move and delete files.

I user my own provider, but when i set the upload path it also enables the rename, can i prevent this ?

A suggestion for development, make a config.xml to handle the dialogs, like on the editor. That would make more flexible.

Thanks for an awesome product :-)
 
Best regards
Thomas
Lini
Telerik team
 answered on 12 Aug 2009
1 answer
164 views
Hi,.

I am about to update an application to use the Radlistbox, where I currently use the ASP.NET Listbox.
I have 2 listboxes, where the 1st contains values, that can be transferred to the 2nd.
- BUT the 2nd has already some preselected, and if the values are in the 2nd listbox, they should NOT be in the 1st Listbox.

VERY simple, and no problem when I use the classic listboxes.
But how is this done in Radlistboxes?

This is quite simple, but I couldn't find the answer in this forum.

See my example script:

HTML:
    <form id="form1" runat="server"
     
     
    <div> 
        <telerik:RadScriptManager ID="RadScriptManager1" Runat="server"
        </telerik:RadScriptManager> 
        hello</div> 
     
     
    <div class="radtxt"
        <div style="float: left;"
            <div> 
                All Websites:</div> 
            <telerik:RadListBox ID="listWebsites" runat="server" Width="180px"  
                Height="200px" TransferToID="listSelectedwebsites" 
                Skin="Telerik" /> 
        </div> 
        <div style="float: left;"
            <div style="vertical-align: middle; text-align: center;"
                <asp:Button ID="btnTransferright" CssClass="specialbuttons" OnClientClick="return transferRight()" 
                    Text="Add >>" runat="server" /> 
            </div> 
            <div> 
                <asp:Button ID="btnTransferleft" CssClass="specialbuttons" OnClientClick="return transferLeft()" 
                    Text="<< Remove" runat="server" /> 
            </div> 
        </div> 
        <div style="float: left;"
            <div> 
                Selected Website(s):</div> 
            <telerik:RadListBox ID="listSelectedwebsites" runat="server" Width="180" Height="200px" 
                Skin="Telerik" /> 
        </div> 
    </div> 
    </form> 

And the VB-script:
 Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load 
 
        Me.listSelectedwebsites.Items.Add(New RadListBoxItem("RadListBoxItem1", 1)) 
        'Me.listSelectedwebsites.Items.Add(New RadListBoxItem("RadListBoxItem2", 2)) 
        Me.listSelectedwebsites.Items.Add(New RadListBoxItem("RadListBoxItem3", 3)) 
 
        If Not Me.listSelectedwebsites.Items.Contains(New RadListBoxItem("RadListBoxItem1", 1)) Then 
            Me.listWebsites.Items.Add(New RadListBoxItem("RadListBoxItem11", 11)) 
        End If 
 
        If Not Me.listSelectedwebsites.Items.Contains(New RadListBoxItem("RadListBoxItem2", 2)) Then 
            Me.listWebsites.Items.Add(New RadListBoxItem("RadListBoxItem22", 22)) 
        End If 
 
        If Not Me.listSelectedwebsites.Items.Contains(New RadListBoxItem("RadListBoxItem3", 3)) Then 
            Me.listWebsites.Items.Add(New RadListBoxItem("RadListBoxItem33", 33)) 
        End If 
 
    End Sub 

This VB dos not work:
If Not Me.listSelectedwebsites.Items.Contains(New RadListBoxItem("RadListBoxItem1", 1)) Then
- I want to check if the value is in the 2nd listbox - if not I put it in the 1st listbox.

But I have no luck.

Hope someone can help?

Thanks.

Br
Frank






Genady Sergeev
Telerik team
 answered on 12 Aug 2009
2 answers
109 views
Hi,

I databind against a ObjectSource, like in the AppointmentList class example. 

I fill the AppointmentList manually from another datasource and would like to specify the query whith the actual timeinterval in the choosen in the Scheduler (VisibleRangeStart/VisibleRangeEnd).

I tried to set these values in sessions objects, but I can't find an event that have the VisibleRangeStart/VisibleRangeEnd values, and has not yet made the databind.

Is there a way to do this???

Best regards,
Christian
Christian Ulrich
Top achievements
Rank 1
 answered on 12 Aug 2009
1 answer
104 views
Hi,

I want to set the forecolor  for the text in the Rad Combo box using the java script.  Please help me to solve this issue.

i am using the following code:

var

 

rcbCat = $find('<%=rcbSugSphereR.ClientID %>');

 

 

if (rcbCat.get_text() != "--Select Category--") {

 

PrdName = rcbCat.get_text();

rcbCat.style.forecolor =

"Red";
 }

Thanks & regards,
Sushanth Mathew

 

Princy
Top achievements
Rank 2
 answered on 12 Aug 2009
1 answer
128 views

 

 

I am using the Multi Column Combo . Here is the .aspx Code

<telerik:RadComboBox ID="rcRFQRef" runat="server" Height="190px" Width="153px"

HighlightTemplatedItems="true" MarkFirstMatch="true" EnableLoadOnDemand="true"

DataTextField="RFQNo" DataValueField="Agent_Code" DropDownWidth="420"

OnPreRender="rcRFQRef_PreRender" CssClass="RadComboBox_Default" AutoPostBack="True"

OnSelectedIndexChanged="rcRFQRef_SelectedIndexChanged"

onitemdatabound="rcRFQRef_ItemDataBound">

<HeaderTemplate>

<table style="width: 450px" cellspacing="0" cellpadding="0">

<tr>

<td style="width:50px;">

RFQ No

</td>

<td style="width: 50px;">

Agent Code

</td>

<td style="width: 150px;">

Agent Name

</td>

<td style="width: 50px;">

Mode

</td>

<td style="width: 150px;">

POC

</td>

</tr>

</table>

</HeaderTemplate>

<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>

<ItemTemplate>

<table style="width: 450px" cellspacing="0" cellpadding="0">

<tr>

 

 

<td style="width: 50px;">

<div>

<%# DataBinder.Eval(Container.DataItem, "RFQNo")%>

</div>

</td>

<td style="width: 50px;">

<div>

<%# DataBinder.Eval(Container.DataItem, "Agent_Code")%>

</div>

</td>

<td style="width: 150px;">

<div>

<%# DataBinder.Eval(Container.DataItem, "Agent_Name")%>

</div>

</td>

<td style="width: 50px;">

<div>

<%# DataBinder.Eval(Container.DataItem, "Mode")%>

</div>

</td>

<td style="width: 150px;">

<div>

<%# DataBinder.Eval(Container.DataItem, "AgentPOC")%>

</div>

</td>

</tr>

</table>

</ItemTemplate>

</telerik:RadComboBox>

If I Bind the Data then the O/P will be

 

RFQNo       AgentCode         AgentName         Mode       POC

RFQ-56      1072              XYZ               Air         LMN

RFQ-56      2078              ABC               Air         LMN

RFQ-57      1072              XYZ               Ocean       ASD

 

 

Problem:-

But the problem is IF I select RFQ-57 also In “Select_Indexchanged”Event its Showing “RFQ-56”.

BO_RfqResponse._RFQRegNo = rcbxRegRefno.SelectedValue.ToString();

BO_RfqResponse._RFQRef = rcRFQRef.SelectedItem.Text;

BO_RfqResponse._AgentCode = rcRFQRef.SelectedValue.ToString();

Please any one help me in this regards….

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Yana
Telerik team
 answered on 12 Aug 2009
3 answers
112 views
Hi

I am loong for a way to call the Flash manager Dialog from the editor through a Javascript method. I have tried the fire command and it works for image and document manager but i need it to work for the flash and media manager aswel.

Thank you
Rumen
Telerik team
 answered on 12 Aug 2009
3 answers
68 views

I'm having a problem displaying my Radprompt through codebhind.
I simply have the code in an asp:button inside an UpdatePanel.
The alertprompt does not display and on the corner left bottom of the screen
I recieve a script error. I'm using the following code in the codebehind:

 

Dim

 

radalertscript As String = "<script language='javascript'>function f(){radalert('TEXT', 200, 200, 'Title'); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>"

 

 

 

Page.ClientScript.RegisterStartupScript(Me.[GetType](), "radalert", radalertscript)


thanks a bunch.

 

Georgi Tunev
Telerik team
 answered on 12 Aug 2009
5 answers
524 views
Hi there,

I'm having trouble trying to remove/reload a popup rad window with the correct content.  It keeps loading the same content that was there the last time.  I tried using ReloadOnShow = true but that didn't work.  Can someone help me please?

RadWindow

 

newWindow = new RadWindow();

 

 

newWindow.NavigateUrl =

"MassSelections.aspx?rnd=" + random.Next().ToString();

 

newWindow.DestroyOnClose =

true;

 

newWindow.ReloadOnShow =

true;

 

newWindow.OnClientClose =

"RefreshGrid";

 

 

RadWindowManager1.Windows.Add(newWindow);

 

RadWindowManager1.DataBind();

Thanks,
Dean

Georgi Tunev
Telerik team
 answered on 12 Aug 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?