Question

I have an ASPxGridView bound from code behind. The column giving me problems has the following definition:

<dx:GridViewDataTextColumn Caption="Code Special" FieldName="Code" VisibleIndex="14"
                                HeaderStyle-Wrap="true" Visible="false">
                                <EditFormSettings Visible="false" VisibleIndex="14" CaptionLocation="Top" />
                                <PropertiesTextEdit Width="100%" ClientInstanceName="codeSpecialProject">
                                </PropertiesTextEdit>
                            </dx:GridViewDataTextColumn>

I use the PropertiesTextEdit's ClientInstanceName in javascript to locate the textobx control when a row is in edit mode and set a specific value. Javascript below:

      function OnGetRowValues(values) {
        document.getElementById(codeSpecialProject.uniqueID).value = values;
    }

The code above works in comptability view (IE 7), but throws a null exception in Chrome and other versions of IE. Line with error:

 document.getElementById(codeSpecialProject.uniqueID) // is null

I am using the DevExpress 9.3 version. I think it maybe associated with how DevExpress renders the aspx.

But why is it only working on IE7?

Was it helpful?

Solution

The problem was that

codeSpecialProject.uniqueID

returns the name tag of the control not the id tag.

IE 7 has an issue that allows document.getElementById to also identify controls by their name tag, not just their id. Due to this issue (bug) of IE 7, it worked in IE 7, but failed in all other browsers.

More details on the issue here.

Solution

The ClientInstanceName of the PropertiesTextEdit (which is a ASPxClientTextBox)

 <PropertiesTextEdit Width="100%" ClientInstanceName="codeSpecialProject">
                            </PropertiesTextEdit>

created for use in JavaScript

codeSpecialProject

has several client methods. To change its text, one should use the following method:

codeSpecialProject.SetValue('text')

More on devexpress client methods here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top