SetValue of textfield in RowExpander - Cannot read property 'setValue' of undefined

  1. #1

    SetValue of textfield in RowExpander - Cannot read property 'setValue' of undefined

    I am trying to set the value of a textfield in a rowexpander in codebehind or in js on AfterRender event listener, but I get

    Cannot read property 'setValue' of undefined
    Here is the textfield in the rowexpander:

    <ext:TextField runat="server" Name="notedown" FieldLabel="Note Under" ID="fnotedown">
           <Listeners>
                  <AfterRender Handler="if (form.record.data.Lid != null && form.record.data.Lid != '' )
                  {
                     setNoteUnder_js(form.record.data.id);
                  }" />
                                                                        
           </Listeners>
        </ext:TextField>
    JS:

    var setNoteUnder_js = function (fieldid){
                    #{DirectMethods}.setNoteUnder(fieldid,{
                        success: function (result) {
                            #{fnotedown}.setValue(result); //undefined error
                        }
                    });
                }
    Direct Method in Code Behind:

    [DirectMethod]
    	public string setNoteUnder(int fieldid)
    	{
    		DAL.CDMADataContext dc = new DAL.CDMADataContext();
    
    		var field = (from f in dc.CFormFields
    					 where f.cid == cid && f.id == fieldid
    					 select f).FirstOrDefault();
    
    		string units = null;
    
    		if (field.Lid != null && field.Lid != "")
    		{
    			
    			 units = units + " Gender: " + field.text1 + " Unit: " + field.text2;
    
    			 fnotedown.SetValue(units); //undefined error
    
    			 return units;
    			
    
    		}
    		return null;
    	}
  2. #2
    replace


    #{fnotedown}.setValue(result); //undefined error


    with


    App.fnotedown.setValue(result);


    see if that helps
    /Z

Similar Threads

  1. Replies: 2
    Last Post: Apr 17, 2015, 4:55 PM
  2. Replies: 5
    Last Post: Aug 16, 2013, 2:40 PM
  3. whats wrong in this code ? error in setValue property!
    By jhenriquecosta in forum 2.x Help
    Replies: 1
    Last Post: Jan 29, 2013, 5:06 PM
  4. Replies: 4
    Last Post: Jul 01, 2012, 3:04 AM
  5. [CLOSED] [1.0] SetValue() vs Reset() vs Value property assignment
    By pasion in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: May 13, 2010, 11:38 PM

Posting Permissions