protected void gvProjectNotes_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { Label lblUserName = (Label)e.Row.FindControl("lbluserName"); if (lblUserName.Text.ToLower().Trim() != Context.User.Identity.GetUserName().Trim()) { LinkButton lnkEdit = (LinkButton)e.Row.FindControl("lnkEdit"); lnkEdit.Visible = false; } Label lblPageID = (Label)e.Row.FindControl("lblPageID"); if (lblPageID.Text.ToLower().Trim() == PageId.ToString()) { e.Row.BackColor = Color.Aqua; //e.Row.Attributes.Add("style", "this.style.backgroundColor = '#FFFFFF';"); } } if ((e.Row.RowState & DataControlRowState.Edit) == DataControlRowState.Edit) { CommonHelper.GridViewSetFocus(e.Row); //Checking whether the Row is Data Row if (e.Row.RowType == DataControlRowType.DataRow) { //ddlProject.Enabled = false; txtProjectDDL.Enabled = false; txtProjectName.Enabled = false; txtProjectNotesDate.Enabled = false; //e.Row.Cells[5].Controls[0].Visible = false; btnSubmitNotes.Text = "Update"; Label lblProjectNotesID = e.Row.FindControl("lblProjectNotesID") as Label; DataRow dr = ProjectNotesData.GetProjectNotesById(DataUtils.GetInt(lblProjectNotesID.Text)); hfProjectNotesId.Value = lblProjectNotesID.Text; txtProjectNotesDate.Text = dr["Date"].ToString() == "" ? "" : Convert.ToDateTime(dr["Date"].ToString()).ToShortDateString(); txtNotes.Text = dr["Notes"].ToString(); txtURL.Text = dr["URL"].ToString(); ddlCategory.SelectedValue = dr["LKProjCategory"].ToString(); cbActive.Checked = DataUtils.GetBool(dr["RowIsActive"].ToString()); } } } catch (Exception ex) { LogError(Pagename, "gvAddress_RowDataBound", "", ex.Message); } }
private void ProjectNotesSetUp() { int PageId = ProjectNotesData.GetPageId(Path.GetFileName(Request.PhysicalPath)); //if (ProjectNotesData.IsNotesExist(PageId)) // btnProjectNotes1.ImageUrl = "~/Images/currentpagenotes.png"; ifProjectNotes.Src = "ProjectNotes.aspx?ProjectId=" + Request.QueryString["ProjectId"] + "&PageId=" + PageId; }
private void ProjectNotesSetUp() { int PageId = ProjectNotesData.GetPageId(Path.GetFileName(Request.PhysicalPath)); if (Request.QueryString["ProjectId"] != null) { hfProjectId.Value = Request.QueryString["ProjectId"]; ifProjectNotes.Src = "../ProjectNotes.aspx?ProjectId=" + Request.QueryString["ProjectId"] + "&PageId=" + PageId; if (ProjectNotesData.IsNotesExist(PageId, DataUtils.GetInt(hfProjectId.Value))) { btnProjectNotes.ImageUrl = "~/Images/currentpagenotes.png"; } } }
private void BindProjectNotesGrid() { DataTable dt = ProjectNotesData.GetProjectNotesList(GetProjectID(txtProjectDDL.Text), cbActiveOnly.Checked); if (dt.Rows.Count > 0) { dvProjectNotesGrid.Visible = true; gvProjectNotes.DataSource = dt; gvProjectNotes.DataBind(); } else { dvProjectNotesGrid.Visible = false; gvProjectNotes.DataSource = null; gvProjectNotes.DataBind(); } }
protected void btnSubmitNotes_Click(object sender, EventArgs e) { int pcrId = 0; string pcr = Request.QueryString["pcrid"]; if (pcr != "") { pcrId = Convert.ToInt32(pcr); } if (IsProjectNotesValid(btnSubmitNotes.Text.ToLower())) { string URL = txtURL.Text; if (!URL.Contains("http")) { URL = "http://" + URL; } if (btnSubmitNotes.Text.ToLower() == "submit") { ProjectNotesData.AddProjectNotes(GetProjectID(txtProjectDDL.Text), DataUtils.GetInt(ddlCategory.SelectedValue.ToString()), Context.User.Identity.GetUserName().Trim(), txtNotes.Text, DataUtils.GetDate(txtProjectNotesDate.Text), URL, pcrId, PageId); } else { ProjectNotesData.UpdateProjectNotes(DataUtils.GetInt(hfProjectNotesId.Value), DataUtils.GetInt(ddlCategory.SelectedValue.ToString()), txtNotes.Text, URL, cbActive.Checked); hfProjectNotesId.Value = ""; gvProjectNotes.EditIndex = -1; btnSubmitNotes.Text = "Submit"; } ddlCategory.SelectedIndex = -1; txtProjectNotesDate.Text = DateTime.Now.ToShortDateString(); txtNotes.Text = ""; txtURL.Text = ""; BindProjectNotesGrid(); } }