Hi,
When there are no records to display, I get the correct message "No records to display". However, when i display the insert/edit screen to enter new records, the message still appears on the bottom of the screen. This is fine. But when i add a new record, I want
that message to go away. I understand that it would go away if I did a rebind after I entered the first record, but in my add data scenerio, i only rebind when I am done adding records and I am ready to redisplay the grid.
To correct this, I saw a telerik post (http://www.telerik.com/community/forums/aspnet/grid/changing-no-records-to-display-text.aspx ) using the a "NoRecordsTemplate : ITemplate" class. Now, my message of "No Equipment to List as yet" is used.
1) Now when I add that first record, I can blank out the message, BUT, instead of blank, the default "No records to display" appears. Am I missing another step ?
2) Using that ITemplate class scenerio seems like a lot just to blank a message when a record is added. is thier a way to do this with
less code (not that its a lot of code, but).
3) I am populating and blanking out the "No Equipment to List as yet" message according to whether their was any data read in my needdatasource on the last rebind. I am doing this in my ItemDataBound method, is this the right place to do it ?
Here is how I define the class
Here is how and where I change the text (equipmentGrid is my RadGrid)
When I initialize the iqText to " ", is when the default message seems to appear.
(Ignore the passing of the System.DrawingColor.Brown while iqText gets the " ", it dosnt matter for now).
thanks for your help
When there are no records to display, I get the correct message "No records to display". However, when i display the insert/edit screen to enter new records, the message still appears on the bottom of the screen. This is fine. But when i add a new record, I want
that message to go away. I understand that it would go away if I did a rebind after I entered the first record, but in my add data scenerio, i only rebind when I am done adding records and I am ready to redisplay the grid.
To correct this, I saw a telerik post (http://www.telerik.com/community/forums/aspnet/grid/changing-no-records-to-display-text.aspx ) using the a "NoRecordsTemplate : ITemplate" class. Now, my message of "No Equipment to List as yet" is used.
1) Now when I add that first record, I can blank out the message, BUT, instead of blank, the default "No records to display" appears. Am I missing another step ?
2) Using that ITemplate class scenerio seems like a lot just to blank a message when a record is added. is thier a way to do this with
less code (not that its a lot of code, but).
3) I am populating and blanking out the "No Equipment to List as yet" message according to whether their was any data read in my needdatasource on the last rebind. I am doing this in my ItemDataBound method, is this the right place to do it ?
Here is how I define the class
| /* 090825b Need this class to emulate the NoRecordsTemplate |
| * so that we can control when and what message to display |
| * when no equipment records exist yet */ |
| class iqNoRecordsTemplate : ITemplate |
| { |
| string iqText; |
| System.Drawing.Color iqColor; |
| public iqNoRecordsTemplate(string text,System.Drawing.Color Color) |
| { |
| iqText=text; |
| iqColor = Color; |
| } |
| public void InstantiateIn(Control container) |
| { |
| Label lbl = new Label(); |
| lbl.ID = "Label1"; |
| lbl.Text = iqText; |
| lbl.ForeColor = iqColor; |
| container.Controls.Add(lbl); |
| } |
| } |
Here is how and where I change the text (equipmentGrid is my RadGrid)
| if (Session["AnyDataRead"] == "No") //090815a |
| { |
| ftbox.Text = "0"; |
| // Create new No Records Template on the fly from iqNoRecordsTemplate() |
| // No records found messages. |
| iqText = "No Equipment to List as yet"; // 090825b |
| equipmentGrid.MasterTableView.NoRecordsTemplate = new iqNoRecordsTemplate(iqText, System.Drawing.Color.Brown); // 090825b |
| } |
| else |
| { |
| ftbox.Text = equipmentGrid.PageSize.ToString(); |
| iqText = " ";// 090825b |
| equipmentGrid.MasterTableView.NoRecordsTemplate = new iqNoRecordsTemplate(iqText, System.Drawing.Color.Brown); // 090825b |
| } |
(Ignore the passing of the System.DrawingColor.Brown while iqText gets the " ", it dosnt matter for now).
thanks for your help