Quantcast
Viewing latest article 2
Browse Latest Browse All 2

unable to get property 'style' of undefined or null reference

I have this code 

A. inside ContentPlaceHolder is script type

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">

<script type="text/javascript" src="JavaScript.js"></script>

<dx:ASPxFormLayout ID="ASPxFormLayout1" runat="server" ClientInstanceName="ASPxFormLayout1">

B. Have a combobox, and need change visibility of text box depending index on combo box

<dx:ASPxComboBox runat="server" ID="ASPxFormLayout1_concepto" DataSourceID="SqlDataSource1" TextField="Descripcion" ValueField="Conceptos_id" TextFormatString="{0}" ClientInstanceName="clientComboBox"><ClientSideEvents LostFocus ="OnclientComboBox_Init" /><Columns> <dx:ListBoxColumn FieldName="Descripcion" /> <dx:ListBoxColumn FieldName="Iva" /> </Columns> <ValidationSettings SetFocusOnError="True"> <RequiredField ErrorText="Seleccione un concepto de gasto" IsRequired="True" /> </ValidationSettings> </dx:ASPxComboBox>

C. Have a textbox

<dx:ASPxTextBox ID="ASPxFormLayout1_iva" runat="server" Width="170px" ClientInstanceName="ivatextbox" style="visibility:visible" > <ValidationSettings SetFocusOnError="True"> <RegularExpression ValidationExpression="\d+" ErrorText="*" /> <RequiredField IsRequired="True" /> </ValidationSettings> </dx:ASPxTextBox>

D. In javascript.js file have

function OnclientComboBox_Init(s, e)
{ ChangeComboColors(); }

function OnclientComboBox_EndCallback(s, e) {
ChangeComboColors(); clientComboBox.SetSelectedIndex(-1);
}

function OnButton_Click(s, e) {
clientComboBox.PerformCallback(); }

function ChangeComboColors() {
var v = document.getElementById("<%=ASPxFormLayout1_iva.ClientID%>"); v.style.visibility="hidden" }

Problem:

When combo box lostfocus event fire ChangeComboColors() have the next error 

unable to get property 'style' of undefined or null reference

Can somebody help me please?

Thanks


Viewing latest article 2
Browse Latest Browse All 2

Trending Articles