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

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

Listbox layout issue

Posted By:      Posted Date: October 16, 2010    Points: 0   Category :WPF

I have a listbox that contains expanders as its child elements.  When I expand one of the child elements the listbox grows as I would hope and becomes taller.  The problem I have is that when I collapse that expander, the listbox doesn't reduce it's size back down.  I need my listbox to always only use up the space occupied by its children.  So I want it to grow if the children get bigger but to reduce its size when the children are again made smaller.  Can I do this with xaml via properties or a clever control template, or am I going to need to do it via code? 

Here is an example of the xaml that shows what it currently does.

<Border BorderThickness="1"

View Complete Post

More Related Resource Links

ASP.net 3.5 layout issue

Greeting, I have asp.net content page that has more than 30 asp.net controls. all the control set with style="position:absolute" I know it is not good practice for ASP.NET web page globalization using style="position:absolute. Now is there a way to convert my current asp.net page layout to be fit with most of the internet browser. I read this article http://msdn.microsoft.com/en-us/library/95xdeeha%28VS.90%29.aspx that explain this issue but it is really hard to go and modify each control. In case there is no way what I should chnage in my control style propriety to make internet browsers

Panel Layout and Visual Studio issue - what is recommended path?



I am working with .NET 3.5 (VS 2008). In one of my tabs, I have added two panels. Each panel takes up the whole tab area (dock=full).  At any one time only one panel is visible. Depending on what the user does, one panel will be hidden while the other is visible.  My problem is that when I am in Visual Studio in the design mode, I can only see the panel that was added last.  The first panel is below that, so I can't work with the panel to add other components (buttons, labels, ect).  I tried to right-click the top panel and select "Send to back" but that does not make the bottom panel visible.  The only thing I can do is undock the top panel and move it to the side while I work on the underneath panel.

Does anyone know of a better way to access the underneath panel in design mode or if there is a more appropriate way to create stacked panels (think deck of cards).

Any thoughts would be greatly appreciated - Peter

Sharepoint 2007 Survey - View response - Firefox layout issue



I've got a survey running on a Sharepoint 2007 site but when I open the view response page (DispForm.aspx) using Firefox 3 the layout is incorrect - The question text is not wrapping and so I've got one massively wide column.

In both Safari and IE this isn't a problem, it works fine - the problem is Firefox capability.

Has anyone come across a fix for this? I've spent the last couple of hours searching on the net with little success.

Thanks in advance

Issue with page layout when moving sites to a different web application


I am moving sites from one web application to another but having issues with the default.aspx and other aspx pages in publishing sites.

Moving from http://myCom:8080/SiteCollection/Site/Subsite --> http://myCom:8888/sites/SiteCollection/Site/Subsite

