/// <summary> /// Event handler that gets called when selected index is changed in drop-down list. /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void UpdateServerProvisioning(Object sender, EventArgs e) { DropDownList ServerProvisioningList = sender as DropDownList; DataGridItem item = ServerProvisioningList.Parent.Parent as DataGridItem; string SelectedName = ServerProvisioningList.SelectedItem.Text; string UserID = item.Cells[AccountsIDColumn].Text; if (SelectedName.Equals(GetString("NOTAPPLICABLE"))) { /// remove entry fron hashtable, if any for this userid if (ServerProvisioningNames.ContainsKey(UserID)) { ServerProvisioningNames.Remove(UserID); } } else { ServerProvisioningNames[UserID] = SelectedName; } if (ServerProvisioningNames.Keys.Count > 0) { } else { } return; }
/// <summary> /// return the selected index of server provisioning methods, while binding the data /// </summary> /// <returns></returns> protected void GetSelectedItem() { foreach (DataGridItem item in Accounts.Items) { string userid = item.Cells[AccountsIDColumn].Text; if (ServerProvisioningNames.ContainsKey(userid)) //&& (! (bool) isprovisioned)) { ((DropDownList)item.FindControl("ProvisionServerList")).SelectedValue = (string)ServerProvisioningNames[userid]; } } }