Tuesday, March 1, 2011

Dropdownlist database value to dropdownlist on page load

 for (int a = 0; a < DropDownList1.Items.Count; a++)
             {

                 if (DropDownList1.Items[a].Text == dr[7].ToString())
                 {
                     //string _text = DropDownList1.Items[a].Text;
                     DropDownList1.Items[a].Selected = true;

                 }
             }  

Show password as password format in textbox from database

 if (Textpwd.TextMode == TextBoxMode.Password)
            {
                Textpwd.Text = dr[5].ToString();
                Textpwd.Attributes.Add("value", Textpwd.Text);
            }