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) {
开发者_如何学Python 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
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).
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.
精彩评论