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

Top 5 Contributors of the Month
Post New Web Links

How do I make 2 controls take up the space in a horizontal row?

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :JQuery

I've got to make a small change to my first WPF app.  Right now it has a label with a textbox immediately below it.  The textbox can allow the user to enter data into it.  What the users want is to see different comments to the right of this textbox.

So this is what I thought I would do.  I'll wrap everything up in a stackpanel with a horizontal orientation; perhaps use a wrap panel instead.  And I thought I would replace the label wrapping the textbox with a groupbox instead.  The comment that is to appear to the right of the textbox, may not have any data in it.  If it doesn't, then I thought I would not show it.  This makes it tricky, because what I would like to do is have the groupbox surrounding the textbox take up the full width of "row", rather than have an empty space where the comment would be.  (BTW, I'm thinking of putting the comment into a textblock control and wrapping that with another groupbox.)  How do I do what I want to do?  Should I use a grid control instead?  Ideally, if there's anything in the comments I want the textbox (in it's groupbox) to take up half of that "row", and the textblock (in it's groupbox) to take up the other half, with appropriate margins, but if there's no comment, then the textbox (in it's groupbox) takes up the whole "ro

View Complete Post

More Related Resource Links

Using CSS to space label controls

I am trying to lay out the ASP.NET controls on a web page using CSS.  For some reason, I am not able to add space above or below a label control using the margin-top and margin-bottom properties. The margin-left and margin-right properties work fine, and the margin-top and margin-bottom properties work with other controls, such as drop-down lists and text boxes. So why won't they work with label controls?

Make validation controls trigger only not clicking on submit button and not on other navigational bu


I have required validation controls on a page.  If the user got to this page by mistake and wants to go to a different section of the website using the navigational buttons; required validators are triggered and it will not let the user navigate away.  How do I get validators to trigger only when a submit button is clicked?


Thanks in advance!

How make Controls scalable when resizing Window?


How do I make my Controls scalable in relation to the size of the Form?

I mean, when the Anchors of a Panel on a Form are set to all 4 borders then the Panel Width/Height properties change when changing the Form size but the Left/Top position of the Panel is fixed and not changing. What properties do I have to set to what value to also make the Panel's Left/Top position move when the undelying Form size is changed?



Making your own controls - how to make them powerfully modifiable so anyone can use a control templa


If I look at a template for an expander, it always has to have a ContentPresenter in its control template and the control knows to use that for the content shown when the expander is expanded.  From there you can template out the control in all sorts of cool ways. 

A textbox's control templates need a scrollviewer with x:Name=PART_ContentHost for example.

The expander is fine with an unnamed control template, but the textbox requires a named scrollviewer.  I haven't messed around with putting multiple content presenters in an expander's control template and I currently have no idea what that would do.  This aspect of building my own controls is still quite foggy to me.  If I were to build a control, how do I determine if it looks for a named element in the control template (ala the textbox) or if it just finds a content presenter etc?

What if I wanted my new control to always contain several elements?

For example, with my current set of questions I am working on a resizable element.  I want that to always contain a draggable left and right boundary, as well as a togglable UI element for each of those boundaries that will toggle certain behaviors when I drag a specifc size and resize the control.  So ideally, I would want to define all of those things in a control template.  I would like it to

Using jQuery to HIDE controls leaves an empty space


If one use the jQuery .hide function as follows:

if ($('#<%= rblBlastOccurrences.ClientID %> input:checked').val() == '4763')

$('#<%= pnlBlastWaveExperience.ClientID %>').hide();

How is one to recover/shrink the empty space?

How can I make controls inside a Template visible to Code-behind


I have created a custom control that implements Templates (based on Panel controls) ... I can do a FindControl to locate imbedded controls.  This allows me to get and set values in the imbedded controls, but I want to be able to reference the imbedded controls like they are properties of the associated panel.  Here is a sample of how my custom control now works:

<cc:CustomControl ID="myCustomControl" runat="server">
<asp:TextBox ID="myTextBox" runat="server"></asp:TextBox>

