473,407 Members | 2,314 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

getting a specific field from a dataset and displaying it in a label.

Hi, I am trying to use the ItemCommand in a datagrid (web form) to
display *fields* from the specific row. Each row in the dataset has a
primary key.

The dataset single table is filled from a data adapter and SOME of the
fields are displayed in a datagrid. Everything groovy, no problem.

Now I want the user to click the ReqID (primary key link label) in the
datagrid and display fields FROM THAT ROW ONLY in some labels on the
form. I can't get it to return a field. I am about to give up and go
make another round trip to the database. Which seems silly because I
ALREADY have the data in my dataset. This is all read-only so maybe
could use a late-bound datareader. Not sure.

HELP!

Thanks,

Shelley

Mar 21 '06 #1
1 1793
I figured it out. I put *everything* (all fields) in the datgrid in
Template Columns. Then I set the Visible property of the hidden columns
to false (has to be done in html, the property pages don't show this
for template columns).

Then I put ID attributes "grxxx" in the html <asp: label> tags inside
the template columns.

Then in my itemCommand, I did this:

try
{
string strItemNumber =
((Label)e.Item.FindControl("grItemNumber")).Text;
string strBuyer = ((Label)e.Item.FindControl("grBuyer")).Text;
string strPO = ((Label)e.Item.FindControl("grPO")).Text;
string strDateDue = ((Label)e.Item.FindControl("grDateDue")).Text;

lblDateDue.Text = strDateDue;
lblPO.Text = strPO;
lblItem.Text = strItemNumber;
lblBuyer.Text = strBuyer;

lblDateDue.Visible = true;
lblPO.Visible = true;
lblItem.Visible = true;
lblBuyer.Visible = true;

}

etc.

It works.

Mar 21 '06 #2

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

Similar topics

0
by: Rob | last post by:
Hi I have a dataset that is ordered by the primary key, but when I view it in a dataview with the sort propery filled in with the primary key, the order is different. The data that seems to cause...
1
by: John | last post by:
Hello, I'm currently using reflection to get some data from an assembly created from a web form that has elements such as a DataGrid, DataSet, etc. I also have a label control. Getting the...
1
by: Harry Devine | last post by:
I have a DataGrid that is configured to use the Edit/Update/Cancel concept correctly. My grid shows values from 5 database fields. I only need to update that last 4 fields. The last field is a...
13
by: dbuchanan | last post by:
Hello, Here is the error message; ---------------------------- Exception Message: ForeignKeyConstraint Lkp_tbl040Cmpt_lkp302SensorType requires the child key values (5) to exist in the...
0
by: shelleybobelly | last post by:
Hi, I am trying to use the ItemCommand in a datagrid (web form) to display *fields* from the specific row. Each row in the dataset has a primary key. The dataset single table is filled from a...
1
by: MasterChief | last post by:
I am sending a page a query string called job_id. What I want to do is take the job_id that is passed look it up in a database and make the text in a label on the new page display a value of one of...
2
by: Coll | last post by:
I have a field that I would like to display on a report only if the value of another field matches a certain criteria. If it does match I need the label & the field value to display (though I'm...
2
by: karinmorena | last post by:
I'm having 4 errors, I'm very new at this and I would appreciate your input. The error I get is: Week5MortgageGUI.java:151:cannot find symbol symbol: method allInterest(double,double,double)...
1
WyvsEyeView
by: WyvsEyeView | last post by:
I have a dataset subform on which I want to lock a field for just two specific records. Each record has a type_id and a desc field. I want to test the value of the type_id field for the current...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.