Question

I'm trying to get a hold of an attribute I've created on a Telerik RadTextBox in the code behind of a click event. I've seen it solved in Javascript, but not the .cs/.vb file. Hopefully my code will explain it better: HTML:

<telerik:RadTextBox runat="server" ID="rdtTest" measurement-type="3" />

Code behind:

    protected void btnSave_OnClick(object sender, EventArgs e)
    {
        RadTextBox rdtTest= (RadTextBox)item.FindControl("rdtTest");
        string m = rdtHead.Attributes("measurement-type");
    }

Visual Studio doesn't think that the Telerik RadTextBox can have an "attributes" method. Am I doing something wrong, or is it not supported in Telerik?

Was it helpful?

Solution

You can use this code

<telerik:RadTextBox ID="RadTextBox1" runat="server" /> 

In your code behind

var result = RadTextBox1.Attributes["yourKeyOfAttribute"];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top