473,461 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

asp.net 2.0, datasource/formview question

I've got an AccessDataSource configured to return a single record. I've
bound that to a FormView. Beautiful, right out of the box I get a simple
tabular display of all the fields in that record. But now I want to make
that output look nicer, and I'm running into trouble.

The record I'm displaying is a Knowledge Base article, and it has fields
such as Symptoms, Cause, and Resolution. I need to display a title,
"Symptoms", followed by the Symptoms field. But if the field is blank, I
don't want to display the title. How can I incorporate that "if" logic in a
FormView's ItemTemplate?

Two dead ends I tried were:
1) Put the title and field in an asp:Panel, with Visible='<%#
Bind("Symptoms") == "" %>' or something along those lines. But apparently
we can't put logical operators in the <%# %>. (Where is the <%# syntax
described anyway? You can't do a google search for that!)
2) Code something up in the page's OnLoad(), something like: if
(AccessDataSource1["Symptoms"] == "") SymptomsPanel.Visible = false; But I
can't figure out how to get from an AccessDataSource to the DataSet it got
back from its select query. What am I missing?

Any help appreciated. Thanks.
Nate
Nov 19 '05 #1
1 1175
lookup "Data Binding Expression Syntax". its pretty simple, though, <%# %>
fill in the Expression property of the DataBinder associated with the
control when you call DataBind. the DataBinder uses reflection to to find
the matching property or field on the Containing Page. if the language is C#
the return datatype must be compatiable with the control property being set.

-- bruce (sqlwork.com)

"Nate Hekman" <he*********************@nospam.com> wrote in message
news:u5****************@TK2MSFTNGP10.phx.gbl...
| I've got an AccessDataSource configured to return a single record. I've
| bound that to a FormView. Beautiful, right out of the box I get a simple
| tabular display of all the fields in that record. But now I want to make
| that output look nicer, and I'm running into trouble.
|
| The record I'm displaying is a Knowledge Base article, and it has fields
| such as Symptoms, Cause, and Resolution. I need to display a title,
| "Symptoms", followed by the Symptoms field. But if the field is blank, I
| don't want to display the title. How can I incorporate that "if" logic in
a
| FormView's ItemTemplate?
|
| Two dead ends I tried were:
| 1) Put the title and field in an asp:Panel, with Visible='<%#
| Bind("Symptoms") == "" %>' or something along those lines. But apparently
| we can't put logical operators in the <%# %>. (Where is the <%# syntax
| described anyway? You can't do a google search for that!)
| 2) Code something up in the page's OnLoad(), something like: if
| (AccessDataSource1["Symptoms"] == "") SymptomsPanel.Visible = false; But
I
| can't figure out how to get from an AccessDataSource to the DataSet it got
| back from its select query. What am I missing?
|
| Any help appreciated. Thanks.
|
|
| Nate
|
|
Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Rabbit | last post by:
Hi, All, I have a FormView, in which the InsertItemTemplate has a dropdownlist that I need to set the datasource as my self created dataset. I have been trying various syntax like following at...
1
by: sck10 | last post by:
Hello, I have a GridView that has AutoGenerateSelectButton="true". When the "Select" link is clicked, it opens a FormView with the appropriate data. Below is the following SelectParameter that...
3
by: Mike Gaab | last post by:
I am trying to use some of the new controls in VS 2005 but am having some difficulty. My business logic layer returns Collections of my business objects. I am used to just assigning these...
2
by: H5N1 | last post by:
Hi there First of all excuse me posting such simple (I guess) question, but I didn't find the answer in tutorials. I have a formView presenting records from some table. one of the fields is...
2
by: myzm | last post by:
Hi, I have a FormView looks like this <asp:FormView> <ItemTemplate> <asp:Table> <asp:TableRow> <asp:TableCell> <asp:TextBox ID="textBox1"> </asp:TableCell>
1
by: cisco | last post by:
I've been trying to figure out how the client of a DetailsView or FormView should handle the ItemUpdating event when setting the datasource programatically. I want to do something simple like...
0
by: TJHerman | last post by:
I have a dropdown list in a Formview that includes a number of fields in the SQLDatasource. I want to be able to get the value of one of the fields in the Datasource that is not the...
2
by: Kelly | last post by:
I'm fairly new to ASP.NET2, but I have an ASP 3.0 background, and I've been experimenting with the DataSource and FormView widgets. I wound up having some questions along the way which I hope you...
0
by: Tarren | last post by:
Hi: I have a formview and I want a gridview to show at the bottom of the page beneath the formview. The thing is that the datasource for the gridview had ControlParameters which need to pull...
5
by: Ken Varn | last post by:
I have just started using VS.NET 2005 after using VS.NET 2003. One of the things that I noticed is that in ASP.NET, the DataSource property for TextBoxes and other web controls is no longer...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.