I can do the following (where my custom control has given the panel hosting the template the name "myPanel"):

Dim txt As TextBox = myCustomControl.myPanel.FindControl("myTextBox")
txt.Text = "Some text to put in TextBox"

What I want to do is:

myCustomControl.myPanel.myTextBox.Text = "Some text to put in TextBox"

How to make server controls browser compatible

The article How to make server controls browser compatible was added by suresh.mekkattil on Saturday, May 14, 2011.

Introduction In modern web development, we need to check the browser compatibility for our web pages. This can include changing the css classes, style to fix the design issues. Using ASP.NET we can check the browser compatibility without writing a single

Binding WPF Controls to an Entity Data Model

In this interview, programming writer, McLean Schofield, demonstrates how to bind WPF controls to an entity data model, using Visual Studio 2010 Beta 1. You can also learn more in the topic: Walkthrough: Binding WPF Controls to an Entity Data Model.

Custom Controls in C# .NET

Embedding user controls in a Windows form is just like adding a simple button or text box that are already provided with .NET. These basic controls were written essentially like you code your own controls. Typically the controls you design are to be used in multiple forms or to modularize your code. These reasons help reduce the amount of code you have to type as well as make it easier for you to change your implementation. There should almost never be any reason to duplicate code because it leaves a lot of room for bugs. So, implementing functionality specific to your control in the control's source code is a good idea. This reduces code duplication as well as modularize your code, which is a good programming guideline.

Accessing the different controls inside a GridView control

how we can access a particular control which resides inside a GridView control. In this article I will show you how you can access different controls inside a GridView control. We will see how we can access a TextBox control, a DropDownList control and a ListBox control. If you are working with ASP.NET 1.X then you might want to check out my article Accessing Different Controls Inside a DataGrid.

Using ASP.NET 3.5's ListView and DataPager Controls: Displaying Data with the ListView

Prior to ASP.NET 3.5, developers who needed to display a set of records could choose between the GridView, DataList, and Repeater controls. The GridView provides rich data features, but has a very boxy layout; the DataList and Repeater allow for a more flexible layout, but lack the "point and click" data features found in the GridView, DetailsView, and FormView controls. The ListView bridges the gap between layout flexibility and built-in data features.

This article, the first in a series of articles on the ListView and DataPager controls, looks at the ListView's many available templates and illustrates how to display data. Read on to learn more!

Binding WPF Controls to an Entity Data Model

In this interview, programming writer, McLean Schofield, demonstrates how to bind WPF controls to an entity data model, using Visual Studio 2010 Beta 1. You can also learn more in the topic: Walkthrough: Binding WPF Controls to an Entity Data Model.

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

How to programmatically add controls to Windows forms at run time by using Visual C#

Create a Windows Forms Application
Start Visual Studio .NET or Visual Studio 2005 or a later version, and create a new Visual C# Windows Application project named WinControls. Form1 is added to the project by default.
Double-click Form1 to create and view the Form1_Load event procedure.
Add private instance variables to the Form1 class to work with common Windows controls. The Form1 class starts as follows:

Dynamically Create Controls in ASP.NET by Using Visual C# .NET

This article demonstrates how to dynamically create a control for an .aspx page. The sample project does the following:
Creates two TextBox controls.
Verifies that the contents (TextBox.text) and the attributes of the TextBox are saved across posts to the server.
Illustrates handling events that are posted by a dynamically-created control

Dynamically Create Controls in ASP.NET with Visual Basic .NET

This step-by-step article describes how to dynamically create controls for an ASPX Web page.

The sample project does the following:
It creates two TextBox controls.
It verifies that the TextBox contents (TextBox.text) and attributes are saved across posts to the server.
It describes how events that are posted by a dynamically created control are handled.

Creating Dialogs and Ribbon Controls for SharePoint 2010

SharePoint 2010 provides new user interface components, such as server ribbons, and the new dialog platform. As a developer, you can create controls for the server ribbon and dialog boxes for the dialog platform.
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