Hi
I try to iterate through a datagrid that have 5 visible items and one that is not visible. I need to both check if there is a value for the hidden value and what that value is (it can be a null value). I currently use this code..
For Each dgi In MyDataGrid.Items
Select Case dgi.ItemType
Case ListItemType.Item, ListItemType.AlternatingItem
'Use CartID to identify what item to delete or update
CartID = MyDataGrid.DataKeys(dgi.ItemIndex)
TextBoxQuantity = CType(dgi.FindControl("intQty", TextBox)
'TextFileName = CType(dgi.FindControl("lblFileName", TextBox)
If CType(dgi.FindControl("DeleteFromCartCheckBox", CheckBox).Checked = True Or (TextBoxQuantity.Text) = 0 Then
'Remove from Cart Code Here
If dgi.FindControl("lblFileName" Is Nothing Then
MyCheck.Text = "doesn't exists"
else
MyCheck.Text = dgi.FindControl("lblFileName".ToString
End If
If there is a value for the hidden (lblFileName) value my code now writtes out "System.Web.UI.WebControls.Label " in the MyCheck.Text.
Now that is not right, what do I have to change to get it to write out the value of the label?
Regards
M
I try to iterate through a datagrid that have 5 visible items and one that is not visible. I need to both check if there is a value for the hidden value and what that value is (it can be a null value). I currently use this code..
For Each dgi In MyDataGrid.Items
Select Case dgi.ItemType
Case ListItemType.Item, ListItemType.AlternatingItem
'Use CartID to identify what item to delete or update
CartID = MyDataGrid.DataKeys(dgi.ItemIndex)
TextBoxQuantity = CType(dgi.FindControl("intQty", TextBox)
'TextFileName = CType(dgi.FindControl("lblFileName", TextBox)
If CType(dgi.FindControl("DeleteFromCartCheckBox", CheckBox).Checked = True Or (TextBoxQuantity.Text) = 0 Then
'Remove from Cart Code Here
If dgi.FindControl("lblFileName" Is Nothing Then
MyCheck.Text = "doesn't exists"
else
MyCheck.Text = dgi.FindControl("lblFileName".ToString
End If
If there is a value for the hidden (lblFileName) value my code now writtes out "System.Web.UI.WebControls.Label " in the MyCheck.Text.
Now that is not right, what do I have to change to get it to write out the value of the label?
Regards
M