.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

DataGridComboBoxColumn bound to an enum w/ text converter

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

I'm trying to get a DataGridComboBoxColumn to bind to a property that is an value of an enum.  If I use AutoGenerateColumns=True, it does it automatically.  I know that I shouldn't have to create a static resource.  With auto generating columns it shows the name of the enum value selected.  Those don't have spaces in them, but are well described; therefore, I'd also like to get a string version of it the enum.  Any ideas how to do this?  Even if we can just solve the first part of my question; that would be nice.

<DataGrid Grid.Row="2" ItemsSource="{Binding Path=Users}" AutoGenerateColumns="False" >
        <DataGridTextColumn Header="Username" Binding="{Binding Name}"/>
        <DataGridTextColumn Header="Password" Binding="{Binding Password}"/>
        <DataGridComboBoxColumn Header="User Type" SelectedItemBinding="{Binding Type}" />

View Complete Post

More Related Resource Links

DataTrigger bound to a datebound property using a converter not working.


Hi all, this will sound like a simple problem but I am really stumped!

I'm trying to create a TextBlock with a style that collapses when the text is "" or null. So in the style there's a DataTrigger bound to Text using a Converter that provide a boolean test for "" or null.

The problem is that the triggers never seem to fire. Debugging the converter suggests it never gets used. The debug output also doesn't warn me of failed bindings so I have no idea what is going wrong!


			<GlacialControls:IsNullOrEmptyStringConverter x:Key="isNullOrEmptyStringConverter"/>
			<Style x:Key="Co

Powerpoint can't read the outline from http://it/presentation.ppt. No text converter is installed


I have a user on my sharepoint 2007 environment that has a Powerpoint file that continues to display this message.  Is there something that needs to be added to Sharepoint to enable this file to open?  Where is this supposed to be added?



C# data bound combobox: display selected item text in separate label.content


I am new to C# but I'm resisting the urge to run screaming back to VB.NET. I'm working with a WPF application using C# code-behind and a lot of binding to a SQL 2005 database backend.

GOAL: I have a comboBox bound to a tbl_Systems entity which provides a list of systems for user selection. When the User selects a system from the comboBox I want to display the selection's text in a separate Label. The big picture is that several comboBox selections will be used to build a query string that will populate a listbox. So, I want to display these selected values in the Label so the user can see the query string they have dictated.

PROBLEM: When I set the Label content property to the comboBox SelectedItem property the entity tbl_System is displayed in the Label not the comboBox selection text.

SUSPICION: From reading similar examples in VB I suspect that the comboBox SelectedItem is actually a "datarowview" or the C# equivalent. But I don't know how to translate this explanation to C#.

The UI XAML comboBox properties are set as such:


Text control bound to Time field defaults to "12 AM" each time you enter "12"


I have and InfoPath 2007 form that has a text field, bound to a Time field, with format set to "9:46 AM".

When tesing the form I can enter '0', ''0:00' or '12AM' in the text field and InfoPath automatically (and correctly) converts these values to '12:00 AM' ,'12:59 AM'.  

Howerver if I enter '12', '12:30', InfoPath converts these to '12:00 AM' and '12:30 AM' respectively.   This becomes a problem, since our users expect '12', '12:30' to mean '12:00 PM' to '12:30PM'.

To enter the PM time we are forced to type '12 PM' or "12:30 PM', and InfoPath to render the correct time. 

But users can get careless, typing '12' for noon and not notice that wrong time.

Does anyone have a solution for this?

NOTE: I'm working on InfoPath 2007, but this behaviour is the same in InfoPath 2010.


AutoCompleteStringCollection for text box in DataGridView 2.0

I have been searching for a way to have autocomplete in a DataGridTextBox
object. There does not appear to be an obvious way to do this like you would
for a TextBox outside of a grid using the AutoCompleteCustomSource. Any
thoughts on how I can add this collection? :)

Built-in Functions - Text and Image Functions in SQL Server

Text and image functions operate on TEXT, NTEXT and IMAGE data types. These data types are deprecated with SQL Server 2005 and should be replaced by VARCHAR(MAX), NVARCHAR(MAX) and VARBINARY(MAX) when possible. Alternatively you can also consider storing large string values using XML data type. Text and image functions are nondeterministic.

Future versions of SQL Server will not support TEXT, NTEXT and IMAGE data types. Columns with TEXT / NTEXT data type do not support commonly used string functions such as LEN, LEFT, RIGHT, etc. Furthermore, due to the large size of TEXT data you''re likely to see performance issues if you store such data in the database. However, at times you can''t help but use the TEXT / NTEXT / IMAGE data types (for example when supporting 3rd party databases when you cannot change the schema) - this is when text and image functions come in handy.

