protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!IsPostBack)
{
Session["SearchRes"] = null;
if (Session["TaskName"] != null)
lblTskName.Text = Session["TaskName"].ToString();
Session["FilColms"] = null;
Session["SortExp"] = null;
Session["FilExp"] = null;
Session["ViewAll"] = null;
BindGrid();
}
}
catch (Exception ex)
{
throw ex;
}
}
private void BindGrid()
{
try
{
DataSet dsResult = new DataSet();
clsSearch_BL clsObj = new clsSearch_BL();
clsObj.TaskID = (string)Session["TaskID"];
clsObj.CustName = (string)Session["CustName"];
clsObj.MarketName = (string)Session["MarketName"];
clsObj.HeadendName = (string)Session["HeadendName"];
clsObj.SiteName = (string)Session["SiteName"];
clsObj.TaskStatus = (string)Session["TaskStatus"];
clsObj.OrdType = (string)Session["OrdType"];
clsObj.OrdStatus = (string)Session["OrdStatus"];
clsObj.ProName = (string)Session["ProName"];
clsObj.LOC = (string)Session["LOC"];
clsObj.QuoteID = (string)Session["QuoteID"];
clsObj.CMNumber = (string)Session["CMNumber"];
if (Session["SearchRes"] == null)
{
dsResult = clsObj.getSearchResults_BL(clsObj);
Session["SearchRes"] = dsResult;
}
else
dsResult = (DataSet)Session["SearchRes"];
DataView dataView = dsResult.Tables[0].DefaultView;
rg200.DataSource = dsResult;
rg200.DataBind();
}
catch (Exception ex)
{
throw ex;
}
}
protected void rg200_PreRender(object sender, EventArgs e)
{
rg200.MasterTableView.GetColumnSafe("RowIndicator").Display = false;
if (rg200.EditIndexes.Count > 0 || rg200.MasterTableView.IsItemInserted)
{
GridColumn col1 = rg200.MasterTableView.GetColumn("EditCommandColumn") as GridColumn;
col1.Visible = true;
}
else
{
GridColumn col2 = rg200.MasterTableView.GetColumn("EditCommandColumn") as GridColumn;
col2.Visible = false;
}
}
protected void RadMenu1_ItemClick(object sender, RadMenuEventArgs e)
{
int radGridClickedRowIndex;
radGridClickedRowIndex = Convert.ToInt32(Request.Form["radGridClickedRowIndex"]);
switch (e.Item.Text)
{
case "Edit Task":
rg200.Items[radGridClickedRowIndex].Edit = true;
BindGrid();
// rg200.Rebind();
break;
case "Complete Task":
//rg200.MasterTableView.PerformDelete(rg200.Items[radGridClickedRowIndex]);
break;
}
}
protected void rg200_ItemCreated(object sender, GridItemEventArgs e)
{
if (e.Item is GridPagerItem)
{
RadComboBox combo = (e.Item as GridPagerItem).FindControl("PageSizeComboBox") as RadComboBox;
// The number of items shown when all is selected
int allRowsCount = int.MaxValue;
// Remove duplicates
RadComboBoxItem duplicate = combo.Items.FindItemByValue(allRowsCount.ToString());
if (duplicate != null)
{
duplicate.Remove();
}
// Create a new item for showing all
RadComboBoxItem item = new RadComboBoxItem("All", allRowsCount.ToString());
item.Attributes.Add("ownerTableViewId", e.Item.OwnerTableView.ClientID);
combo.Items.Add(item);
// Set the current pagesize as the selected value
combo.Items.FindItemByValue(rg200.PageSize.ToString()).Selected = true;
}
}
protected void rg200_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
if (Session["TaskID"] != null)
{
string strTaskID = (string)Session["TaskID"];
if (strTaskID != string.Empty)
{
clsTaskUpdates_BL objBL = new clsTaskUpdates_BL();
GridEditableItem eeditedItem = e.Item as GridEditableItem;
//Get the primary key value using the DataKeyValue.
string OrdID = editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["orderId"].ToString();
//Access the textbox from the edit form template and store the values in string variables.
string ClarifyAccountNbr = ((GridTextBoxColumnEditor)editedItem.EditManager.GetColumnEditor("Clarify Account Nbr")).TextBoxControl.Text;
string SiteID = ((GridTextBoxColumnEditor)editedItem.EditManager.GetColumnEditor("Site ID")).TextBoxControl.Text;
string QuoteID = ((GridTextBoxColumnEditor)editedItem.EditManager.GetColumnEditor("Quote ID")).TextBoxControl.Text;
CheckBox chkEDP = ((GridCheckBoxColumnEditor)editedItem.EditManager.GetColumnEditor("EDP Created?")).CheckBoxControl;
//string ClarifyAccountNbr = (editedItem["Clarify Account Nbr"].Controls[0] as TextBox).Text;
//string SiteID = (editedItem["Site ID"].Controls[0] as TextBox).Text;
//string QuoteID = (editedItem["Quote ID"].Controls[0] as TextBox).Text;
//CheckBox chkEDP = (editedItem["EDP Created?"].Controls[0] as CheckBox);
try
{
objBL.setTask200_Bl(OrdID, ClarifyAccountNbr, SiteID, QuoteID, chkEDP.Checked);
Session["SearchRes"] = null;
BindGrid();
}
catch (Exception ex)
{
rg200.Controls.Add(new LiteralControl("Unable to update Employee. Reason: " + ex.Message));
e.Canceled = true;
}
}
}
}
protected void rg200_PageIndexChanged(object source, GridPageChangedEventArgs e)
{
try
{
rg200.CurrentPageIndex = e.NewPageIndex;
BindGrid();
}
catch (Exception ex)
{
throw ex;
}
} |