I have four textboxes grouped to two:
- txtbox_date_start
- txtbox_date_end
- txtbox_value_start
- txtbox_value_end
All these four textboxes have AutoPostBack = true.
if (Page.IsPostBack)
{
//copy value of txtbox_date_start to txtbox_date_end
if ((txtbox_date_start.Text != "") && (txtbox_date_end.Text == ""))
{
txtbox_date_end.Text = txtbox_date_start.Text;
// How?
// if txtbox_date_start was focused, then set focus to txtbox_date_end
}
//copy value of txtbox_value_start to txtbox_value_end
if ((txtbox_value_start.Text != "") && (txtbox_value_end.Text == ""))
{
txtbox_value_end.Text = txtbox_value_start.Text;
// How?
//if txtbox_value_start was focused, then set focus to txtbox_value_end
}
}
My original pseucode is like this:
if txtbox_date_start is not empty and is focused,
--> then when press tab,
----> txtbox_date_end will be = to txtbox_date_start
------> and txtbox_date_end will be focused
same purpose for txtbox_value_start & txtbox_value_end.
I also tried to use
if ( txtbox_date_start.Focused == true)
but the Focuse() cannot be used in the if statement.