| <telerik:GridCheckBoxColumn DataField="BasePer" DataType="System.Boolean" HeaderText="BasePer" SortExpression="BasePer" UniqueName="BasePer" > |
| </telerik:GridCheckBoxColumn> |
| <telerik:GridCheckBoxColumn DataField="HighPer" DataType="System.Boolean" HeaderText="HighPer" SortExpression="HighPer" UniqueName="HighPer"> |
| </telerik:GridCheckBoxColumn> |
| <telerik:GridCheckBoxColumn DataField="LowPer" DataType="System.Boolean" HeaderText="LowPer" SortExpression="LowPer" UniqueName="LowPer"> |
| </telerik:GridCheckBoxColumn> |
{"d":{"__type":"user","name":"james","family":" smith"}}
I created a radtoolbar AT RUNTIME
But the javascript $find method does not find it.
That is the javascript code:
function pesquisar(e) {
if (e.keyCode == 13)
{
//radtoolbar is a runtime created RadToolBar
//but can´t be found...
var toolBar = $find("<%= radtoolbar.ClientID %>");
//here the toolBar IS NULL and causes an error.
var item = toolBar.findItemByText('Pesquisar');
if (Telerik.Web.UI.RadToolBarButton.isInstanceOfType(item)) {
item.click();
}
}
}
I tried the getelementbyid method, but this does not return a Telerik.Web.UI.RadToolBarButton, but a [ObjectHtml DivElement].
So, the toolBar.findItemByText('Pesquisar') can´t be executed.
the javascript code:
function pesquisar(e) {
if (e.keyCode == 13)
{
// the getElementById does not return a RadToolBarButton
var toolBar = document.getElementById("radtoolbar");
var item = toolBar.findItemByText('Pesquisar');
if (Telerik.Web.UI.RadToolBarButton.isInstanceOfType(item)) {
item.click();
}
}
}
But when I use a design time RadToolBar created, the $find method works fine
| <asp:ImageButton ID="b_RemoveMod_{@mID}" runat="server" ImageUrl="~\Images\12.png" AlternateText="Remove Module" CssClass="hideMe" CommandName="RemoveModule" CommandArgument="{@mID}" OnCommand="ImageButton_onCommand" onClientClick="radconfirm('Are you sure you want to delete the module and return it to inventory?', confirmRemoveMod, 300, 140, null, 'Confirm Module Removal');" /> |
| function confirmRemoveMod(arg) { |
| if (arg == true) { |
| __doPostBack('', 'ImageButton_onCommand#RemoveModule'); |
| } |
| } |
| private void SetControlReadOnly(Control cntrl) |
| { |
| if (cntrl.HasControls()) |
| { |
| foreach (Control nestedContrl in cntrl.Controls) |
| { |
| SetControlReadOnly(nestedContrl); |
| } |
| } |
| else |
| { |
| if (cntrl is RadComboBox) |
| { |
| RadComboBox ddl = (RadComboBox)cntrl; |
| ddl.Enabled = false; |
| } |
| else if (cntrl is RadInputControl) |
| { |
| SetRadInputControlReadOnly((RadInputControl)cntrl); |
| } |
| else if (cntrl is CheckBox) |
| { |
| CheckBox chk = ((CheckBox)cntrl); |
| chk.Enabled = false; |
| } |
| else if (cntrl is TextBox) |
| { |
| TextBox txt = ((TextBox)cntrl); |
| txt.Enabled = true; |
| txt.ReadOnly = true; |
| txt.ForeColor = System.Drawing.Color.Black; |
| } |
| } |
| } |
| private void SetRadInputControlReadOnly(RadInputControl input) |
| { |
| input.Enabled = true; |
| input.ReadOnly = true; |
| //input.BorderStyle = BorderStyle.None; |
| input.DisabledStyle.ForeColor = System.Drawing.Color.Black; |
| } |