Trying to Make a Conditional ItemTemplate Field

Posted on 2009-04-23
Medium Priority
Last Modified: 2013-11-26
hi all,

I'm still trying to get used to .net (from classic ASP). I have a GridView control and in one of the columns, if it has data in it already, I just want to show the data. If there is no data yet, I'd like to show a textbox. I don't want the person to have to edit / update each row individually. I want them to be able to fill in all of the rows and just hit the "save" button. First, is the save part possible? If not, then the second part doesn't do me any good. Assuming the save IS possible, how do I conditionally show the label or textbox? Then, when someone hits the save button, how do I loop through the rows to gather up all of the boxes?
Question by:DEWebWorks
1 Comment
LVL 83

Accepted Solution

CodeCruiser earned 2000 total points
ID: 24224053
The way ASP.NET grid works is that it shows the data in view mode using plain text (labels). Then you need to click on the Edit link to change the grid into edit mode in which case it would display appropriate edit controls for each cell. I think the grid does not provide the functionality which you are trying to develop. One way of acheiving this is to show a separate textbox conditionally. The user can input a value in that box and pressing the save button then insert that value in all the rows.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Integration Management Part 2
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month14 days, 5 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question