This is a migrated thread and some comments may be shown as answers.

[Solved] Loop though a RadGrid with RadNumericTextbox

1 Answer 317 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rob Venable
Top achievements
Rank 1
Rob Venable asked on 14 Feb 2010, 03:42 AM
Hi,
I am looping through a RadGrid and getting the contents of a RadNumericTextbox through each iteration. Every radNumericTextbox appears to be empty even though I have numbers in each of them. I've tested a regular textbox control in my radgrid and the numbers do show up.

Here's the code:
For Each item As GridDataItem In radGvProducts.Items  
 
            If TypeOf (item) Is GridDataItem Then  
                Dim txtQuantity As TextBox = CType(item.FindControl("txtQuantity"), TextBox)  
                If txtQuantity.Text <> String.Empty Then  
                   'do something  
                End If  
                Dim radTxtQuantity As RadNumericTextBox = CType(item.FindControl("radTxtQuantity"), RadNumericTextBox)  
                If radTxtQuantity.Text <> String.Empty Then  
 
                    Dim intQty As Integer = CInt(radTxtQuantity.Text.Trim)  
                    'Dim hdnShoppingCartID As HiddenField = CType(rptItem.FindControl("hdnShoppingCartID"), HiddenField)  
                    'Dim shoppingCartID As Integer = CInt(hdnShoppingCartID.Value)  
 
                    Dim hdnProductID As HiddenField = CType(item.FindControl("hdnProductID"), HiddenField)  
                    Dim prodID As Integer = CInt(hdnProductID.Value)  
 
 
                    Dim sc As New ShoppingCart(UserInstance.ContactID, prodID)  
                    'If UserInstance.ContactID > 0 Then  
                    sc.ContactID = UserInstance.ContactID  
                    'Else  
                    '    sc.UserID = DBNull.Value  
                    'End If  
                    sc.ProductID = prodID 
                    scsc.Quantity = sc.Quantity + intQty  
                    ShopCartCol.Add(sc)  
                    'sc.Save()  
 
                End If  
            End If  
 
 
        Next 
I check for radTxtQuantity.Text <> String.Empty before proceeding but it is always empty. Am I doing something wrong? It is never going into that If statement.
Thanks

1 Answer, 1 is accepted

Sort by
0
Rob Venable
Top achievements
Rank 1
answered on 14 Feb 2010, 09:16 PM
Nevermind...it just seems to be working today.Don't know what hapenned!
Tags
Grid
Asked by
Rob Venable
Top achievements
Rank 1
Answers by
Rob Venable
Top achievements
Rank 1
Share this question
or