Rad textbox getting lost on mouse over

4 posts, 1 answers
  1. Ebenezer
    Ebenezer avatar
    39 posts
    Member since:
    Dec 2012

    Posted 17 Mar 2013 Link to this post

    I am using the code below to show/hide a Radtextbox on item selected from  RadCombobox. For some reason the Radtextbox is disappearing on mouse over.
    aspx file 
    --------------------
    <td class="rowcontent">
    <telerik:RadComboBox ID="ddIdentifiedBy" runat="server" DataTextField="FullName" DataValueField="UserId"
      Font-Bold="False" Font-Names="Arial" Font-Overline="False" ForeColor="Black"  OnClientSelectedIndexChanged="OnClientSelectedIndexChanged">                                                                      
     </telerik:RadComboBox>                                                                     
      <telerik:RadTextBox ID="txtIdentifiedBy" runat="server" Style="margin-left:50px; visibility:hidden;">
       </telerik:RadTextBox>
        </td>
    <script type="text/javascript">
        function OnClientSelectedIndexChanged(sender, args) {
            var textbox = $find("<%= txtIdentifiedBy.ClientID %>");
            if (args._item._text == "Other") {
                textbox._element.style.visibility = "visible";
            }
            else {
                textbox._element.style.visibility = "hidden";
            }
        }
    </script



    code behind to for the RadComboBox
    -------------------------------------------------

      ddIdentifiedBy.Items.Insert(1, new RadComboBoxItem("Other"));
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 17 Mar 2013 Link to this post

    Hello Ebenezer,

    One suggestion is to try the same functionality from server-side code as follows.

    ASPX:
    <telerik:RadComboBox ID="RadComboBox1" runat="server" DataSourceID="SqlDataSource1" AutoPostBack="true"
        DataTextField="ContactName" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged">          
    </telerik:RadComboBox>
    <telerik:RadTextBox ID="RadTextBox1" runat="server" Visible="false">
    </telerik:RadTextBox>

    C#:
    protected void RadComboBox1_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {
            if (RadComboBox1.SelectedItem.Text == "Other")
            {
                RadTextBox1.Visible = true;
            }
        }

    Thanks,
    Princy.
  3. Ebenezer
    Ebenezer avatar
    39 posts
    Member since:
    Dec 2012

    Posted 18 Mar 2013 Link to this post

    Hi Princy,
    I have tried your suggestion but this time the RadTextBox doesn't even show up. I think if I explain what I am trying to do, you may suggest something better. All I need is either allow the users to enter names which are not in the RadComBox and have it insert into a column in the database so when they click saved and come back they can see what they entered. I am trying to achieve this by Inserting "Other" as an option so when they click "Other" the textbox becomes visible so they can enter they text and click save. I can I achieve same by using AllowCustomText, but I don't see any example using Linq
  4. Ebenezer
    Ebenezer avatar
    39 posts
    Member since:
    Dec 2012

    Posted 18 Mar 2013 Link to this post

    Fixed Thanks alot 
Back to Top