Oct 29, 2008, 1:01 PM
How to set ReadOnly property to a textfield?
Hi, I know maybe this is a fool question, but i'm having problems to do it.
What i want to do is this:
I have a window to allow the user editing a row from the grid. Now i want to reuse the same window to show the information of the row like a detail; the window will show the same information like when editing, but with the textfields and textareas with Readonly property set True (currently i'm setting Enabled=false), but when i try to do this i got this error:
<H2>Object reference not set to an instance of an object. </H2>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
To do this I added a listener and inside the Click event the text is disabled, but that's when i get the error. Her is the code:
Thanks in advance!
What i want to do is this:
I have a window to allow the user editing a row from the grid. Now i want to reuse the same window to show the information of the row like a detail; the window will show the same information like when editing, but with the textfields and textareas with Readonly property set True (currently i'm setting Enabled=false), but when i try to do this i got this error:
<H2>Object reference not set to an instance of an object. </H2>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
To do this I added a listener and inside the Click event the text is disabled, but that's when i get the error. Her is the code:
<ext:Button ID="btnVerDetalle" Icon="comment" Text="Ver Detalle" runat="server" Enabled="false">
<AjaxEvents>
<Click OnEvent="btnVerDetalle_Click" Before="return #{GridComentarios}.hasSelection();">
<UserParams>
<ext:Parameter Name="ComentarioSeleccionado" Value="#{GridComentarios}.hasSelection()? #{GridComentarios}.selModel.getSelected().id:-1" Mode="Raw" />
<ext:Parameter Name="Nombre1" Value="#{GridComentarios}.selModel.getSelected().data['strNombre1']" Mode="Raw" />
<ext:Parameter Name="Nombre2" Value="#{GridComentarios}.selModel.getSelected().data['strNombre2']" Mode="Raw" />
<ext:Parameter Name="Apellido1" Value="#{GridComentarios}.selModel.getSelected().data['strApellido1']" Mode="Raw" />
<ext:Parameter Name="Apellido2" Value="#{GridComentarios}.selModel.getSelected().data['strApellido2']" Mode="Raw" />
<ext:Parameter Name="Contenido" Value="#{GridComentarios}.selModel.getSelected().data['strContenido']" Mode="Raw" />
</UserParams>
<EventMask ShowMask="true" Target="CustomTarget" CustomTarget="#{GridComentarios}.body"/>
</Click>
</AjaxEvents>
<Listeners>
<Click Handler="#{exttxtComentarioCrear}.disable();" />
</Listeners>
</ext:Button>
One more thing, when i explained what i wanted to do i said i wanted to set Readonly=true, but i dont know if there is a method to do it; like disable method, if there is please tell me.Thanks in advance!