Built-in Functions - Text and Image Functions

Text and image functions operate on TEXT, NTEXT and IMAGE data types. These data types are deprecated with SQL Server 2005 and should be replaced by VARCHAR(MAX), NVARCHAR(MAX) and VARBINARY(MAX) when possible. Alternatively you can also consider storing large string values using XML data type. Text and image functions are nondeterministic.

Conversion of text files from ANSI to UTF-8

reading and writing text files in ANSI format and
writing html-files in Charset ISO-8859-1 (Western Europe).

.net code converter

For coverting your programming langugae to another languge the below site is very help full


Text to Voice

Text to Voice and Voice to Text convert

Voice to Text conversion:-

Format Generic List Bound to Gridview


I have a generic list of a custom type. The custom type has a string and double.

I'm binding the list to a gridview and it outputs everything fine.

I'm trying to format the double column into a currency format. It is in a template field as I'm calculating a running total. I pass the value to a function that returns a double and adds the current value to a running total which I will show in the footer.

The format is not changing to currency as expected when using String.Format("{0:c}", GetTotal(Convert.ToDouble(Eval("Amount"))))

Any ideas on what might be going on and how to fix this?


How to take value of bound field of grid in a variable or in a textbox.


How to take value of bound field of grid in a variable or in a textbox.

 I m using this code in .aspx page for grid.

<asp:GridView ID="Grd_Mprocess" runat="server" AutoGenerateColumns="False"

                      Width="100%" AllowPaging="True"


                      AllowSorting="True" PageSize="5"  >

                 <RowStyle CssClass="odd" />


<asp:BoundField HeaderText="DOC_TYPE_PK" DataField="DOC_TYPE_PK"  Visible="true" >


  <asp:TemplateField HeaderText="DOC TYPE ID" Visible="true">  &nbs

reference from menubuttons to text parts in article on the same page


Hi, I'm searching now for hours but couldn't find it.Cry

In my menu i have several buttons which (by a <a href..) should go the a part of an article that is in the same form.

Menu button : What is a database should go to the page default.aspx and in there is an article published.
A part of this article is having a piece of text about "what is a database"

Menu button: how to make a query should go to this same article in the same page but then to the part that is have the piece about the query. The next could be an example of what i'm doing:

    <li><a href="default.aspx ?????>what is a database</a></li>
    <li><a href="default.aspx ?????>what is a query</a></li>

Where my question marks are, there should be a connection to that particular piece of text.
In each article part there is an ID="text1" and the second part id="text2"

How shoudl i do that, Should i use a question mark.
Please give me some guidance how to structure the <li> statement or a pointer where I can read about it.


text editor


 I format lines in a .aspx file (source view) the way I can use them, and if I switch to design view or view in browser or debug, the many lines get reformatted to flow all onto one line.

I can't seem to find the correct setting to keep this from happening.

Any suggestions?


How to cast integer values as an array of enum values?


Hello all!

I'm working with VS2010 Beta2, ASP.NET and Dynamic Data. I'm using VB but will certainly be happy to receive a C# example if necessary. Laughing

I used a few of Steve's examples (Writing Attributes and Extension Methods for Dynamic Data and Dynamic Data - Hiding Columns in selected PageTemplates) to create a custom property attribute to be applied to a dynamic data column and want it to accept an array of enum values (each value will represent a dynamic data page template where this column should not be displayed).  My new attribute works fine when I hardcode it like this, meaning the HideColumnIn attribute is properly populated with the array of enum values:

<HideColumnIn(PageTemplate.List, PageTemplate.Edit)> _
Public Property My_DD_Column As Object


However, I want to store the values to be used for the HideColumnIn in the DB as integer values that correspond to the

Unique text value in databse column


Hi Everyone!

I know this is probably a very basic question but how do I keep a column's text values unique in SQL server (ie for a unique username)?  The column is not an integer it's varchar(50), and it's not the primary key but I could make it the primary key if recommended.

The front end could handle it;  where the user would enter text, it's validated, then a query is done to see if that username is available.  If so, then user can decide to choose it and an insert is done, if not they pick a new username and process repeats.  With this approach, the responsibility of keeping the value unique solely rests on the front end, nothing on the database side.

Is this the correct way to handle this? 

Thank you!


Willing to Write Urdu in my text box


 hi want to write urdu in text box of my application if anyone has the solution how to do this kindly let me know

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