gridview CellEditorInitialize in c#

Microsoft ASP.NET is a world wide popular web baseg programming language.
We have to use Visual studio to do the computer programming of ASP.Net.

Devexpress is a famous visual studio plugin for Visual studio and
this post show how the devexpress ASPXDataGridView 's celleditorinitialzer is working and
how we can do coding at devexpress ASPXDataGridView 's celleditorinitialzer method.

 protected void gvAttachment_CellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e)
    {
        try
        {
            ASPxGridView gvAttachment = sender as ASPxGridView;

            if (e.Column.FieldName == "APPROVEDDATE")
            {
                if (gvAttachment.GetRowValues(e.VisibleIndex, "APPROVEDDATE") != null && Session["CatchTheField"].ToString() == "ADate")
                {
                    Session["ApprovedDate"] = (e.Editor as ASPxDateEdit).Value;
                    Session["UserUpdatedOtherFileds"] = "True";
                    Session["CatchTheField"] = null;


                    if (gvAttachment.IsEditing && e.Column.FieldName == "APPROVEDDATE")
                    {
                        if (e.Value !=null || e.Value != "")
                        {
                               //e.Editor.ReadOnly = true;
                            (e.Editor as ASPxDateEdit).ValidationSettings.RequiredField.IsRequired = false;
                        }
                    }
                  
                }
            }
            else if (e.Column.FieldName == "REQUESTEDDATE")
            {
                if (gvAttachment.GetRowValues(e.VisibleIndex, "REQUESTEDDATE") != null && Session["CatchTheField"].ToString() == "RDate")
                {
                    Session["ReqDate"] = (e.Editor as ASPxDateEdit).Value;
                    Session["UserUpdatedOtherFileds"] = "True";
                    Session["CatchTheField"] = null;
                }
            }
            else if (e.Column.FieldName == "DISCONDATE")
            {
                if (gvAttachment.GetRowValues(e.VisibleIndex, "DISCONDATE") != null && Session["CatchTheField"].ToString() == "DDate")
                {
                    Session["DisConDate"] = (e.Editor as ASPxDateEdit).Value;
                    Session["UserUpdatedOtherFileds"] = "True";
                    Session["CatchTheField"] = null;
                }
            }
            else if (e.Column.FieldName == "SHARINGSTATUS")
            {
                if (gvAttachment.GetRowValues(e.VisibleIndex, "SHARINGSTATUS") != null && Session["CatchTheField"].ToString() == "SReq")
                {
                    Session["SharingStatus"] = (e.Editor as ASPxComboBox).Value;
                    Session["UserUpdatedOtherFileds"] = "True";
                    Session["CatchTheField"] = null;
                }
            }
            else if (e.Column.FieldName == "MAIN_REMARKS")
            {
                if (gvAttachment.GetRowValues(e.VisibleIndex, "MAIN_REMARKS") != null && Session["CatchTheField"].ToString() == "MRemarks")
                {
                    Session["MainRemarks"] = (e.Editor as ASPxMemo).Value;
                    Session["UserUpdatedOtherFileds"] = "True";
                    Session["CatchTheField"] = null;
                }
            }
        }
        catch (Exception eee) {  }


    }

Comments

Popular Posts