private void btnViewReview_Click(object sender, RoutedEventArgs e) { Service service = ((Service)lstServiceList.SelectedItem); Review r = (Review)lstReviewList.SelectedItem; frmAddEditReview frm = new frmAddEditReview(user, this, r, service, event_); frm.ShowDialog(); loadReview(service.ServiceID); if (r != null) { for (int i = 0; i < lstReviewList.Items.Count; i++) { Review rv = ((Review)lstReviewList.Items[i]); if (rv.ServiceID == r.ServiceID && rv.UserID == r.UserID) { lstReviewList.SelectedIndex = i; } } } }
private void clickViewReview_Click(object sender, RoutedEventArgs e) { //MessageBox.Show(sender.GetType().ToString()); //MessageBox.Show(((Hyperlink)sender).Parent.GetType().ToString()); //Label l = (Label)((Hyperlink)sender).Parent; //MessageBox.Show(l.Parent.GetType().ToString()); String temp = ((Hyperlink)sender).Tag.ToString(); for (int i = 0; i < lstReviewList.Items.Count; i++) { if (((Review)lstReviewList.Items[i]).UserID == temp) { lstReviewList.SelectedIndex = i; break; } } //Control c; //do{ // c = (Control)sender; // Control pc = (Control)c.Parent; // c = pc; // MessageBox.Show(c.GetType().ToString()); //}while(true); //for(int j=0;j<lstReviewList.Items.Count;j++) //{ // if (lstReviewList.IsMouseOver == true) // { // lstReviewList.SelectedIndex = j; // break; // } //} Service service = ((Service)lstServiceList.SelectedItem); Review r = (Review)lstReviewList.SelectedItem; frmAddEditReview frm = new frmAddEditReview(user, this, r, service, event_); frm.ShowDialog(); loadReview(service.ServiceID); if (r != null) { for (int i = 0; i < lstReviewList.Items.Count; i++) { Review rv = ((Review)lstReviewList.Items[i]); if (rv.ServiceID == r.ServiceID && rv.UserID == r.UserID) { lstReviewList.SelectedIndex = i; } } } }
private void btnAddReview_Click(object sender, RoutedEventArgs e) { Service service = ((Service)lstServiceList.SelectedItem); if (service == null) { MessageBox.Show("No Service Selected"); return; } frmAddEditReview frm; Review sr = null; for (int i = 0; i < lstReviewList.Items.Count; i++) { Review r = ((Review)lstReviewList.Items[i]); if (r.UserID.Equals(user.UserID)) { sr = r; frm = new frmAddEditReview(user, this, r, service, event_); frm.ShowDialog(); loadReview(service.ServiceID); goto continueon; } } frm = new frmAddEditReview(user, this, null, service, event_); frm.ShowDialog(); loadReview(service.ServiceID); continueon: for (int i = 0; i < lstReviewList.Items.Count; i++) { Review r = ((Review)lstReviewList.Items[i]); if (r.ServiceID == service.ServiceID && r.UserID == user.UserID) { lstReviewList.SelectedIndex = i; lstReviewList.Focus(); return; } } }