.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

Conditional Hide/Display of fields

Posted By:      Posted Date: October 05, 2010    Points: 0   Category :ASP.Net

I am trying to create a form. Unfortunately, the form has a lot of fields and my user requested some field to be displayed based on "Yes" or "No" input. For example we have a field to capture input for "Is there extended warranty?" If user chose "yes", a new field get displayed showing a new line which user must enter some text about the extension"


I am using tables to lay out the form. I found that it is necessary to add the hidden field to a new row so that it can be hidden. I tried using Javascript and CSS to hide/show the row but I am looking for an alternative approach as I dont find this very efficient.


Any ideas?


Thanks in advance.  

View Complete Post

More Related Resource Links

wss2.0 update/delete/hide lookup column that does not display any values


Hi All,

I have a document library that contains a Category column that is a lookup field. This is a default column that is a required field when uploading documents to the document library. The Category column is empty and I am unable to amend, hide, make it not required or delete it.

I have gone to Modify settings and columns -> clicked on the Category field to edit, but there is no option to amend the content or delete it. I am only able to amend the Column name and Description.

Since then, I have amended the column name to eg. Category1 and created a new Category field as a lookup and linked it to the correct list.

The problem I am facing now, is that I cannot hide, delete or make the Category1 (old Category) field NOT required. Either I would like to update the original field to display the correct values or alternately hide, delete or make the column not required.

Please help.

How to dynamically hide stock edit/display form?


How can I dynamically hide/show the stock edit or display form of a list item?

how to hide/display controls in NewForm.aspx based on dropdown value in SharePoint list



I have 1 dropdown in my sharepoint list with other columns. If dropdown value equal to 'xyz' i need to display some other controls, otherwise these controls should be hidden.

I know we can achieve this with javascript. If any one can provide code or sample then it will be appreciated. or is there any other alternative methods to do this ........

Thanks & Regards, Neerubee

display non measure, non dimension fields in drill down

Hi All, I created my fact table with more fields than just the foreign keys linking dimensions and the field(s) to be used as mesures.  I did this hoping that on drill down I would be able to see the extra fields so that the user would have access to detail information on the records making up the measure amount.  The extra fields do not appear on drill down.  How can I make them appear, or am I on the wrong track? Thanks for any help

NewForm.aspx - Show/Hide fields dynamically

I have about 20 + fields in a custom list.  I want to be able to show and hide fields depending on user selection.  Does anyone know a way of accomplishing this? Ive tried some embedded javascript but can't seem to get it working in sharepoint. Please help :)http://lbellows.blogspot.com http://www.ptreviews.net

Razor. Display conditional Html

Hello,I have the following code on a View using Razor view engine: @if(View.Section == CMSSection.Home) { Html.ActionLink("Home", MVC.CMS.Home.Index()) } else { <span>Home</span> }I keep getting the error:Compiler Error Message: CS1002: ; expectedWhat am I missing?Thank you,Miguel

Display fields in page footer



I am creating an Invoice. Where company address must come at the bottom of the page.

But I cannot use any fields in header and footer. How can I serve this requirement??

any idea?

Hide / display page layout columns for different users


I'm looking for a way to hide some columns of a page layout so they will be shown only to specific audience (for example hide the "created by" column so some users won't see it). Any suggestions?


Hide a measure group in excel 2007 'Show Fields Related to'


Hi All,

I know that if a I want to hide a measure group to users I have to set the properties 'Visible' to false for all the measure of the measure group.

But when I open a connection to the cube with Excel 2007 I see again the measure group in the drop down list 'Show Fields Related to' in the 'Pivot Table Fields List'.

I don't see it in the measure group list when I choose 'All' in the 'Show Fields Related to', but i don't want to see it in the list 'Show Fields Related to' too.


How I can do to hide permanently the measure group?


Thank you all,


Hide Fields on NewForm.aspx


I put the following javascript code in the NewForm.aspx.

<script language="javascript" type="text/javascript">

function findacontrol(FieldName)
 var arr = document.getElementsByTagName("!");
 //Get all comments
 for (var i=0; i < arr.length; i++)
  // now match the field name
  if (arr[i].innerHTML.indexOf(FieldName) > 0)
   return arr[i];

function hideFields()
 var control = findacontrol("Status");
 control = findacontrol("Action");
 control =findacontrol("Raw Material Solution");
 control = findacontrol("Outcome");
 control = findacontrol("Progress Notes");
 control = findacontrol("Closure Notes");<

Show/Hide fields on InfoPath based on context User Group Membership

I am reading a book on SharePoint 2010 Development by Wrox and although it is a good book, the InfoPath section is limited. I am Googling to see if I can find anywhere where i can perhaps have this type of functionality to hide and show a specific field based on their Group Membership?
Victor Palma

How to show column value in display mode and hide in edit mode?


How to show column value in display mode and hide in edit mode for my custom page layout?

I need similar functionality like PublishingWebControls:EditModePanel with contrary behavior.

I cannot use nor server-side code neither third-party web-parts. Only pure APSX+SP Contol Libraries and client JS allowed.

How To: hide fields on an input form


How can I hide a field in SP 2010.  I used this code in SP 2007 but can't get it to run in the new pop-up forms in SP 2010.


function findacontrol(FieldName, action) {

   var arr = document.getElementsByTagName("!");
   // get all comments
   for (var i=0;i < arr.length; i++ )
      // now match the field name
      if (arr[i].innerHTML.indexOf(FieldName) > 0) {
       if (action == "none") {
     } else {
       return arr[i];

function hideFlds() {

   var control = findacontrol("Request Status", "none");

People search result -- how to display more fields



After user perform a people search, a list of people will be displayed with a summary, like name, title...and the picture. Is there a way that I can add more fields to this display, that is to display more information? Is this something to do with the User Properties that I set up in Central Admin. e.g moving those the properties that I want to show to the top? And I want to display a total of 9 properties for each person in the search result list. Is that possible?

Please advice. Thanks in advance.

GridView inline Master/Detail record display

This code drop is part of a smash and grab series. If you're in a rush, you can just grab this code and insert it into your application, no understanding is required. When you have some time (ya, right) you may want to review the source code.

Hide a repeater in ASP.NET C# if the DataSource contains no items?

I have an ASP.NET page that uses a repeater nested within another repeater to generate a listing of data. It's to the effect of the following:
In the (C#) code-behind I'm basically using LINQ to pull a listing of information from an XML document and bind that information to the first repeater.

Searching for the answer to this, it seems the method is to determine whether the data for the nested repeater is empty. If it is, then you set the visibility of the repeater to false.

Display data in gridview dynamicallay

I have AD domain which has 100000 users, I want to display all the users in gridview controls.Actually it is displaying users in gridview after parsing entire domain which takes around 30 min. I want to display the users while loading itself.It is continously getting user information from AD domain and getting each user details, I want to display the users information which already queried instead of waiting till getting all users information
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