ASP.net 3.5 Lookup field strategy

Our strategy for lookup fields is to use a short code for the value of a lookup field (max 4 chars) and use a 50 varchar value to display in a drop down field.  To do this we create a lookup table with the value and display fields.  This has worked well in other development environments but not in ASP.net so far.  

Using a form view in the Item Template.  The system wants to display the value (short value) in a label, but we would like to display the long value in the field.  So I have added drop down lists for these fields by editing the field templates.  All is well except it allows the user to modify the value, although the new value is not posted.  This will confuse the users.  So I tried enable="false."  this works but the field is grayed out.  Looks wierd.  

Is there any way around this using the drop down list.  In Access for example there is an enabled property and locked property.  Lock does not gray out field.   Can't find a lock or anything that should do what I need.  Am I missing something?

Is it best just to save the long value in the underlying table and forget about short values?

Any other strategies?

Thanks for your help
deepPowdahAsked:
Who is Participating?
 
Alfred A.Commented:
Hi,

Is it possible if you could visualised it in an image and post it?

This might be "by design" especially with the dropdownlist.  If you set enabled="false" for the dropdownlist, it is grayed out (border plus text) and you cannot set the color if this is the case.

If you are using a TextBox, you can use ReadOnly="true" rather than Enabled="false" and by ReadOnly="true", you can still the color.



0
 
Alfred A.Commented:
Hi,

Why don't you change the BackColor of the Control to let say White?
0
 
deepPowdahAuthor Commented:
it isn't the back color is the container for the drop list.
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
Alfred A.Commented:
Can you please clarify?  You have a label and a dropdownlist, right?  Or, do you have a panel as a container with label and dropdownlist in there? So, which control/container is being grayed out when Enabled="false"?
0
 
deepPowdahAuthor Commented:
The border of the dropdown list is being grayed out.  It think it looks strange.  On the Item Template all text box fields appear as lablels and have no borders and the text is normal,black.  I would like the text to appear as in other fields black, and no dropdown list control displayed.
0
 
deepPowdahAuthor Commented:
THanks for your help.  after spending the weekend on this matter, it is clear that the dropdown list does not have the attributes needed to accomplish this.  I guess I will just have to use it and insert a javascipt function to prevent changing the value.

After all the hype about .Net 3.5 I'm disappointed.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.