Eric
Eric

Reputation: 8078

Telerik Rad Textboxes and javascript issue

I am simply trying to fill a Rad Text box with server data in javascript. The data is placed inside of the textbox but it is not visible until i click on the Rad Textbox.

  function pickItem(name, sku, plu, nameBox, sBox, pBox) {

                sBox.value = sku;
                pBox.value = plu;
                nameBox.value = name;
                $find('mdlPopup').hide();
            }

I'm sending the parameter in code for the click of a button inside of a Gridview as follows:

  button.Attributes.Add("onClick", string.Format("pickItem('{0}',{1},{2},{3},{4},{5});",
                e.Row.Cells[0].Text.Trim(), e.Row.Cells[1].Text.Trim(), e.Row.Cells[2].Text.Trim(), FormViewAccident.FindControl("prodBox").ClientID,
                FormViewAccident.FindControl("SBox").ClientID, FormViewAccident.FindControl("PBox").ClientID));

Again, this works except for the fact that i have to click inside of the textbox. It works perfect if i use a regular asp.net textbox which is inconsistent for this project

Upvotes: 0

Views: 2447

Answers (2)

Dick Lampard
Dick Lampard

Reputation: 2266

Also make sure that nameBox is a reference to the client RadTextBox object, not its DOM element (hint: use the $find method instead of $get).

Upvotes: 2

SLaks
SLaks

Reputation: 887275

You need to use Telerik's client-side API to change the value.

Change nameBox.value = name to nameBox.set_value(name).

For more information, see the demo.

Upvotes: 1

Related Questions