Iron Speed Technical Forums
Register Latest Topics
 
 
 


Reply
  Author   Comment  
mprindiville

Registered:
Posts: 17
Reply with quote  #1 
Hi,

i'm trying to conditionally set a button control based on a field value.

Looks like this:

public override void LoadData()
{
base.LoadData();

// Find the record row the field value is on.
if ((AdminTblSiteTableControl.SiteTypeGeneral.Text == "Underwater"))
{
ViewRowButton1.Visible = false;
}
else
{
ViewRowButton1.Visible = true;
}
}

However I get an error "does not contain a definition for 'SiteTypeGeneral' "

Any ideas on how I can fix this?

Rexxrally

Registered:
Posts: 235
Reply with quote  #2 
What you need to do is override the DataBind method, not the LoadData. And you need to use "this" instead of referring to the TableControl by name.

Try this:

public override void DataBind()
{
    base.DataBind();
    // Find the record row the field value is on.
     if ((this.SiteTypeGeneral.Text == "Underwater"))
     {
         this.ViewRowButton1.Visible = false;
     }
     else
     {
         this.ViewRowButton1.Visible = true;
     }
}   
mprindiville

Registered:
Posts: 17
Reply with quote  #3 

thanks for the response Rexxrally.  Unfortunately the error persist here as well.

Show_TblSite_Table.AdminTblSiteTableControl' does not contain a definition for 'SiteTypeGeneral' and no extension method 'SiteTypeGeneral' accepting a first argument of type UI.Controls.Show_TblSite_Table.AdminTblSiteTableControl' could be found (are you missing a using directive or an assembly reference?)
--------------------------------------------------------------------------------------------------------------------
  public override void DataBind()
{
    base.DataBind();
    // Find the record row the field value is on.
     if ((this.SiteTypeGeneral.Text == "Underwater"))
     {
         this.ViewRowButton1.Visible = true;
     }
     else
     {
         ViewRowButton1.Visible = false;
     }
}

Rexxrally

Registered:
Posts: 235
Reply with quote  #4 
Maybe your schema is out of sync with your database.

Under the "Tools" menu, do a "Synchronize Database Schema" and then under "Build", do a  "Rebuild All".
mprindiville

Registered:
Posts: 17
Reply with quote  #5 
I ended up putting it on the Set() function similar to what was suggested here.

http://sjc.ironspeed.com/post/conditionally-display-editdelete-buttons-7038270#gsc.tab=0

thank you!
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.

Download Iron Speed Designer

Terms of Service Privacy Statement