In the default.aspx page, this line referencing the page layout does not get converted properly after import (I'm using stsadm export/import)

<mso:PublishingPageLayout msdt:dt="string">http://myCom:8080/_catalogs/masterpage/WelcomeLinks.aspx, /_catalogs/masterpage/WelcomeLinks.aspx</mso:PublishingPageLayout>

is changed to

<mso:PublishingPageLayout msdt:dt="string">http://myCom:8888/_catalogs/masterpage/WelcomeLinks.aspx, /_catalogs/masterpage/WelcomeLinks.aspx</mso:PublishingPageLayout>

When default.aspx is displayed it gets a File Not Found error. I have to manually change it to http://myCom:8888/sites/SiteCollection/_catalogs/masterpage/WelcomeLinks.aspx to get it to display.

How can I get it to convert to /sites/Collection/ automatically during the import process?

Any help is wel

Combobox inside Listbox binding issue

I am lost...

I have the following two classes (simplified)

Class Parent
    String Description{get;set;} 
    ObservableCollection<Children> ListOfChildren = new ObservableCollection<Children>();

Class Children
    public string Name{get;set;}

And the following two lists :

public List<Parent> ListOfParents = new List<Parent>();
public static List<Children> StaticListOfChildren=new List<Children>();

Now I have a list in XAML, I set the datacontext of this list to the "ListOfParents" (in code) and set the ItemSource="{Binding}"
All works fine so far. Inside this list I have another list containing the "ListOfChildren" list. The itemtemplate of this list contains a combobox. This combobox binds to the "StaticListOfChildren" list. The problem is now I can't get the selecteditem of the combobox to bind to the Children item in the ListOfChildren.... Can anyone help ??

<ListBox x:Name="lbMaterialsBuildup" HorizontalContentAlignment="Stretch" ItemsSource="{Binding}">

ListBox tricky to set in a DataGrid/GridView

Listboxes are very tricky to set selected items in grid - there is no real nice way to do it. It would have been great if Microsoft included a property that accepts an array or comma separated values - or anything! But they only allow each item in the list to be selected individually. The way to do this in a grid is a bit messy, but it is fairly simple to implement. When a row is created (as per the event), select the items of the listbox as per the datagrid source data:

Working with DropDownList and ListBox Controls in ASP.NET

"In my application i am using dropdownlist to display all categories from a table. When the user clicks this control I display all records in that category. Category table also contains column called color.

I wanted display some categories in dropdown list different color and others in different color using ASP.NET."-Anonymous

IsapiModule Error 500 Issue


I am about exhausted trying to figure out this error:

HTTP Error 500.0 - Internal Server Error

Description: The page cannot be displayed because an internal server error has occurred.

Error Code: 0x8007007b

Notification: ExecuteRequestHandler

Module: IsapiModule

Requested URL: http://localhost:80/ReportServer

Physical Path: c:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer

When I enable Failed Request Tracing Rules and view the log output I am supposing that the actual problem is in the 2nd call where there are 2 backslashes before the actual filename in the specified path:


CALL_ISAPI_EXTENSION DllName="C:\Windows\Microsoft.NET\Framework\v2.0.50727\\aspnet_isapi.dll"


MVC2 issue - Stuck. Trying to create a cms with nested partials


I am currently trying to display multiple items on a single page. I am not sure as to how to tackle this. What I have is a database table that has all the page data in. I have this run as a PagesController and this works fine. However what I would like to do is, if say the Products page is selected via the menu, I want to pull back not only the Products page html but also get all the products, and even be able to pull them through via category. I was trying to use a partial view, but I can't get it to work. The same would be for other pages, having partial views to display the other content, ie if Gallery is selected, the page html for Gallery shows and it then can push to a partial view that pulls all the gallery images from the gallery db table and so on. 

Maybe I am tackling this the wrong way. I have the pages stored in the db to allow for a CMS system I have setup. Maybe I need to use models for all the other items(Products, Gallery, Videos and such) and use the partial for the page html?

Any help would be greatly appreciated as I am confused.

xpath issue


Hi i am using xpath to loop through each node,

the xml is below i can get the value of "link" but i cant get the thumbnail value, have you got any ideas how i can do this, my code is below.



     <link>test 1</link>
     <media:thumbnail url="http://test.com/image.jpg" height="75" width="75" />



     <link>test 2</link>
     <media:thumbnail url="http://test.com/image.jpg" height="75" width="75" />


public void FindLinks(XPathNavigator p_xPathNav, DataTable dt)
            //run the XPath query
            XPathNodeIterator xPathIt = p_xPathNav.Select("//item");

            //use the

User validation Issue in xlsx file



I am validating user from Login.xlsx file. It was working fine by validating email and password from that file. For testing i got new file same contents of file but added some more user names.

So after that when i validating the user i am getting the following error "Data type mismatch in criteria expression".

But when i replaced the new to old one it is working fine. The contens of both files are the same. So why this kind of error happened.


Multiple Paramatized Threading issue


I need the funcitonality to have two methods run concurrently of each other and the parent thread (aka the method that makes these two calls) to halt until BOTH are done. After the threads are done, I need to perform logic on the returns of the method, so it is essential for both of them to be complete before the parent thread continues. I have searched the internet and tried varous attacks, and I always come up with the same result, this being the parent thread continues operation after the first thread finishes, leaving the second thread running.  Can someone show me a quick example of how I can do this. I have tried checking states of the threads, halting the threads, but I always end up with the same thing. Any help would be great. Thanks.

Data Truncation issue with Enterprise Library Logging WriteLog stored Proc


Hi ,

I'm using Enterprise Library Logging  feature for logging. The issue i am facing is when the Logging message is too large(more than 65534 chars) ,complete data  is not logged in the Formatted Mesage column which is  of data Type nText .

I am able insert complete data if i try inserting from Sql insert Query from sql management studio. Do i need to add any attributes to data base listener or do i need to change the sp.

 Is there any way to increase the WriteLog stored proc param size in EnterpriseLibrary.Logging config file ? . Please let me know.


Thanks In Advance.

Persist data in a dynamically populated ListBox in a user control


Hi All,

I am trying to persist data in a dynamically populated ListBox in a user control. Here are the details

I have a user control which contains a a listBox and button. On Page_Load of user control I am populating the ListBox control with some values. On Click of button, I am trying to fetch the values which I have selected in ListBox. Though this seems very simple and straight forward I am unable to fetch values.

My Page_Load Function

void Page_Load(object sender, EventArgs e)










My Click Function

Protected Void Button1_Click(object sender, EventArgs e)


       string strValue = listBox.SelectedValue



I have placed brake point at Page_Load and on click function, I am seeing that the moment the breakpoin

Word Automation Issue in Windows Server 2008 Hosting



The problem I am posting here is that I was facing nearly 2 weeks around. Any body comes with this stuff please help.

Word Automation in sample ASP.NET(C#) application.

I am using Microsoft.Office.Inetrop.Word Assembly for automation. Here I am reading a XXX.dot template file and fill the contents with dynamic data.

When i am executing my code in localhost:someportnumber the automation is working fine and I could get expected result and when I am hosting in my inetmgr(Windows XP is my OS) it is also working fine.

But the problem is that when I am hosting in my production server(Windows Server 2008 Standard Edition) I am not able to perform automation and results in the following error.

Data: System.Collections.ListDictionaryInternal
Message: Word has encountered a problem.
Source: Microsoft Word

The code gets failed in the following line:

ApplicationClass wordApp = new Microsoft.Office.Interop.Word.ApplicationClass();

Document wordDoc = wordApp.Documents.Add(ref oTemplate, ref oFalse, ref oMissing, ref oMissing); // Error in this line

I cannot able to proceed further. Can anybody please help me in solving this issue?

Thank you.

With Regards,


If Statement Issue



This is very strange to me. I have spent 2hrs looking into this inside out , but dont seem to get it

I have an if statement that inserts data into the database. But i check to make sure the name is not entered twice. Now when the name is already in the db, then it should insert else put out a message saying its already in the db

My code works fine except that  when its not in the db, its inserts but still puts out the message that says "Name is already in use" Not sure if am not seeing something. But thought i did bring it to the forum. Here is my code...Pretty simple

Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click

        Dim objConnection As SqlConnection
        Dim objCommand As SqlCommand
        Dim strSQLQuery1 As String


        ' If there's nothing to Add for then don't search
        ' o/w build our SQL Query and execute it.
        If String.IsNullOrEmpty(txtAdd.Text) Or Leadbank.SelectedValue = "000" Then


Toolbox: Issue and Defect Tracking, Automate IT Tasks, and More


In this issue, issue and defect tracking, automating IT tasks, and more.

Scott Mitchell

MSDN Magazine December 2006

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