.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How do i display a custom message when my ListBox is empty?

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :WPF

I've got a ListBox. Its ItemsSource is Data-Bound to a Dataset.

When there are entries in the Dataset, the ListBox displays them, and it doesn't look so bad.

The ListBox is big, so when its empty it looks weird on the Window.

What i want to do is to display a custom mesasge somewhere inside the listbox(maybe in the center) if there is nothing to display. But i've had no luck sofar.

How could i go about achieving this?

View Complete Post

More Related Resource Links

How do I display a custom error message if Authorize fails



I have a page that can only be accessed by "Admins". If a user who is NOT an admin tries to access the page, I'd like to do two things:

  1. Log the error to the database
  2. Send the user to my error page but display a custom message

I don't know where to handle the error logging because there doesn't seem to be a controller for the error page (I'm using Razor. Just created an Internet Application MVC3 project in VS 2010)

I also don't know how to customize the error message.

Could someone give me some pointers on this?

SQL Server: Display Your Data Your Way with Custom Renderers for Reporting Services


SQL Server 2005 Reporting Servicesis a great tool that offers a centralized approach to storing and rendering reports. It also lets users view and download reports without installing additional software. Plus, reports can be saved in any number of different formats using custom report renderers. In this article, the author will develop one such report renderer that outputs HTML reports, but the skills you'll learn can easily be used to create a renderer for Microsoft Word documents or any other format of your choosing.

James Yip

MSDN Magazine February 2005

ActiveX and Visual Basic: Enhance the Display of Long Text Strings in a Combobox or Listbox


The combobox and listbox controls in Visual Basic have no built-in support for displaying text strings that are too long to fit in the visible area of either control. This article describes several techniques to improve the readability of long strings in each control. The first technique uses tooltips to display a combobox or listbox item. The other techniques, which use various Windows APIs, include adding a horizontal scrollbar for a listbox and determining the necessary width of the longest string given the font attributes of the text. The required steps are described for both comboboxes and listboxes.

John Calvert

MSDN Magazine December 2000

How to Add Custom SOAP Headers Into The Server Response Message in WSE3.0?

Hi Dear All, Assuming I am the service provider, may i know how many ways are there to insert a custom header into the server response message? So far I tried several ways, and it can be done in custom SoapFilters (by playing with SOAPEnvelope object), and SoapExtension (SOAPMessage object). Just wondering if this could be done at web service class by specifying a SOAPHeader attribute, just like adding a SOAPHeader into the SOAP request message at consumer side? If can, it might be much smarter than SoapFilter and SoapExtension.   Thanks in advance!   Best Regards, Charles

How to display breakpoint and debug visual cues with custom activity designer based on WorkflowViewE

Hi,   I am developing custom activity designers based on "WorkflowViewElement" instead of "ActivityDesigner" in my xaml. It allows me to have greater control of the look and feel of the designer. However I noticed that with this approach, the breakpoint visual cue (Dark red solid circle that appears on the left side of the designer when you set breakpoint on the designer) is not visible. It works fine when you write your designed based on "ActivityDesigner". The same behavior happens to the debug visual cue when you debugging the WF. It appears as bright yellow rectangle surrounding the activity designer if you are based on "ActivityDesigner", but it is not available when your designer is based on"WorkflowViewElement". Any help is highly appreciated. Li

MessageSecurityException "Identity check failed for outgoing message" when using custom endpointaddr

Hi! I am currently developing a WCF service which will use ASP.NET Membership and RoleProvider as authentication/authorization. I followed the description in on this page http://msdn.microsoft.com/en-us/library/ff647294.aspx to do this, and everything works as expected when I try add a reference to my development service and uses that without any interaction. But, I want to be able to override the enpoint address in code since the server may be placed on other servers, but when I do this in my code (with the same enpointAddress stated in the client wcf file for testing purpose) I get a MessageSecurityException with this information: "Identity check failed for outgoing message. The expected DNS identity of the remote endpoint was 'localhost' but the remote endpoint provided DNS claim 'MyCert'. If this is a legitimate remote endpoint, you can fix the problem by explicitly specifying DNS identity 'MyCert' as the Identity property of EndpointAddress when creating channel proxy." I have search the net for information about this, and found that the only thing I had to do was to add a <dns value="MyCert" /> to my client wcf configuration, and everything should work. But it doesn't, I still get the same error. My server behavior configuration looks like this: <serviceCredentials> <serviceCertificate findValue="CN=MyCert" />

Best way to display data of a single column from a Sharepoint Custom List

I'm trying to create pages that will automatically populate with data pulled from a sharepoint list (like title, department, contact info, etc.).   I'm using publishing pages. What would be the easiest way to do this, and how would I specify which data to pull from the list? For example, the page would be set up like this: [Title:biology] [Department:biology] [Contact Info:biology]   and when the page loads, it would look like this: Biology Lab Biology Department 123-456-7890   I want it to just pull the data -- I don't want a list view or anything like that.  I need this page to look pretty, and I need the each column's data to show up in a very specific place. How could I make pages that would do that?

Empty ListBox Appearance

I've got a ListBox with ItemsSource = mycollection. Sometimes, my usercontrol (which contains the listbox) has got an empty list, and the effect is that this list is shown only with its border... how can I just make it invisible or with a single voice like "Empty List"... The ListBox is into a DataTemplate, so I don't know neither how to access it from code behind... thank you  

Custom listbox filter

Hi, I'm trying to create a multiselect listbox filter control.  I was using Josh Heyes filters but I'm upgrading to 4.0 and this is no longer compatible.  I have created a new UserControl which inherits from QueryableFilterUserControl, but I can't work out what I need to put into the GetQueryable method.  It's very similar to the ForeignKey filter, it's just that I want the user to be able to select multiple items in the list. Can anyone help? Thanks, Emma

How to get SPPageStatusSetter to actually display a status message

I have a event listener running on a list, with several possible conditions.  I want to use the status bar to update the user as a case happens.  I thought, that since the code is a event reciever/listener, that this would be considered server side code, and to make something appear on the status bar, I can use the SPPageStatusSetter.AddStatus method to show the message.  Yet, when I put in the method parameters, nothign  happens. (I did a statusbar= new SPpageStatusSetter(), statusbar.AddStatus("caller", "messgae", Yellow)) What am I missing?  Is this not considered server-side code, and I should use the other mechanism to set the status bar?  or? thanks rsRocky Sanders

Query Correlation faliure using custom Request/Reply Message Contract classes.

Hi,I have a service which is correlated by a Guid query. When I'm using designer created Message Content/Parameters feature for message definition, everithing working lika a charm. But If I define custom [MessageContract] Request/Reply classes (where request class has Guid SvcUID property for correlation), and choose'em as Message Content in the designer with proper CorrelatesOn definition of course, I have got a service exception about correlation query faliure. Have you folks tried to apply your custom [MessageContract] classes for correlated communication?

Display Images from a Custom List's Attachment Field

i need to show each item on the list with image that was uploaded to its attachments field. the idea is that this list is a news list and will be show as a grid with the news and their corresponding attached image. i tried to add a custom column of type Picture, but it only allows to have a hyperlink added. i need the ability to upload the image on a new item creation form.   if there is a way to display it that would be great, if not please recommend a way to accomblish what i have explained.     thanks  

Display Null if Column is empty

is it possible to display Nullif my sql data is null while binding it with gridview in asp.net<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical" Height="185px" Width="244px"> <RowStyle BackColor="#EEEEEE" ForeColor="Black" /> <FooterStyle BackColor="#CCCCCC" ForeColor="Black" /> <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" /> <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" /> <AlternatingRowStyle BackColor="Gainsboro" /> </asp:GridView> string command="select * from user1"; DataSet ds1 = new DataSet(); ds1 = ob.getall(command); GridView1.DataSource = ds1; GridView1.DataBind(); for example like this

Display Message

I want to display message such that when user fill register form, and after compliting all fields a message i.e Record Inserted Successfully. plz help me out....

Null reference message Custom Error page

how come a Null session value that is called, doesn't get directed to the Custom Error Page?

How to display a prompt message from gridview_deleting event

Hello, i am following a code example to prompt user before delete and have a reference to the commandfield Delete linkbutton.But something is missing because nothing happen when executed.  Gridview1_Deleting linkBtn.OnClientClick = "return confirm('Are you sure you want to delete this entry?');" end sub <Columns>                        <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />

Display Managed Metadata with Custom Search

Hello everyone, I made a custom Search page in VS 2010 and exported it to Sharepoint Foundation with Search Server. I want to use it to search for custom folders i have created which have a metadata field, a descriptive text. I have created a managed property and mapped it to the metadata of the folder content type. Also, the metadata shows up in the library view. Now, when i want the Metadata to show up in the results page of my search, i get "Field of property with name mappedfieldname wasnt found in the selected data source" error. when i pick a field like title instead, it works. but with a vast number of other fields i get the same error, like filename or filetype. i tried this on three servers, one of them with sharepoint server on it, everytime getting the same error. i did crawls everytime, i created the managed property, mapped it, i dont know what the problem is. help would be greatly appreciated.   Edit: i use datagrid to display the results,         i can also use the managed property in the search query; like filename:"1.txt", but i cant display the very same property in the result grid.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend