RadTextBox Attribute

3 posts, 2 answers
  1. Jeroen Eikmans
    Jeroen Eikmans avatar
    50 posts
    Member since:
    May 2009

    Posted 25 Mar 2010 Link to this post


    I have a RadTextBox on my page.
    Using radTextBox.Attributes.Add("Key", "Value") I add some value i need to the control.

    I've been looking for a way where i can get that value in the ClientEvent OnTextChanged.
    The sender in the OnTextChanged-event (which is the RadTextBox i believe) doesn't have a method like get_attribute.

    Is there some other way to access this attribute client-side?

    Kind regards,
  2. Answer
    Dimo avatar
    8483 posts

    Posted 25 Mar 2010 Link to this post

    Hi Roel,

    Here is how to do it:

    <%@ Page Language="C#" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
            RadTextBox1.Attributes.Add("mykey", "myvalue");
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    <head runat="server">
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <telerik:RadTextBox ID="RadTextBox1" runat="server">
        <ClientEvents OnValueChanged="MyValueChanged" />
    <script type="text/javascript">
    function MyValueChanged(sender, args)

    Sincerely yours,
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Answer
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 25 Mar 2010 Link to this post


    I tried following code in order to get the attribute that we set from from code behind.


        function OnValueChanged(sender, args) { 

    Try this and see whether it is working fine for you.

Back to Top