This is a migrated thread and some comments may be shown as answers.

Eanble the Text box in Client side

6 Answers 269 Views
Input
This is a migrated thread and some comments may be shown as answers.
Jebamalai
Top achievements
Rank 1
Jebamalai asked on 01 Oct 2008, 07:06 AM
Dear All,

I have the RadInput (Text box) control in the multi line text format.

I am passing its client ID to a JavaScript function, This function is called on checking a check box.

In the JavaScript, I have given the code like this:

commentBox.Enable();

but it is not enabled and it is throwing an error "Object dosen't support this property"

This error is also for the disabling the text box.

Can any one tell me why this happens and the solution for it?

Thanks a lot in advance.

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 01 Oct 2008, 07:48 AM
Hi,

Try enabling or disabling the RadTextBox as shown below.


ASPX:
<asp:CheckBox ID="CheckBox3"   runat="server" onclick="OnClientClick()" /> 
        <telerik:RadTextBox ID="RadTextBox1" Enabled="false" runat="server"
        </telerik:RadTextBox> 

JS:
function OnClientClick() 
     { 
      var txtbx = $find("<%= RadTextBox1.ClientID %>"); 
      //to enable 
      txtbx.enable(); 
      //to disable 
      //txtbx.disable(); 
     } 


Thanks
Shinu.
0
Jebamalai
Top achievements
Rank 1
answered on 01 Oct 2008, 09:31 AM
Dear Shinu,

Thanks for your valuable and timely reply.

But I have treid the same, but it is throwing an error 'null'  object error.

I have this textbox inside the User Control.

Will this cause the issue?
0
Shinu
Top achievements
Rank 2
answered on 01 Oct 2008, 12:18 PM
Hi,

Is your TextBox and CheckBox in the same usercontrol? Sending your aspx will be more good.

Shinu.
0
Jebamalai
Top achievements
Rank 1
answered on 01 Oct 2008, 01:26 PM
Dear Shinu,

The following is the table in the user control
            <table>
                <tr>
                    <td class="approval" colspan="4">
                        <asp:Label id="lblLocked" runat="server" CssClass="approvalRedText"></asp:Label></td>
                </tr>
                <tr>
                    <td class="approval" colspan="4">
                        <asp:label id="lblApprovalTime" runat="server"></asp:label></td>
                </tr>
                <tr>
                    <td class="approval" style="width: 3px">
                        <asp:RadioButton id="radApprove" runat="server" GroupName="approveReject"></asp:RadioButton></td>
                    <td class="approval" style="width: 3px">
                        <asp:RadioButton id="radForward" runat="server" GroupName="approveReject"></asp:RadioButton></td>
                    <td class="approval" style="width: 3px">
                        <asp:RadioButton id="radReject" runat="server" GroupName="approveReject"></asp:RadioButton></td>
                    <td class="approval" style="width: 3px">
                        <asp:CheckBox id="cbFinalize" runat="server"></asp:CheckBox></td>
                </tr>
                <tr>
                    <td colspan="4">
                        <table style="width: 172px">
                            <tr>
                                <td class="approval">
                                    <asp:Label id="lblSendTo" runat="server"></asp:Label></td>
                                <td class="approval" style="width: 313px">
                                    <rad:RadComboBox EnableViewState="true" ID="ddlUsers" Skin="Web20" runat="server" Height="100px" Width="168px">
                                    </rad:RadComboBox>
                                </td>
                                <td class="approval" style="width: 313px">
                                </td>
                            </tr>
                            <tr>
                                <td valign="middle">
                                    <asp:Label CssClass="approval" id="lblComments" runat="server"></asp:Label></td>
                                <td class="approval" style="width: 313px">
                                    <telerik:RadTextBox ID="rtbComments" TextMode="MultiLine" Height="50px" Width="200px" runat="server" EmptyMessage="Enter your comment here..." LabelCssClass="radLabelCss_Inox" MaxLength="150" Skin="Office2007">
                                    </telerik:RadTextBox>
                                    </td>
                                <td class="approval" style="width: 313px">
                                    <asp:Button id="btApproval" onclick="btApproval_Click" runat="server"></asp:Button></td>
                            </tr>
                        </table>
    <asp:Label ID="lblNote" runat="server" Text="Label"></asp:Label></td>
                </tr>
            </table>


The JS code is:
function UnFinalize
    (theCheckbox, finalizeBox, radApprove, radForward , radReject, dropdown, commentBox ,
            lblComments, lblSendTo , btApproval , panApproval)
    {
var txtbx = $find("<%= rtbComments.ClientID %>"); 
   if ( ! theCheckbox.checked )
   {



       if ( ! confirm('Are you sure you want to unfinalize this approval?')  )
       {
          theCheckbox.checked = true;
          return;
       }
       else
       {
                 for( i = 0; i < approvalControls.length; i++ )
            {
                var el = $get(approvalControls[i]);
                if ( el != null )
                {
                        el.parentElement.disabled = false; 
                }
            }
          theCheckbox.checked = false;
          radApprove.disabled = false;
          radForward.disabled = false;
          radReject.disabled = false;
          dropdown.Enable();
          lblComments.disabled = false;
          lblSendTo.disabled = false;
          btApproval.disabled = false;
          btApproval.value = 'Send';
          panApproval.disabled = false;
      //to enable 
      txtbx.enable(); 
          alert(6);
       }
    }
    else
    {
          theCheckbox.checked = true;
          radApprove.disabled = true;
          radForward.disabled = true;
          radReject.disabled = true;
          dropdown.Disable();
      //to disable 
      //txtbx.disable(); 

          lblComments.disabled = true;
          lblSendTo.disabled = true;
          btApproval.disabled = true;
          btApproval.value = 'Send';
          panApproval.disabled = true;
          for( i = 0; i < approvalControls.length; i++ )
            {
                var el = $get(approvalControls[i]);
                if ( el != null )
                {
                        el.parentElement.disabled = true;
                }
            }
    }
}

The code behind file is :
cbFinalize.Attributes.Add("onclick""javascript:UnFinalize(this,"+ cbFinalize.ClientID+"," + radApprove.ClientID +<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "," + radForward.ClientID + "," + radReject.ClientID + "," + ddlUsers.ClientID + "," + rtbComments.ClientID + ","+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lblComments.ClientID+","+ lblSendTo.ClientID +","+ btApproval.ClientID+","+ panApproval.ClientID&nbsp; +");"); 

0
Jebamalai
Top achievements
Rank 1
answered on 03 Oct 2008, 11:18 AM
Dear Shinu,

Or else, can you tell me how to make the comment box read only or not, through css such that I will try with it.

But the same code is working for the drop down.
0
Jebamalai
Top achievements
Rank 1
answered on 11 Oct 2008, 03:48 AM
Dear Shinu,

Can you provide me some help to fix the issue?

Tags
Input
Asked by
Jebamalai
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Jebamalai
Top achievements
Rank 1
Share this question
or