Hi All,
I am using infragistic 2013 in my application when i am trying to do sorting i am unable to do it.
Grid type i am using.
<ig:WebDataGrid ID="wdGrid_PSTS" runat="server" Height="500px" Width="99%" AutoGenerateColumns="false" EnableDataViewState ="true" >
<ig:BoundDataField DataFieldName="Id" Key="Id" Width="50px"> <Header Text="Id"></Header> </ig:BoundDataField>
<ig:BoundDataField DataFieldName="PSTStatus" Key="PSTStatus" Width="125px"> <Header Text="PSTStatus"></Header> </ig:BoundDataField>
<Behaviors> <ig:Sorting SortingMode="Multi" Enabled="true"> </ig:Sorting> <ig:ColumnResizing Enabled="true"></ig:ColumnResizing> <ig:Selection CellClickAction="Row" RowSelectType="Multiple"></ig:Selection> </Behaviors>
It functionality is not working. Kindly suggest.Its been 2 days and i am still stuck .I am experiencing Infrgistic first time.
Hello Dheeraj,
Thank you for the code-snippet you have provided.
I tested the WebDataGrid's sorting functionality by using the one you have provided and I was unable to reproduce the behavior you have described.
I have attached a sample application that demonstrates the approach from above. Would you please modify it, so the issue is reproduced and send it back to me? Having this information will help me further investigate this matter for you.(Please note that you might have to change the assembly references and the stylesSetPath property in the Web.config so they target your specific version and path for the styles.)
If you have any questions, please let me know.
0410.WebDataGrid_sample.zip
Hi Tacho,
Thanks for your prompt respond.
I have 1 drop down when i select the value from that drop down and click on search button grid is populated.
now i have done some code changes in design side.
function sort() { debugger; var grid = $find("wdGrid_PSTS"); // Sort column by calling sortColumn method and passing in the column and the sort direction // Sort direction is 0, 1, or 2 for none, ascending, or descending. grid.get_behaviors().get_sorting().sortColumn(grid.get_columns().get_columnFromKey("Id"), 1, false); grid.get_behaviors().get_sorting().sortColumn(grid.get_columns().get_columnFromKey("PSTName"), 1, false); grid.get_behaviors().get_sorting().sortColumn(grid.get_columns().get_columnFromKey("UserName"), 1, false); }
Now value is sorting but new issue had occurred which is that when i select other value from the dropdown grid is not getting clear and irrespective any value selecting from drop down same value is pertain until i refresh the page .
Please suggest.
We are glad you managed to resolve the initial issue. For this second one, please, share with us the code you execute in code-behind on changing the selection in the drop-down, so we can investigate what happens.
Looking forward to hearing from you.
Hi Galina,
Thanks for your Prompt respond. Please find Code snippet below
1st dropdown
protected void wddInvestigations_SelectionChanged(object sender, Infragistics.Web.UI.ListControls.DropDownSelectionChangedEventArgs e) { wdGrid_PSTS.DataSource = null; wdGrid_PSTS.Rows.Clear(); // this.wdGrid_PSTS.Behaviors.Sorting.SortedColumns.Clear(); hfInvNo.Value = this.wddInvestigations.SelectedValue; BindAssignData(Convert.ToInt32(hfInvNo.Value)); btnSearch.Enabled = true;
}
2nd dropdown
protected void wddAssign_SelectionChanged(object sender, Infragistics.Web.UI.ListControls.DropDownSelectionChangedEventArgs e) { wdGrid_PSTS.DataSource = null; wdGrid_PSTS.Rows.Clear(); wdGrid_PSTS.DataBind(); btnSearch.Enabled = true; }
protected void wdGrid_PSTS_ColumnSorted(object sender, SortingEventArgs e) {
if (wddInvestigations.SelectedItemIndex == 0) { wdGrid_PSTS.DataSource = null; wdGrid_PSTS.Rows.Clear();
else { BindPSTs();
private void BindPSTs() { try { // int inv = Convert.ToInt32(wddInvestigations.SelectedValue); DataTable dt = GetPSTs(); DataSet dsPST = new DataSet();
dsPST.Tables.Add(dt); if (dt.Rows.Count > 0) { this.wdGrid_PSTS.DataSource = dsPST; this.wdGrid_PSTS.DataBind(); // this.wdGrid_PSTS.Behaviors.Sorting.SortedColumns.Add(this.wdGrid_PSTS.Columns["Id"], Infragistics.Web.UI.SortDirection.Descending); //this.wdGrid_PSTS.Behaviors.Sorting.SortedColumns.Clear(); } else { // Jaleel //this.wdGrid_PSTS.Clear(); // Jaleel //this.wdGrid_PSTS.Columns.Clear(); //jaleel
// Dheeraj 13-05-2019 wdGrid_PSTS.DataSource = null; wdGrid_PSTS.Rows.Clear();
// END }
} catch(Exception ex) { this.lblErrorMsg.Text = ex.Message; this.lblErrorMsg.ForeColor = System.Drawing.Color.Green;
private DataTable GetPSTs() {
DataTable dt = new DataTable(); dt.Columns.Add("Id"); dt.Columns.Add("UserName"); dt.Columns.Add("MsgType"); dt.Columns.Add("PSTStatus"); dt.Columns.Add("StartDate", Type.GetType("System.DateTime")); dt.Columns.Add("EndDate", Type.GetType("System.DateTime")); dt.Columns.Add("PSTName"); dt.Columns.Add("Location"); dt.Columns.Add("PSTSize");
if (m_LookupMgr == null) m_LookupMgr = new LookupManager();
// Check to see the asssignId. It may be null because of confidentiality
List<PSTDTO> pstDTOList = new List<PSTDTO>(); InvestigationManager invMgr = new InvestigationManager(); if (wddAssign.SelectedValue == "0") { //int inv = Convert.ToInt32(this.wddInvestigationNo.SelectedRow.Cells[0].Text); // Jaleel - Start //int inv = Convert.ToInt32(wddInvestigationNo.CurrentValue); //int inv = Convert.ToInt32(ddlInvestigation.SelectedValue); // int inv = Convert.ToInt32(wddInvestigations.SelectedValue);
int inv = Convert.ToInt32(wddInvestigations.SelectedValue); // Jaleel - End
List<InvAssignmentDTO> assigns = invMgr.GetAllInvAssignmentsByInvId(inv); foreach (InvAssignmentDTO dto in assigns) { pstDTOList.AddRange(GetAssignPSTS(dto.Id)); } } else { int assignId = Convert.ToInt32(wddAssign.SelectedValue); pstDTOList.AddRange(GetAssignPSTS(assignId)); }
// Created PST status int pstStatusCreatedId = SiteHelper.GetGlobalLookupByCodeLookup(Utils.ConstantHelper.PST_STATUS.PST_STATUS_CREATED.ToString()).Id; int pstStatusInvalId = SiteHelper.GetGlobalLookupByCodeLookup(Utils.ConstantHelper.PST_STATUS.PST_STATUS_BURNED_INVALID.ToString()).Id;
foreach (PSTDTO dto in pstDTOList) { if ((dto.StatusId == pstStatusCreatedId) || (dto.StatusId == pstStatusInvalId)) { DataRow dr = dt.NewRow(); dr["Id"] = dto.Id; dr["UserName"] = GetUserName(dto.InvUserId); dr["MsgType"] = m_LookupMgr.GetEDiscoveryMsgTypeById(dto.MessageTypeId).MsgSubType; dr["PSTStatus"] = SiteHelper.GetGlobalLookupById(dto.StatusId).Name; dr["StartDate"] = SiteHelper.GetDatetoString(dto.StartDate); dr["EndDate"] = SiteHelper.GetDatetoString(dto.EndDate); dr["PSTName"] = dto.PSTName; dr["Location"] = dto.PSTLocation; dr["PSTSize"] = dto.PSTSIze; dt.Rows.Add(dr); } } return dt; }
Please try to respond ASAP since i m stuck in this issue for 2 days. I think its a very subtle issue but unable to identify
Hello,
Thank you for the code snippets. There's nothing obvious in the code that seems not OK. Please, make sure you are not rebinding the drop-downs on every page postback. I am attaching a small sample application I used to test rebinding the grid on changing the selection in a drop-down. Review it and let us know if you need further assistance on the matter.
6661.WebDataGrid_sample.zip
Hi ,
Please note that once i applied the sorting only then i am unable to clear the grid while changing the dropdown.
You can try to clear the rows and rebind the grid once you make the necessary updates to those Restore statuses. If this doesn't work, we will need a sample application demonstrating the issue, so we can investigate further and give a proper advice.
1 more issue i need discuss.
I want to refresh my webgrid .
there is 1 column name Restore status based on some conditions its status gets change but sometimes status doesn't change we need to refresh page explicitly especially when we select multiple records.
Please advise
CODE snippets.
private void updateRestoreStatus(string sender) { //DA Statuses GlobalLookupDTO statusAssigned = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_DA_STATUS.RESTORE_DA_ASSIGNED.ToString()); GlobalLookupDTO statusSearched = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_DA_STATUS.RESTORE_DA_SEARCHED.ToString()); GlobalLookupDTO statusVerified = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_DA_STATUS.RESTORE_DA_VERIFIED.ToString()); GlobalLookupDTO statusRestored = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_DA_STATUS.RESTORE_DA_RESTORED.ToString()); GlobalLookupDTO statusCompleted = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_DA_STATUS.RESTORE_DA_COMPLETED.ToString()); GlobalLookupDTO statusSearchedAndVerified = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_DA_STATUS.RESTORE_DA_SEARCHED_N_VERIFIED.ToString()); GlobalLookupDTO statusInvalid = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_DA_STATUS.RESTORE_DA_INVALID.ToString()); GlobalLookupDTO statusInvalidAssigned = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_DA_STATUS.RESTORE_DA_INVALID_ASSIGNED.ToString());
//Tape Statuses - for future implementation GlobalLookupDTO statusAssignedTape = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_DA_STATUS.RESTORE_DA_ASSIGNED.ToString());
//BBX Statuses GlobalLookupDTO statusBBXAssigned = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_BBX_STATUS.RESTORE_BBX_ASSIGNED.ToString()); GlobalLookupDTO statusBBXCompleted = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_BBX_STATUS.RESTORE_BBX_COMPLETED.ToString()); GlobalLookupDTO statusBBXRestored = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_BBX_STATUS.RESTORE_BBX_RESTORED.ToString()); GlobalLookupDTO statusBBXSearchedAndVerified = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_BBX_STATUS.RESTORE_BBX_SEARCHED_N_VERIFIED.ToString());
//TW Statuses GlobalLookupDTO statusTWAssigned = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_TW_STATUS.RESTORE_TW_ASSIGNED.ToString()); GlobalLookupDTO statusTWCompleted = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_TW_STATUS.RESTORE_TW_COMPLETED.ToString()); GlobalLookupDTO statusTWInvalid = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_TW_STATUS.RESTORE_TW_INVALID.ToString()); GlobalLookupDTO statusTWInvalidAssigned = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_TW_STATUS.RESTORE_TW_INVALID_ASSIGNED.ToString()); GlobalLookupDTO statusTWRestored = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_TW_STATUS.RESTORE_TW_RESTORED.ToString()); GlobalLookupDTO statusTWSearched = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_TW_STATUS.RESTORE_TW_SEARCHED.ToString()); GlobalLookupDTO statusTWSearchedAndVerified = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_TW_STATUS.RESTORE_TW_SEARCHED_N_VERIFIED.ToString()); GlobalLookupDTO statusTWVerified = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_TW_STATUS.RESTORE_TW_VERIFIED.ToString());
//lumenion statuses GlobalLookupDTO statusLumAssigned = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_LUMENSION_STATUS.RESTORE_LUMENSION_ASSIGNED.ToString()); GlobalLookupDTO statusLumSearchedAndVerified = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_LUMENSION_STATUS.RESTORE_LUMENSION_SEARCHED_N_VERIFIED.ToString()); GlobalLookupDTO statusLumRestored = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_LUMENSION_STATUS.RESTORE_LUMENSION_RESTORED.ToString()); GlobalLookupDTO statusLumCompleted = SiteHelper.GetGlobalLookupByCodeLookup(ConstantHelper.RESTORE_LUMENSION_STATUS.RESTORE_LUMENSION_COMPLETED.ToString());
int idColId = wdg_TechRestores.Columns.FromKey("Id").Index; int dataAvailColId = wdg_TechRestores.Columns.FromKey("EDDataAvailId").Index; int restoreStatusColId = wdg_TechRestores.Columns.FromKey("RestoreStatusId").Index; //int DAVerifiedByColId = wdg_TechRestores.Columns.FromKey("DAVerifiedBy").Index; int DAMsgsRestoredColId = wdg_TechRestores.Columns.FromKey("DAMsgsRestored").Index;
EmployeeManager empMgr = new EmployeeManager(); RestoreManager reMgr = new RestoreManager();
#region if the mark as searched button was pressed if (sender == "Mark Searched") { foreach (GridRecord row in wdg_TechRestores.Behaviors.Selection.SelectedRows) { try { GlobalLookupDTO statusCurrent = SiteHelper.GetGlobalLookupById(Convert.ToInt32(row.Items.FindItemByKey("RestoreStatusId").Text));
//only Assigned or Validated can be updated as Searched if (statusCurrent.Id == statusAssigned.Id || statusCurrent.Id == statusVerified.Id || statusCurrent.Id == statusBBXAssigned.Id || statusCurrent.Id == statusTWAssigned.Id || statusCurrent.Id == statusLumAssigned.Id) { int restoreId = Convert.ToInt32(row.Items.FindItemByKey("Id").Text);
GlobalLookupDTO statusNew; if (statusCurrent == statusAssigned) statusNew = statusSearched; else if (statusCurrent == statusVerified) statusNew = statusSearchedAndVerified; else if (statusCurrent == statusBBXAssigned) statusNew = statusBBXSearchedAndVerified; else if (statusCurrent == statusLumAssigned) statusNew = statusLumSearchedAndVerified; else statusNew = statusTWSearched;
RestoreDTO restoreDTO = reMgr.GetRestorebyId(restoreId); restoreDTO.ModifiedBy = Convert.ToInt32(Session["UserId"]); restoreDTO.ModifiedOn = DateTime.Now; restoreDTO.RestoreStatusId = statusNew.Id; restoreDTO.Comments = System.DateTime.Now.ToString("MM/dd/yyyy h:mm tt") + " " + Session["UserId"].ToString() + tbComment.Text + "<br/>" + restoreDTO.Comments; reMgr.UpdateGroupedUserRestore(restoreDTO);
row.Items.FindItemByKey("RestoreStatusId").Text = statusNew.Id.ToString(); row.Items.FindItemByKey("RestoreStatus").Text = row.Items.FindItemByKey("EDDataAvailId").Text + " - " + statusNew.Name;
setOkRow(">Updated row # " + ((row.Index) +1).ToString() + " successfully for restore with id: " + restoreId, row); } else setErrorRow(">Error occured updating row #" + ((row.Index) + 1).ToString() + ". Details: " + "can't update status " + statusCurrent.Name + " to Searched.", row); } catch (Exception e1) { setErrorRow(">Error occured updating row " + ((row.Index) + 1).ToString() + ". Details: " + e1.Message, row); }
} } #endregion
#region if the validate button was pressed else if (sender == "Mark Verified") { foreach (GridRecord row in wdg_TechRestores.Behaviors.Selection.SelectedRows) { try { GlobalLookupDTO statusCurrent = SiteHelper.GetGlobalLookupById(Convert.ToInt32(row.Items.FindItemByKey("RestoreStatusId").Text));
//only Assigned or Searched can be updated to Validated if (statusCurrent.Id == statusAssigned.Id || statusCurrent.Id == statusSearched.Id || statusCurrent.Id == statusBBXAssigned.Id || statusCurrent.Id == statusTWSearched.Id) { int restoreId = Convert.ToInt32(row.Items.FindItemByKey("Id").Text);
GlobalLookupDTO statusNew; if (statusCurrent == statusAssigned) statusNew = statusVerified; else if (statusCurrent == statusSearched) statusNew = statusSearchedAndVerified; else if (statusCurrent == statusBBXAssigned) statusNew = statusBBXSearchedAndVerified; else statusNew = statusTWSearchedAndVerified;
RestoreDTO restoreDTO = reMgr.GetRestorebyId(restoreId); //update the verified-on fields for pertinent restores if (!statusNew.Description.Contains("BBX")) { restoreDTO.DAVerifiedBy = Convert.ToInt32(Session["UserId"]); restoreDTO.DAVerifiedOn = DateTime.Now; } restoreDTO.ModifiedBy = Convert.ToInt32(Session["UserId"]); restoreDTO.ModifiedOn = DateTime.Now; restoreDTO.RestoreStatusId = statusNew.Id; restoreDTO.Comments = System.DateTime.Now.ToString("MM/dd/yyyy h:mm tt") + " " + Session["UserId"].ToString() + tbComment.Text + "<br/>" + restoreDTO.Comments; reMgr.UpdateGroupedUserRestore(restoreDTO);
row.Items.FindItemByKey("RestoreStatusId").Text = statusNew.Id.ToString(); row.Items.FindItemByKey("RestoreStatusId").Text = row.Items.FindItemByKey("EDDataAvailId").Text + " - " + statusNew.Name;
//update the verified-on columns for pertinent restores if (!statusNew.Description.Contains("BBX")) { int test = -1; //row.Cells.FromKey("DAVerifiedBy").Text = restoreDTO.DAVerifiedBy > 0 ? empMgr.GetEmployeeById(restoreDTO.DAVerifiedBy).DisplayName : ""; //row.Cells.FromKey("DAVerifiedOn").Text = restoreDTO.DAVerifiedOn < new DateTime(9999, 12, 31) ? restoreDTO.DAVerifiedOn.ToString(@"MM/dd/yyyy") : ""; }
setOkRow(">Updated row # " + ((row.Index) + 1).ToString() + " successfully for restore with id: " + restoreId, row); } else setErrorRow(">Error occured updating row # " + ((row.Index) + 1).ToString() + ". Details: " + "can't update status " + statusCurrent.Name + " to Validated.", row); } catch (Exception e1) { setErrorRow(">Error occured updating row # " + ((row.Index) + 1).ToString() + ". Details: " + e1.Message, row); }
#region if mark restored was pressed else if (sender == "Mark Restored") { foreach (GridRecord row in wdg_TechRestores.Behaviors.Selection.SelectedRows) {
try { GlobalLookupDTO statusCurrent = SiteHelper.GetGlobalLookupById(Convert.ToInt32(row.Items.FindItemByKey("RestoreStatusId").Text));
//only searched and validated can be updated to restored if (statusCurrent.Id == statusSearchedAndVerified.Id || statusCurrent.Id == statusTWSearchedAndVerified.Id || statusCurrent.Id == statusBBXSearchedAndVerified.Id || statusCurrent.Id == statusLumSearchedAndVerified.Id) { int restoreId = Convert.ToInt32(row.Items.FindItemByKey("Id").Text);
RestoreDTO restoreDTO = reMgr.GetRestorebyId(restoreId);
GlobalLookupDTO statusNew; if (statusCurrent == statusSearchedAndVerified) statusNew = statusRestored; else if (statusCurrent == statusTWSearchedAndVerified) statusNew = statusTWRestored; else if (statusCurrent == statusLumSearchedAndVerified) statusNew = statusLumRestored; else statusNew = statusBBXRestored;
//restored msgs count must be greater than 0 if (restoreDTO.DAMsgsRestored > 0) { restoreDTO.ModifiedBy = Convert.ToInt32(Session["UserId"]); restoreDTO.ModifiedOn = DateTime.Now; restoreDTO.RestoreStatusId = statusNew.Id; restoreDTO.RestoredOn = DateTime.Now; restoreDTO.RestoredBy = Convert.ToInt32(Session["UserId"]); restoreDTO.Comments = System.DateTime.Now.ToString("MM/dd/yyyy h:mm tt") + " " + Session["UserId"].ToString() + tbComment.Text + "<br/>" + restoreDTO.Comments; reMgr.UpdateGroupedUserRestore(restoreDTO);
setOkRow(">Updated row # " + ((row.Index) + 1).ToString() + " successfully for restore with id: " + restoreId, row); } else setErrorRow(">Error occured updating row # " + ((row.Index) + 1).ToString() + ". Details: " + "Restored Msgs count must be greater than 0.", row); } else setErrorRow(">Error occured updating row # " + ((row.Index) + 1).ToString() + ". Details: " + "Can't update status " + statusCurrent.Name + " to Restored.", row); } catch (Exception e1) { setErrorRow(">Error occured updating row # " + ((row.Index) + 1).ToString() + ". Details: " + e1.Message, row); } } } #endregion
#region if mark no hits was pressed else if (sender == "Mark Completed - No Hits") { foreach (GridRecord row in wdg_TechRestores.Behaviors.Selection.SelectedRows) { try { GlobalLookupDTO statusCurrent = SiteHelper.GetGlobalLookupById(Convert.ToInt32(row.Items.FindItemByKey("RestoreStatusId").Text));
//only searched and validated can be updated to completed with no hits if (statusCurrent.Id == statusSearchedAndVerified.Id || statusCurrent.Id == statusTWSearchedAndVerified.Id || statusCurrent.Id == statusBBXSearchedAndVerified.Id) { int restoreId = Convert.ToInt32(row.Items.FindItemByKey("Id").Text);
GlobalLookupDTO statusNew; if (statusCurrent == statusSearchedAndVerified) statusNew = statusCompleted; else if (statusCurrent == statusTWSearchedAndVerified) statusNew = statusTWCompleted; else statusNew = statusBBXCompleted;
//restored msgs count must be equal 0 if (restoreDTO.DAMsgsRestored == 0) { restoreDTO.ModifiedBy = Convert.ToInt32(Session["UserId"]); restoreDTO.ModifiedOn = DateTime.Now; restoreDTO.RestoreStatusId = statusNew.Id; restoreDTO.Comments = System.DateTime.Now.ToString("MM/dd/yyyy h:mm tt") + " " + Session["UserId"].ToString() + tbComment.Text + "<br/>" + restoreDTO.Comments; reMgr.UpdateGroupedUserRestore(restoreDTO);
int invId = Convert.ToInt32(wddInvestigations.SelectedValue); SendNotification_Complete(invId, restoreDTO);
setOkRow(">Updated row # " + ((row.Index) + 1).ToString() + " successfully for restore with id: " + restoreId, row); } else setErrorRow(">Error occured updating row # " + ((row.Index) + 1).ToString() + ". Details: " + "Restored Msgs count must equal 0.", row); } else setErrorRow(">Error occured updating row # " + ((row.Index) + 1).ToString() + ". Details: " + "Can't update status " + statusCurrent.Name + " to Completed.", row); } catch (Exception e1) { setErrorRow(">Error occured updating row # " + ((row.Index) + 1).ToString() + ". Details: " + e1.Message, row); } } } #endregion
#region if mark completed was pressed else if (sender == "Mark Completed") { foreach (GridRecord row in wdg_TechRestores.Behaviors.Selection.SelectedRows) {
//only restored can be updated as completed if (statusCurrent.Id == statusRestored.Id || statusCurrent.Id == statusTWRestored.Id || statusCurrent.Id == statusBBXRestored.Id || statusCurrent.Id == statusLumRestored.Id) { int restoreId = Convert.ToInt32(row.Items.FindItemByKey("Id").Text);
GlobalLookupDTO statusNew; // if (statusCurrent == statusBBXRestored) // statusNew = statusBBXCompleted;
if (statusCurrent == statusRestored) statusNew = statusCompleted;
else if (statusCurrent == statusTWRestored) statusNew = statusTWCompleted;
else if (statusCurrent == statusBBXRestored) statusNew = statusBBXCompleted;
// else if (statusCurrent == statusLumRestored) // statusNew = statusLumCompleted;
else // statusNew = statusCompleted; statusNew = statusLumCompleted;
//restored msgs count must be greater than 0 if (restoreDTO.PSTCount > 0) { restoreDTO.ModifiedBy = Convert.ToInt32(Session["UserId"]); restoreDTO.ModifiedOn = DateTime.Now; restoreDTO.RestoreStatusId = statusNew.Id; restoreDTO.Comments = System.DateTime.Now.ToString("MM/dd/yyyy h:mm tt") + " " + Session["UserId"].ToString() + tbComment.Text + "<br/>" + restoreDTO.Comments; reMgr.UpdateGroupedUserRestore(restoreDTO);
setOkRow(">Updated row # " + ((row.Index) + 1).ToString() + " successfully for restore with id: " + restoreId, row); } else setErrorRow(">Error occured updating row # " + ((row.Index) + 1).ToString() + ". Details: " + "PST count must be greater than 0.", row); } else setErrorRow(">Error occured updating row # " + ((row.Index) + 1).ToString() + ". Details: " + "Can't update status " + statusCurrent.Name + " to Completed.", row); } catch (Exception e1) { setErrorRow(">Error occured updating row # " + ((row.Index) + 1).ToString() + ". Details: " + e1.Message, row); } }
} #endregion
#region if invalid, re-searching was pressed else if (sender == "Invalid - Researching") { foreach (GridRecord row in wdg_TechRestores.Rows) {
//only statuses earlier than restored can be marked invalid List<GlobalLookupDTO> statusesThatCanBeInvalid = new List<GlobalLookupDTO>(); statusesThatCanBeInvalid.Add(statusAssigned); statusesThatCanBeInvalid.Add(statusVerified); statusesThatCanBeInvalid.Add(statusSearchedAndVerified); statusesThatCanBeInvalid.Add(statusSearched); statusesThatCanBeInvalid.Add(statusTWSearched); statusesThatCanBeInvalid.Add(statusTWSearchedAndVerified); statusesThatCanBeInvalid.Add(statusTWVerified); statusesThatCanBeInvalid.Add(statusTWAssigned);
if (statusesThatCanBeInvalid.Contains(statusCurrent)) { int restoreId = Convert.ToInt32(row.Items.FindItemByKey("Id").Text);
GlobalLookupDTO statusNew; if (statusCurrent.Description.Contains("TW")) statusNew = statusTWInvalidAssigned; else statusNew = statusInvalidAssigned;
RestoreDTO restoreDTO = reMgr.GetRestorebyId(restoreId); restoreDTO.ModifiedBy = Convert.ToInt32(Session["UserId"]); restoreDTO.ModifiedOn = DateTime.Now; restoreDTO.RestoreStatusId = statusNew.Id; restoreDTO.Comments = System.DateTime.Now.ToString("MM/dd/yyyy h:mm tt") + " " + Session["UserId"].ToString() + tbComment.Text + "<br/>" + restoreDTO.Comments; restoreDTO.DAVerifiedBy = Convert.ToInt32(Session["UserId"]); restoreDTO.DAVerifiedOn = DateTime.Now; reMgr.UpdateGroupedUserRestore(restoreDTO);
//row.Cells.FromKey("DAVerifiedBy").Text = restoreDTO.DAVerifiedBy > 0 ? empMgr.GetEmployeeById(restoreDTO.DAVerifiedBy).DisplayName : ""; //row.Cells.FromKey("DAVerifiedOn").Text = restoreDTO.DAVerifiedOn < new DateTime(9999, 12, 31) ? restoreDTO.DAVerifiedOn.ToString(@"MM/dd/yyyy") : "";
//add record for the new restore. primary and secondary become flipped
RestoreDTO restDTO = new RestoreDTO(); restDTO.InvUserGroupId = restoreDTO.InvUserGroupId; restDTO.MsgTypeId = restoreDTO.MsgTypeId; restDTO.StartDate = restoreDTO.StartDate; restDTO.EndDate = restoreDTO.EndDate; restDTO.SearchTermId = restoreDTO.SearchTermId; restDTO.CommTermId = restoreDTO.CommTermId; restDTO.SearchCriteria = restoreDTO.SearchCriteria; restDTO.PSTNameToUse = restoreDTO.PSTNameToUse; restDTO.SearchOnly = restoreDTO.SearchOnly; restDTO.EDDataAvailId = restoreDTO.EDDataAvailId; restDTO.ParentRestoreId = restoreDTO.Id; restDTO.ExistingPSTId = restoreDTO.ExistingPSTId; restDTO.TapeRecordId = restoreDTO.TapeRecordId; restDTO.RetentionDays = restoreDTO.RetentionDays; restDTO.Comments = ""; restDTO.RestoreStatusId = statusCurrent.Description.Contains("TW") ? statusTWAssigned.Id : statusAssigned.Id;
restDTO.DADatabase = restoreDTO.DADatabase; restDTO.IsActive = true; restDTO.IsDeleted = false;
restDTO.PrimaryAssignedTo = restoreDTO.SecondaryAssgnedTo; restDTO.SecondaryAssgnedTo = restoreDTO.PrimaryAssignedTo;
restDTO.CreatedBy = restDTO.PrimaryAssignedTo; restDTO.CreatedOn = DateTime.Now;
restDTO.ModifiedBy = restDTO.PrimaryAssignedTo; restDTO.ModifiedOn = DateTime.Now;
restDTO.RestoredOn = SiteHelper.GetFutureDate(); restDTO.DAVerifiedBy = 0; restDTO.DAVerifiedOn = SiteHelper.GetFutureDate();
// Reseting the JournlingVaults so that they are added to the DB foreach (JournlingVaultsDTO jvDto in restoreDTO.Vaults) { JournlingVaultsDTO jdto = new JournlingVaultsDTO(); jdto.ServerName = jvDto.ServerName; jdto.VaultName = jvDto.VaultName; jdto.IsActive = true; jdto.IsDeleted = false; jdto.CreatedBy = restDTO.PrimaryAssignedTo; jdto.CreatedOn = DateTime.Now;
jdto.ModifiedBy = restDTO.PrimaryAssignedTo; jdto.ModifiedOn = DateTime.Now;
restDTO.Vaults.Add(jdto); } reMgr.AddGroupedUserRestore(restDTO);
int invId = Convert.ToInt32(wddInvestigations.SelectedValue); SendNotification_Invalid_Reassigned(invId, restoreDTO, tbComment.Text);
setOkRow(">Updated row # " + ((row.Index) + 1).ToString() + " successfully for restore with id: " + restoreId, row); } else setErrorRow(">Error occured updating row # " + ((row.Index) + 1).ToString() + ". Details: " + statusCurrent.Name + " cannot be marked as Invalid.", row); } catch (Exception e1) { setErrorRow(">Error occured updating row # " + ((row.Index) + 1).ToString() + ". Details: " + e1.Message, row); } }
#region if invalid, not re-searching was pressed if (sender == "Mark Invalid") { foreach (GridRecord row in wdg_TechRestores.Rows) { try { GlobalLookupDTO statusCurrent = SiteHelper.GetGlobalLookupById(Convert.ToInt32(row.Items.FindItemByKey("RestoreStatusId").Text));
GlobalLookupDTO statusNew; if (statusCurrent.Description.Contains("TW")) statusNew = statusTWInvalid; else statusNew = statusInvalid;
int invId = Convert.ToInt32(wddInvestigations.SelectedValue);
SendNotification_Invalid(invId, restoreDTO, tbComment.Text);
if (errDiv.InnerHtml == "") errDiv.InnerHtml = "None"; if (okDiv.InnerHtml == "") okDiv.InnerHtml = "None"; }
GetGlobalLookupByCodeLookup method
:
public static GlobalLookupDTO GetGlobalLookupByCodeLookup(string strCodeLookup) { GlobalLookupDTO returnValue ; try { HttpApplication ctx = (HttpApplication)HttpContext.Current.ApplicationInstance; List<GlobalLookupDTO> glookups = (List<GlobalLookupDTO>)ctx.Session["GlobalLookup"];
var gLookups = from lkp in glookups where lkp.CodeLookup == strCodeLookup select lkp;
returnValue = gLookups.First(); } catch (Exception ex) { returnValue = null; throw new Exception("Lookup Value Not Found In Database ! Value: " + strCodeLookup); } return returnValue; }
Many thanks in advance.
We are glad you managed to resolve your issue. Please, let us know if you need further assistance on the matter.
Hi,
if (wdGrid_PSTS.DataSource == null) {
wdGrid_PSTS.Behaviors.Sorting.SortedColumns.Clear(); wdGrid_PSTS.ClearDataSource(); wdGrid_PSTS.Rows.Clear(); // string s=string.Empty; }
i have added this piece of code in ddlselected indexchange and it is working. Will post you if it failed again.Please give a remark on that code.Thanks for your help
I used the sorting function you posted earlier but I am still able to clear the grid afterwards. Please, send us a small sample application (or update the one I am attaching) demonstrating the issue, so we can investigate this further.
2553.WebDataGrid_sample_v2.zip