AjaxUpdatedControl RadMultiPage problem

3 posts, 0 answers
  1. David
    David avatar
    2 posts
    Member since:
    Nov 2011

    Posted 30 Nov 2011 Link to this post

    Hi,

    I've a radtabstrip with three radtab and three radmultipage. The problem is on the event textchanged for a radtextbox located on the first radmultipage. On textchanged of this radtextbox, I fill another radtextboxes of the same radmultipage. Once the radtextboxes are filled with the values, if I put the mouse over the radtextboxes these radtextboxes increase. I've also a radskinmanager and if I change the skin, all the radtextboxes become ok and the mouse over has no effect. I attach a picture with the three situations: the initial form, the form with the radtextboxes bigger and the form with a new skin applied. If I remove the radmultipage from the ajaxupdatedcontrol of the radajaxmanager, the radtextboxes don't change on mouse over. I put the code with only one radtab and only one radmultipage because the problem is the same. How can I solve this?

    Thanks in advance.

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default_test.aspx.vb" Inherits="_Default_test" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title>Ofertas Rittal</title>
        <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
    </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>
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            //Put your JavaScript code here.
        </script>
        </telerik:RadCodeBlock>
        <label style="font-family: Calibri; font-size: small; font-weight: 700; height: 32px;">Skin:</label>
        <telerik:RadSkinManager ID="RadSkinManager1" Runat="server" ShowChooser="True"
            Skin="Windows7">
        </telerik:RadSkinManager>
               
        <telerik:RadButton ID="RadButton1" runat="server" Text="Guardar preferencias">
        </telerik:RadButton>
        <telerik:RadFormDecorator ID="FormDecorator1" runat="server" DecoratedControls="all"></telerik:RadFormDecorator>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" />
                        <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        </telerik:RadWindowManager>
        <div>
            <br />
            <telerik:RadTabStrip ID="RadTabStrip1" runat="server"
                MultiPageID="RadMultiPage1" Height="26px" Width="500px" SelectedIndex="1">
                <Tabs>
                    <telerik:RadTab runat="server" PageViewID="RadPageView1"
                        Text="Cabecera">
                    </telerik:RadTab>
                </Tabs>
            </telerik:RadTabStrip>
            <telerik:RadMultiPage ID="RadMultiPage1" Runat="server"
                Height="64px" Width="500px" SelectedIndex="0" Font-Names="Calibri"
                Font-Size="Small">
                <telerik:RadPageView ID="RadPageView1" runat="server" BorderStyle="Outset">
                    <div class="inputs">
                        <br />
                        <telerik:RadTextBox ID="RadTextBox5" Runat="server" ReadOnly="True"
                            Text="Cliente:"
                            Width="75px" Font-Bold="True" Font-Names="Calibri" Font-Size="Small"
                            BorderWidth="0px" BackColor="Transparent" BorderColor="Transparent"
                            TabIndex="-1">
                        </telerik:RadTextBox>
                        <telerik:RadMaskedTextBox ID="TB_Cod_cliente" Runat="server" Mask="########"
                            Width="60px" AutoPostBack="True">
                        </telerik:RadMaskedTextBox>
                        <telerik:RadTextBox ID="TB_Company" Runat="server"
                            Width="300px">
                        </telerik:RadTextBox>
     
                        <br />
                        <br />
                        <telerik:RadTextBox ID="RadTextBox6" Runat="server" ReadOnly="True"
                            style="font-family: Calibri; font-weight: 700" Text="Dirección:"
                            Width="75px" Font-Bold="True" Font-Names="Calibri" Font-Size="Small"
                            BorderWidth="0px" BackColor="Transparent" TabIndex="-1">
                        </telerik:RadTextBox>
                        <telerik:RadTextBox ID="TB_Address1" Runat="server"
                            Width="365px">
                        </telerik:RadTextBox>
     
                        <br />
                        <telerik:RadTextBox ID="RadTextBox7" Runat="server" ReadOnly="True"
                            style="font-family: Calibri; font-weight: 700" Text=""
                            Width="75px" Font-Bold="True" Font-Names="Calibri" Font-Size="Small"
                            BorderWidth="0px" BackColor="Transparent" TabIndex="-1">
                        </telerik:RadTextBox>
     
                        <telerik:RadTextBox ID="TB_Address2" Runat="server"
                            Width="365px">
                        </telerik:RadTextBox>
     
                        <br />
                        <br />
                        <telerik:RadTextBox ID="RadTextBox8" Runat="server" ReadOnly="True"
                            style="font-family: Calibri; font-weight: 700" Text="Cód. postal:"
                            Width="75px" Font-Bold="True" Font-Names="Calibri" Font-Size="Small"
                            BorderWidth="0px" BackColor="Transparent" TabIndex="-1">
                        </telerik:RadTextBox>
                        <telerik:RadMaskedTextBox ID="TB_Zip" Runat="server" Mask="#####"
                            Width="35px">
                        </telerik:RadMaskedTextBox>
                             
                        <telerik:RadTextBox ID="RadTextBox4" Runat="server" ReadOnly="True"
                            style="font-family: Calibri; font-weight: 700" Text="Población:"
                            Width="65px" Font-Bold="True" Font-Names="Calibri" Font-Size="Small"
                            BorderWidth="0px" BackColor="Transparent" TabIndex="-1">
                        </telerik:RadTextBox>
     
                        <telerik:RadTextBox ID="TB_City" Runat="server"
                            Width="240px">
                        </telerik:RadTextBox>
     
                        <br />
                        <br />
                        <telerik:RadTextBox ID="RadTextBox10" Runat="server" ReadOnly="True"
                            style="font-family: Calibri; font-weight: 700" Text="Provincia:"
                            Width="75px" Font-Bold="True" Font-Names="Calibri" Font-Size="Small"
                            BorderWidth="0px" BackColor="Transparent" TabIndex="-1">
                        </telerik:RadTextBox>
                        <telerik:RadComboBox ID="DD_State" runat="server" DataSourceID="Provincias"
                            DataTextField="descripcion" DataValueField="descripcion">
                        </telerik:RadComboBox>
                           
                        <telerik:RadTextBox ID="RadTextBox17" Runat="server" ReadOnly="True"
                            style="font-family: Calibri; font-weight: 700" Text="Contacto:"
                            Width="70px" Font-Bold="True" Font-Names="Calibri" Font-Size="Small"
                            BorderWidth="0px" BackColor="Transparent" TabIndex="-1">
                        </telerik:RadTextBox>
                        <telerik:RadComboBox ID="DD_Contacto" runat="server" AutoPostBack="True">
                        </telerik:RadComboBox>
                        <br />
                        <br />
                        <hr width="490px" />
                        <br />
                    </div>
                </telerik:RadPageView>
     
            </telerik:RadMultiPage>
            <asp:SqlDataSource ID="Provincias" runat="server"
                ConnectionString="<%$ ConnectionStrings:OfflineEDConnectionString %>"
                SelectCommand="SELECT UPPER([descripcion]) AS descripcion FROM [Provincias_Lov_Informes] ORDER BY [descripcion]">
            </asp:SqlDataSource>
     
        </div>
        </form>
    </body>
    </html>

    Imports Telerik.Web.UI
    Imports System.Data.SqlClient
    Imports System.Data
     
    Partial Class _Default_test
        Inherits System.Web.UI.Page
        Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
            If Not IsPostBack Then
                retreive_preferences()
            End If
        End Sub
        Protected Sub TB_Cod_cliente_TextChanged(sender As Object, e As System.EventArgs) Handles TB_Cod_cliente.TextChanged
            load_company_data(TB_Cod_cliente.Text)
        End Sub
        Protected Sub load_company_data(ByVal cod_cli As String)
            If cod_cli.Length > 0 Then
                RadTabStrip1.SelectedIndex = 0
                RadMultiPage1.SelectedIndex = 0
     
                Dim conn As New SqlConnection()
                conn.ConnectionString = ConfigurationManager.ConnectionStrings("OfflineEDConnectionString").ConnectionString
     
                Dim cmd As New SqlCommand
                cmd.CommandType = CommandType.Text
                cmd.CommandText = "SELECT company_name,address_1,address_2,zip,city,State_ from company where cod_cliente=@cod_cliente"
                cmd.Connection = conn
                ' Create a SqlParameter for each parameter in the stored procedure.
                Dim codclienteParam As New SqlParameter("@cod_cliente", cod_cli)
                cmd.Parameters.Add(codclienteParam)
     
                Dim found As Boolean = False
                Dim reader As SqlDataReader
                Dim previousConnectionState As ConnectionState = conn.State
                Try
                    If conn.State = ConnectionState.Closed Then
                        conn.Open()
                    End If
                    reader = cmd.ExecuteReader()
                    Using reader
                        While reader.Read
                            ' Process SprocResults datareader here.
                            TB_Company.Text = reader.GetValue(0).ToString
                            TB_Address1.Text = reader.GetValue(1).ToString
                            TB_Address2.Text = reader.GetValue(2).ToString
                            TB_Zip.Text = reader.GetValue(3).ToString
                            TB_City.Text = reader.GetValue(4).ToString
                            DD_State.SelectedValue = reader.GetValue(5).ToString
                            found = True
                        End While
                    End Using
                Finally
                    If previousConnectionState = ConnectionState.Closed Then
                        conn.Close()
                    End If
                End Try
     
                If found = False Then
                    DD_Contacto.DataSource = CreateDataSource(cod_cli)
                    DD_Contacto.DataTextField = "nombre_completo"
                    DD_Contacto.DataValueField = "contact_id_text"
                    DD_Contacto.DataBind()
                End If
            End If
        End Sub
        Function CreateDataSource(ByVal cod_cliente As String) As ICollection
            Dim dt As New DataTable
            Dim dr As DataRow
     
            dt.Columns.Add(New DataColumn("contact_id_text", GetType(String)))
            dt.Columns.Add(New DataColumn("nombre_completo", GetType(String)))
     
            dr = dt.NewRow()
            dr(0) = "-1"
            dr(1) = ""
            dt.Rows.Add(dr)
     
            dr = dt.NewRow()
            dr(0) = "0"
            dr(1) = "_Nuevo registro_"
            dt.Rows.Add(dr)
     
            Dim conn As New SqlConnection()
            conn.ConnectionString = ConfigurationManager.ConnectionStrings("OfflineEDConnectionString").ConnectionString
     
            Dim cmd As New SqlCommand
            cmd.CommandType = CommandType.Text
            cmd.CommandText = "SELECT contact_id_text,full_name from contact where cod_cliente=@cod_cliente"
            cmd.Connection = conn
            ' Create a SqlParameter for each parameter in the stored procedure.
            Dim codclienteParam As New SqlParameter("@cod_cliente", cod_cliente)
            cmd.Parameters.Add(codclienteParam)
     
            Dim found As Boolean = False
            Dim reader As SqlDataReader
            Dim previousConnectionState As ConnectionState = conn.State
            Try
                If conn.State = ConnectionState.Closed Then
                    conn.Open()
                End If
                reader = cmd.ExecuteReader()
                Using reader
                    While reader.Read
                        ' Process SprocResults datareader here.
                        dr = dt.NewRow()
                        dr(0) = reader.GetValue(0).ToString
                        dr(1) = reader.GetValue(1).ToString
                        Try
                            dt.Rows.Add(dr)
                        Catch ex As Exception
                        End Try
                    End While
                End Using
            Finally
                If previousConnectionState = ConnectionState.Closed Then
                    conn.Close()
                End If
            End Try
     
            Dim dv As New DataView(dt)
            dv.Sort = "nombre_completo"
            Return dv
        End Function
     
     
        Protected Sub RadButton1_Click(sender As Object, e As System.EventArgs) Handles RadButton1.Click
            Dim usuario As String = Context.Request.ServerVariables("AUTH_USER")
            If usuario.Split("\").Count > 1 Then
                usuario = usuario.Split("\")(1)
            End If
     
            If usuario.Length > 0 Then
                Dim conn As New SqlConnection()
                conn.ConnectionString = ConfigurationManager.ConnectionStrings("OfertasConnectionString").ConnectionString
     
                Dim cmd As New SqlCommand
                cmd.CommandType = CommandType.Text
                cmd.CommandText = "SELECT count(*) from Preferencias where usuario=@usuario"
                cmd.Connection = conn
                ' Create a SqlParameter for each parameter in the stored procedure.
                Dim userParam As New SqlParameter("@usuario", usuario)
                cmd.Parameters.Add(userParam)
     
                Dim found As Integer = 0
                Dim reader As SqlDataReader
                Dim previousConnectionState As ConnectionState = conn.State
                Try
                    If conn.State = ConnectionState.Closed Then
                        conn.Open()
                    End If
                    reader = cmd.ExecuteReader()
                    Using reader
                        While reader.Read
                            ' Process SprocResults datareader here.
                            found = reader.GetValue(0).ToString
                        End While
                    End Using
                Finally
                    If previousConnectionState = ConnectionState.Closed Then
                        conn.Close()
                    End If
                End Try
     
                If found = 0 Then
                    insert_preferences(usuario, "skin", RadSkinManager1.Skin)
                Else
                    update_preferences(usuario, "skin", RadSkinManager1.Skin)
                End If
            End If
        End Sub
     
        Protected Sub update_preferences(ByVal username As String, ByVal field As String, ByVal value As String)
            Dim conn As New SqlConnection()
            conn.ConnectionString = ConfigurationManager.ConnectionStrings("OfertasConnectionString").ConnectionString
     
            Dim cmd As New SqlCommand
            cmd.CommandType = CommandType.Text
            cmd.CommandText = "update preferencias set " + field + "=@value where usuario=@usuario"
            cmd.Connection = conn
            ' Create a SqlParameter for each parameter in the stored procedure.
            Dim valueParam As New SqlParameter("@value", value)
            cmd.Parameters.Add(valueParam)
     
            Dim userParam As New SqlParameter("@usuario", username)
            cmd.Parameters.Add(userParam)
     
            Dim rowCount As Integer
            Dim previousConnectionState As ConnectionState
            previousConnectionState = conn.State
            Try
                If conn.State = ConnectionState.Closed Then
                    conn.Open()
                End If
                rowCount = cmd.ExecuteNonQuery()
            Finally
                If previousConnectionState = ConnectionState.Closed Then
                    conn.Close()
                End If
            End Try
     
            If rowCount = 0 Then
                RadWindowManager1.RadAlert("Error al guardar las preferencias", 330, 100, "Error!", "alertCallBackFn")
            Else
                RadWindowManager1.RadAlert("Preferencias guardadas correctamente", 330, 100, "Ok", "alertCallBackFn")
            End If
        End Sub
        Protected Sub insert_preferences(ByVal username As String, ByVal field As String, ByVal value As String)
            Dim conn As New SqlConnection()
            conn.ConnectionString = ConfigurationManager.ConnectionStrings("OfertasConnectionString").ConnectionString
     
            Dim cmd As New SqlCommand
            cmd.CommandType = CommandType.Text
            cmd.CommandText = "insert into preferencias (usuario," + field + ") values (@usuario,@value)"
            cmd.Connection = conn
            ' Create a SqlParameter for each parameter in the stored procedure.
            Dim valueParam As New SqlParameter("@value", value)
            cmd.Parameters.Add(valueParam)
     
            Dim userParam As New SqlParameter("@usuario", username)
            cmd.Parameters.Add(userParam)
     
            Dim rowCount As Integer
            Dim previousConnectionState As ConnectionState
            previousConnectionState = conn.State
            Try
                If conn.State = ConnectionState.Closed Then
                    conn.Open()
                End If
                rowCount = cmd.ExecuteNonQuery()
            Finally
                If previousConnectionState = ConnectionState.Closed Then
                    conn.Close()
                End If
            End Try
     
            If rowCount = 0 Then
                RadWindowManager1.RadAlert("Error al guardar las preferencias", 330, 100, "Error!", "alertCallBackFn")
            Else
                RadWindowManager1.RadAlert("Preferencias guardadas correctamente", 330, 100, "Ok", "alertCallBackFn")
            End If
        End Sub
     
        Protected Sub retreive_preferences()
            Dim usuario As String = Context.Request.ServerVariables("AUTH_USER")
            If usuario.Split("\").Count > 1 Then
                usuario = usuario.Split("\")(1)
            End If
     
            If usuario.Length > 0 Then
                Dim conn As New SqlConnection()
                conn.ConnectionString = ConfigurationManager.ConnectionStrings("OfertasConnectionString").ConnectionString
     
                Dim cmd As New SqlCommand
                cmd.CommandType = CommandType.Text
                cmd.CommandText = "SELECT skin from Preferencias where usuario=@usuario"
                cmd.Connection = conn
                ' Create a SqlParameter for each parameter in the stored procedure.
                Dim userParam As New SqlParameter("@usuario", usuario)
                cmd.Parameters.Add(userParam)
     
                Dim skin As String = ""
                Dim reader As SqlDataReader
                Dim previousConnectionState As ConnectionState = conn.State
                Try
                    If conn.State = ConnectionState.Closed Then
                        conn.Open()
                    End If
                    reader = cmd.ExecuteReader()
                    Using reader
                        While reader.Read
                            ' Process SprocResults datareader here.
                            skin = reader.GetValue(0).ToString
                        End While
                    End Using
                Finally
                    If previousConnectionState = ConnectionState.Closed Then
                        conn.Close()
                    End If
                End Try
     
                If skin.Length > 0 Then
                    RadSkinManager1.Skin = skin
                End If
            End If
        End Sub
    End Class
  2. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 05 Dec 2011 Link to this post

    Hi David,

    The experienced behavior might be caused by the RadFormDecorator which seems to add some additional spacing to the RadTextBox controls on hover when specific skin is used. Please try to remove the RadFormDecorator to verify whether this is the cause of your issue and if so, you should increase the width of the div  which is holding the content of the pageview.

    Regards,
    Dimitar Terziev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. David
    David avatar
    2 posts
    Member since:
    Nov 2011

    Posted 05 Dec 2011 Link to this post

    Hi Dimitar,

    Thank you very much for your response. I've solved this problem with the solution explained in the following post:

    http://www.telerik.com/community/forums/aspnet-ajax/form-decorator/radtextbox-width-changes-on-hover-when-decorated-with-radformdecorator-q3-2011.aspx

    With this javascript code, the page works perfect.

    Thanks again for your help.

    David.
Back to Top