user1269384
user1269384

Reputation: 61

ASP.NET: Request.Form and Repeaters

I have textboxes on Page A. These textboxes are inside a repeater. I am wanting to access their values on page B. However, Using Request.Form returns Null.

 Dim condition4 As String = Request.Form("condition4")
        Dim condition3 As String = Request.Form("condition3")
        Dim condition2 As String = Request.Form("condition2")
        Dim condition1 As String = Request.Form("condition1")
        ''''''''''''''''''''''''''''''
        hcondition4.Value = condition4
        hcondition3.Value = condition3
        hcondition2.Value = condition2
        hcondition1.Value = condition1



        For ii As Integer = 1 To 4


            Dim CurrentCondition As HiddenField = FindControl("hcondition" & ii)
            Dim CurrentConditionValue As Decimal = CurrentCondition.Value
            Dim CurrentPrice As Integer = UsedPrice * CurrentConditionValue

I have tried both as String and As Decimal. Still returns null

Upvotes: 0

Views: 555

Answers (1)

Bob Black
Bob Black

Reputation: 2405

Request.Form("[name"]) will always return a String.

ASP.Net controls are assigned unique ids automatically; the name you would use to request a value from the Form collection would be different than the ID you gave the control.

To make sure you're using the correct name, examine Request.Form.ToString() for names similar to what you named each textbox.

As an alternative, you could also examine Request.Form.AllKeys in the Visual Studio debugger.

Upvotes: 1

Related Questions