6 Answers, 1 is accepted
It would be helpful if you could post a short example of what you are trying to do.
I have Telerik grid on form and when I edit or insert new data I use custom edit form inside grid, like in this example(http://demos.telerik.com/aspnet/prometheus/Grid/Examples/DataEditing/UserControlEditForm/DefaultCS.aspx).
Here is the code from custom edit form(ascx) and it is openinig inside grid when I edit data.
<td class="style3" align="left">
<asp:TextBox id="txtProduct" runat="server"
Text='<%# DataBinder.Eval( Container, "DataItem.Product" ) %>'>
</asp:textbox>
</td>
<td align="left">
<telerik:RadComboBox ID="cboBuyer" runat="server" Width="100px" Height="200px" HighlightTemplatedItems="True"
ItemRequestTimeout="500" AllowCustomText="True" NoWrap="true" ShowWhileLoading="true"
DropDownWidth="180px" ShowToggleImage="True" ShowMoreResultsBox="true" EnableLoadOnDemand="True"
MarkFirstMatch="True" OnItemsRequested="cboBuyer_ItemsRequested" EnableVirtualScrolling="true"
Skin="WebBlue" EnableViewState="False" OnClientSelectedIndexChanged="HandleEndChanging">
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</telerik:RadComboBox>
</td>
Here is the function from main form (aspx), and it returns value from selected combobox(cboBuyer)
<script type="text/javascript" language="javascript">
function HandleEndChanging(sender, args) {
var item = eventArgs.get_item();
var inputElement = item.get_comboBox().get_inputDomElement();
alert("Change to new item('" + sender.get_text() + "')");
}
</script>
How can I pass the selected value from combobox to txtProduct.
Probably it is simple solution but I don't know ho to solve it.
Thank you!
You can try the following:
<script type="text/javascript" language="javascript"> |
function HandleEndChanging(sender, args) { |
var item = args.get_item(); |
var txt = $get("txtProduct"); |
txt.value = sender.get_value(); |
} |
</script> |
I hope this helps.
All the best,
Veselin Vasilev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Hi,
Unfortunately I am getting error
"Microsoft JScript runtime error: 'null' is null or not an object"
on line
"txt.value = sender.get_value();"
It seems to be problem with finding textbox "var txt = $get("txtProduct");"
Please help :)
Regards
I apologize, here is the correct code:
<script type="text/javascript" language="javascript"> |
function HandleEndChanging(sender, args) { |
var item = args.get_item(); |
var comboID = sender.get_id(); |
var txtID = comboID.replace("cboBuyer", "txtProduct") |
var txt = $get(txtID); |
txt.value = sender.get_value(); |
} |
</script> |
Best wishes,
Veselin Vasilev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Evertyhing works excellent!
Thank you and best regards