[Solved] Set TextBox as required based upon “selected” value of DropDownList


Add following code in SelectedIndexChanged event in .cs file

 protected void PositionShift_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (PositionShift.SelectedIndex == 1 || PositionShift.SelectedIndex == 3 || PositionShift.SelectedIndex == 5)
            {
                RequisitionNumberLabel.Text = "*";
            }
            else
            {
                RequisitionNumberLabel.Text = "Requisition Number";
            }
        }

Also, set Autopostback property of DropDownList to True.

solved Set TextBox as required based upon “selected” value of DropDownList