protected void Grid_Patent_RowDeleting(Object sender, GridViewDeleteEventArgs e) { SetRowData(); if (ViewState["CurrentTable"] != null) { DataTable dt = (DataTable)ViewState["CurrentTable"]; DataRow drCurrentRow = null; int rowIndex = Convert.ToInt32(e.RowIndex); if (dt.Rows.Count > 1 && rowIndex != 0) { dt.Rows.Remove(dt.Rows[rowIndex]); drCurrentRow = dt.NewRow(); ViewState["CurrentTable"] = dt; Grid_AuthorEntry.DataSource = dt; Grid_AuthorEntry.DataBind(); SetPreviousData(); } } }
private void SelectPatent(object sender, GridViewEditEventArgs e) { ButtonSavepdf.Visible = true; PanelMain.Visible = true; PanelMain.Enabled = false; panAddAuthor.Enabled = false; // PopAppStage.Visible = false; string ID = Session["ID"].ToString(); // string PT_UTN = Session["patentseedUTNseed"].ToString(); Patent Pat = new Patent(); Patent_DAobject bus_obj = new Patent_DAobject(); // Btnsave.Enabled = false; if (ddlFilingstatus.SelectedValue == "REJ") { ddlFilingstatus.Enabled = false; Panelfilling.Enabled = false; txtRejectionRemark.Visible = true; lblRejectRemarks.Visible = true; //txtRejectionRemark.Visible = true; //lblRejectRemarks.Visible = true; } if (ddlFilingstatus.SelectedValue == "APP") { // BtnDraft.Visible = true; // setModalWindowApp(sender, e); } Pat = bus_obj.SelectPatent(ID); txtID.Text = ID; txtPatUTN.Text = Pat.Pat_UTN; txtTitle.Text = Pat.Title; txtdetailsCII.Text = Pat.DetailsColaInstitiuteIndustry; txtcountry.Text = Pat.Country; txtrevenue.Text = Convert.ToString(Pat.RevenueGenerated); SqlDataSourePatentStatus.SelectCommand = "Select * from Patent_Status where Id!='CAN' and Id!='EXP' and Id!='LAP'"; ddlFilingstatus.DataSourceID = "SqlDataSourePatentStatus"; ddlFilingstatus.DataBind(); ddlFilingstatus.SelectedValue = Pat.Filing_Status; if (ddlFilingstatus.SelectedValue == "GRN") { SqlDataSourePatentStatus.SelectCommand = "Select * from Patent_Status where Id!='CAN' and Id !='APP' and Id!='REJ' "; ddlFilingstatus.DataSourceID = "SqlDataSourePatentStatus"; ddlFilingstatus.DataBind(); ddlFilingstatus.SelectedValue = Pat.Filing_Status; // PoppanelRenewal.Visible = true; // BtnDraft.Visible = false; // Btnsave.Enabled = true; //btnRenewalview.Enabled = true; } ddlfilingoffice.SelectedValue = Pat.Filing_Office.ToString(); ddlFunding.SelectedValue = Pat.Funding.ToString(); ddlNatureofPatent.Text = Pat.NatureOfPatent.ToString(); if (Pat.Date_Of_Application.ToString() != "01/01/0001 00:00:00") { txtdateofApplication.Text = Pat.Date_Of_Application.ToShortDateString(); } // txtdateofApplication.Text = Pat.Date_Of_Application.ToShortDateString(); txtApplicationStage.Text = Pat.Application_Stage; //txtProvisionalNo.Text = Pat.Provisional_Number; //if (Pat.FilingDateprovidedPatent.ToString() != "01/01/0001 00:00:00") //{ // txtFilingDateProvided.Text = Pat.FilingDateprovidedPatent.ToShortDateString(); //} txtPatentNo.Text = Pat.Patent_Number; txtapplicationNo.Text = Pat.Application_Number; if (Pat.Grant_Date.ToString() != "01/01/0001 00:00:00") { txtGrantDate.Text = Pat.Grant_Date.ToShortDateString(); } // txtRenewalFee.Text = Pat.Renewal_Fee; if (Pat.LastRenewalFeePaiddate.ToString() != "01/01/0001 00:00:00") { txtlastRenewal.Text = Pat.LastRenewalFeePaiddate.ToShortDateString(); } //if (Pat.LastRenewalFeePaiddate.ToString() != "01/01/0001 00:00:00") //{ // txtlastRenewalFee.Text = Pat.LastRenewalFeePaiddate.ToShortDateString(); //} txtRemark.Text = Pat.Remarks; txtRejectionRemark.Text = Pat.Rejection_Remark; GridViewSearchPatent.Visible = false; DataTable dy = bus_obj.fnPatentInventorDetails(ID); ViewState["CurrentTable"] = dy; Grid_AuthorEntry.DataSource = dy; Grid_AuthorEntry.DataBind(); Grid_AuthorEntry.Visible = true; panAddAuthor.Visible = true; int rowIndex = 0; DataTable dtCurrentTable = (DataTable)ViewState["CurrentTable"]; DataRow drCurrentRow = null; if (dtCurrentTable.Rows.Count > 0) { for (int i = 1; i <= dtCurrentTable.Rows.Count; i++) { DropDownList DropdownMuNonMu = (DropDownList)Grid_AuthorEntry.Rows[rowIndex].Cells[3].FindControl("DropdownMuNonMu"); TextBox EmployeeCode = (TextBox)Grid_AuthorEntry.Rows[rowIndex].Cells[2].FindControl("EmployeeCode"); ImageButton EmployeeCodeBtnimg = (ImageButton)Grid_AuthorEntry.Rows[rowIndex].Cells[2].FindControl("EmployeeCodeBtn"); TextBox AuthorName = (TextBox)Grid_AuthorEntry.Rows[rowIndex].Cells[2].FindControl("AuthorName"); TextBox InstNme = (TextBox)Grid_AuthorEntry.Rows[rowIndex].Cells[2].FindControl("InstitutionName"); TextBox deptname = (TextBox)Grid_AuthorEntry.Rows[rowIndex].Cells[2].FindControl("DepartmentName"); HiddenField InstId = (HiddenField)Grid_AuthorEntry.Rows[rowIndex].Cells[2].FindControl("Institution"); HiddenField deptId = (HiddenField)Grid_AuthorEntry.Rows[rowIndex].Cells[2].FindControl("Department"); TextBox MailId = (TextBox)Grid_AuthorEntry.Rows[rowIndex].Cells[2].FindControl("MailId"); // DropDownList isCorrAuth = (DropDownList)Grid_AuthorEntry.Rows[rowIndex].Cells[2].FindControl("isCorrAuth"); //DropDownList AuthorType = (DropDownList)Grid_AuthorEntry.Rows[rowIndex].Cells[2].FindControl("AuthorType"); DropDownList DropdownStudentInstitutionName = (DropDownList)Grid_AuthorEntry.Rows[rowIndex].Cells[2].FindControl("DropdownStudentInstitutionName"); DropDownList DropdownStudentDepartmentName = (DropDownList)Grid_AuthorEntry.Rows[rowIndex].Cells[2].FindControl("DropdownStudentDepartmentName"); DropDownList NationalType = (DropDownList)Grid_AuthorEntry.Rows[rowIndex].Cells[2].FindControl("NationalType"); DropDownList ContinentId = (DropDownList)Grid_AuthorEntry.Rows[rowIndex].Cells[2].FindControl("ContinentId"); DropDownList DropdownMuNonMu1 = (DropDownList)Grid_AuthorEntry.Rows[0].Cells[3].FindControl("DropdownMuNonMu"); ImageButton EmployeeCodeBtnimg1 = (ImageButton)Grid_AuthorEntry.Rows[0].Cells[2].FindControl("EmployeeCodeBtn"); //ImageButton ImageButton1 = (ImageButton)Grid_AuthorEntry.Rows[rowIndex].Cells[2].FindControl("ImageButton1"); drCurrentRow = dtCurrentTable.NewRow(); DropdownMuNonMu.Text = dtCurrentTable.Rows[i - 1]["DropdownMuNonMu"].ToString(); EmployeeCode.Text = dtCurrentTable.Rows[i - 1]["EmployeeCode"].ToString(); AuthorName.Text = dtCurrentTable.Rows[i - 1]["AuthorName"].ToString(); if (DropdownMuNonMu.Text == "M") { NationalType.Visible = false; ContinentId.Visible = false; InstNme.Visible = true; deptname.Visible = true; DropdownStudentInstitutionName.Visible = false; DropdownStudentDepartmentName.Visible = false; InstNme.Text = dtCurrentTable.Rows[i - 1]["InstitutionName"].ToString(); deptname.Text = dtCurrentTable.Rows[i - 1]["DepartmentName"].ToString(); InstId.Value = dtCurrentTable.Rows[i - 1]["Institution"].ToString(); deptId.Value = dtCurrentTable.Rows[i - 1]["Department"].ToString(); } else if (DropdownMuNonMu.Text == "N") { InstNme.Visible = true; deptname.Visible = true; DropdownStudentInstitutionName.Visible = false; DropdownStudentDepartmentName.Visible = false; NationalType.Visible = true; NationalType.SelectedValue = dtCurrentTable.Rows[i - 1]["NationalType"].ToString(); if (NationalType.SelectedValue == "N") { ContinentId.Visible = false; } else { ContinentId.Visible = true; } ContinentId.SelectedValue = dtCurrentTable.Rows[i - 1]["Continent"].ToString(); InstNme.Text = dtCurrentTable.Rows[i - 1]["InstitutionName"].ToString(); deptname.Text = dtCurrentTable.Rows[i - 1]["DepartmentName"].ToString(); InstId.Value = dtCurrentTable.Rows[i - 1]["Institution"].ToString(); deptId.Value = dtCurrentTable.Rows[i - 1]["Department"].ToString(); } else if (DropdownMuNonMu.Text == "E") { InstNme.Visible = true; deptname.Visible = true; DropdownStudentInstitutionName.Visible = false; DropdownStudentDepartmentName.Visible = false; NationalType.Visible = true; NationalType.SelectedValue = dtCurrentTable.Rows[i - 1]["NationalType"].ToString(); if (NationalType.SelectedValue == "N") { ContinentId.Visible = false; } else { ContinentId.Visible = true; } ContinentId.SelectedValue = dtCurrentTable.Rows[i - 1]["Continent"].ToString(); InstNme.Text = dtCurrentTable.Rows[i - 1]["InstitutionName"].ToString(); deptname.Text = dtCurrentTable.Rows[i - 1]["DepartmentName"].ToString(); InstId.Value = dtCurrentTable.Rows[i - 1]["Institution"].ToString(); deptId.Value = dtCurrentTable.Rows[i - 1]["Department"].ToString(); } else if (DropdownMuNonMu.Text == "S") { NationalType.Visible = false; ContinentId.Visible = false; DropdownStudentInstitutionName.Visible = false; DropdownStudentDepartmentName.Visible = false; InstNme.Visible = true; deptname.Visible = true; InstNme.Text = dtCurrentTable.Rows[i - 1]["InstitutionName"].ToString(); deptname.Text = dtCurrentTable.Rows[i - 1]["DepartmentName"].ToString(); InstId.Value = dtCurrentTable.Rows[i - 1]["Institution"].ToString(); deptId.Value = dtCurrentTable.Rows[i - 1]["Department"].ToString(); //ImageButton1.Visible = true; EmployeeCodeBtnimg.Visible = false; EmployeeCode.Enabled = false; } else if (DropdownMuNonMu.Text == "O") { DropdownStudentInstitutionName.Visible = true; DropdownStudentDepartmentName.Visible = true; InstNme.Visible = false; deptname.Visible = false; AuthorName.Enabled = false; DropdownStudentInstitutionName.SelectedValue = dtCurrentTable.Rows[i - 1]["Institution"].ToString(); DropdownStudentDepartmentName.SelectedValue = dtCurrentTable.Rows[i - 1]["Department"].ToString(); EmployeeCode.Text = dtCurrentTable.Rows[i - 1]["EmployeeCode"].ToString(); MailId.Enabled = true; //ImageButton1.Visible = false; EmployeeCodeBtnimg.Enabled = false; EmployeeCodeBtnimg.Visible = true; EmployeeCode.Enabled = true; NationalType.Visible = false; ContinentId.Visible = false; } DropdownMuNonMu1.Enabled = false; EmployeeCodeBtnimg1.Enabled = false; MailId.Text = dtCurrentTable.Rows[i - 1]["MailId"].ToString(); // AuthorType.Text = dtCurrentTable.Rows[i - 1]["AuthorType"].ToString(); //isCorrAuth.Text = dtCurrentTable.Rows[i - 1]["isCorrAuth"].ToString(); if (DropdownMuNonMu.Text == "N") { EmployeeCodeBtnimg.Enabled = false; AuthorName.Enabled = true; InstNme.Enabled = true; deptname.Enabled = true; MailId.Enabled = true; } else if (DropdownMuNonMu.Text == "E") { EmployeeCodeBtnimg.Enabled = false; AuthorName.Enabled = true; InstNme.Enabled = true; deptname.Enabled = true; MailId.Enabled = true; } else if (DropdownMuNonMu.Text == "M") { EmployeeCodeBtnimg.Enabled = true; AuthorName.Enabled = false; InstNme.Enabled = false; deptname.Enabled = false; MailId.Enabled = false; } else if (DropdownMuNonMu.Text == "S") { EmployeeCodeBtnimg.Enabled = false; AuthorName.Enabled = true; DropdownStudentInstitutionName.Enabled = true; DropdownStudentInstitutionName.Enabled = true; MailId.Enabled = true; } else { MailId.Enabled = true; } rowIndex++; } ViewState["CurrentTable"] = dtCurrentTable; } //ModalPopupApp.Show(); //popgridApp.DataBind(); //popgridApp.DataSourceID = "SqlDataSource5"; //popgridApp.Visible = true; }