This is a migrated thread and some comments may be shown as answers.

permanent text in rad textbox

1 Answer 102 Views
Input
This is a migrated thread and some comments may be shown as answers.
Baris
Top achievements
Rank 1
Baris asked on 15 Jan 2014, 02:09 PM
Hi,

I am using radtextbox in aspx page. I have a web service and it returns a string. I want to add these string to my textbox permanently. So when somebody click on my radtextbox they can't delete these string which already in textbox but they add characters on it. How can I do that?

thx.


1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 16 Jan 2014, 07:54 AM
Hi Baris,

One suggestion is that you can use a span and on that set the permanent value of the RadTextBox and place it inside the RadTextBox. So it is not possible to delete the permanent text and can add more text to it. Please have a look into the following sample code snippet.

ASPX:
<span id="Span1" runat="server"></span>
<telerik:RadTextBox ID="RadTextBox1" runat="server" Style="z-index: -1;">
</telerik:RadTextBox>

C#:
protected void Page_Load(object sender, EventArgs e)
{
    //set the permanent data to the span
    Span1.InnerText = "Demo";
}

CSS:
<style type="text/css">
    span
    {
        position: absolute !important;
        left: 10px !important;
    }
</style>

JavaScript:
<script type="text/javascript">
    function pageLoad() {
        var span = document.getElementById("Span1");
        var text = $find("<%=RadTextBox1.ClientID %>");
        for (var i = 0; i < 10; i++) {
            text._text += ' ';
        }
    }
</script>

Thanks,
Shinu.
Tags
Input
Asked by
Baris
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or