anubis7000
Programmer
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.
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.