I'm creating the list view programmatically using the following code:
SPView myview = list.Views.Add(name, fields, query, 10, true, false);
how can I change the "There are no items to show in this view of the..." message using code?
Prior to SP 2013, common way of doing this was to use XSL template overrides. But in SP 2013, this can also be done using JSLink and CSR. Example:
(function () {
var overrideCtx = {};
overrideCtx.Templates = {};
overrideCtx.Templates.OnPreRender = csrNoListItem;
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
})();
function csrNoListItem(ctx) {
ctx.ListSchema.NoListItem = "Your own message";
}
Source: http://www.idubbs.com/blog/2015/jslink-csr-to-override-there-are-no-items-to-show-in-this-view/
UPDATE
SPView
has ViewEmpty
property. Try setting this property to your custom message.