Iron Speed Technical Forums
Register Latest Topics
 
 
 


Reply
  Author   Comment  
dozero

Registered:
Posts: 13
Reply with quote  #1 
I have created a basic show records page.  If there are no records, it displays nothing as expected.  I would like to display a message and a button that says "new record" instead of displaying nothing.

I am not sure how to go about doing this.  I am removing the default add record button from the actions button so the end user will not be able to use that.
timt

Avatar / Picture

Iron Speed MVP
Registered:
Posts: 556
Reply with quote  #2 
Hi

You can write a little custom code to check the record count and if 0 then show you own button.

1. Create a button and add to the table control (why not use the existing add button?).

2. In your code behind after the page has loaded ie   

public void LoadData()
{
  LoadData_Base();
  if( MyTableRecordControl.TotalRecords == 0 )
  {
      MyAddbutton.Visible = true;
      // add any comment to a label as well if needed
  }
  else
  {
     MyAddbutton.Visible = false;
  }
}
HTH

__________________
Tim Titchmarsh Iron Speed Consultant MVP
London UK based
+44 (0)1621 835002
http://www.lightspeeditsolutions.co.uk/dotnetarchitect
timt@dotnetarchitect.co.uk
timt@lsits.co.uk
dozero

Registered:
Posts: 13
Reply with quote  #3 

Perfect, that's what I needed.  My code is vb.net, here is what I ended up with:

Code:
Public Sub LoadData()

LoadData_Base()

 If (ACM2013TableControl.TotalRecords=0) Then
   NewProfileButton.Visible = TRUE
 Else
   NewProfileButton.Visible = FALSE
 End If

End Sub



mprindiville

Registered:
Posts: 17
Reply with quote  #4 
Is there a way to do something similar to this except instead of a value of 0.  Is is based on a field value(literal) like status = yes. 
JimiJ

Avatar / Picture

MVP Developer
Registered:
Posts: 1,958
Reply with quote  #5 
Yes, that can be done. Try this:

If (LiteralControlName.Text.Equals("Yes")) Then
NewProfileButton.Visible = TRUE
Else
NewProfileButton.Visible = FALSE
End If

Cheers,
Jimi J


__________________

  Jaime Jegonia
[jts_logo]

Iron Speed MVP Developer
 

". . . and whoever sows generously will also reap generously" 2 Cor 9:6

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