Question

I have a page with three user controls on it. Two outputting tables and one holding date inputs.

I'm trying to read the values of the submitted dates using Request.Form["Date1"] etc. However, I am getting no values. Am I missing something really basic?

Was it helpful?

Solution

You can write property in your usercontrol

public string DateValue
{
    get { return dateValue.Text; }
}

If textbox is holding Date1 above should work or you can change accordingly.

Then just access DateValue wherever you want

In aspx code behind you can create object of user control like below and acces its properties.

UserControl userControl = (UserControl)Page.FindControl("userControl");

Here userControl is the id for User Control.

OTHER TIPS

It doesn't matter where your values are. ( as long they are under form tag)

The Page submits its forms. I repeat - its forms.

Make sure you are reading the value according to The name of the form element

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top