Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Binding a template column to a dataset column

Status
Not open for further replies.

anubis7000

Programmer
Apr 27, 2006
19
US
Hi,

I have a question regarding how to bind a column in a dataset to a templated column in a gridview.

Pretty much I have created, filled and bound my dataset to my gridview using the page_load function.

My current situation is that when I run the webpage, the gridview will display the columns that I declared in my dataset declarations as well as the corresponding data from the backend database using labels, but the templated field is still empty.

I believe my final code will look something similar to this:

If (e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem) Then
Dim datarow As Dataset1.WorkExperianceDataRow
datarow = CType(CType(e.Item.DataItem, DataRowView).Row, Dataset1.WorkExperianceDataRow)
CType(e.Item.FindControl("ExperiancePeriod"), TextBox).Text = datarow.ExperiancePeriod
CType(e.Item.FindControl("TotalYears"), TextBox).Text = datarow.TotalYears.ToString
CType(e.Item.FindControl("CompanyName"), TextBox).Text = datarow.CompanyName
CType(e.Item.FindControl("JobDescription"), TextBox).Text = datarow.JobDescription
End If

However, I am using an untyped dataset; this is taken from an example using a typed dataset.

Any suggestions? Thanks in advance.
 
post your current aspx/code behind files. this will help us diagnose the problem. showing us someone elses code which "might look like yours" isn't any help.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top