protected void WorkExp_Grid_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.Cells[0].Text.Length == 0 || e.Row.Cells[0].Text.Equals(" ") || e.Row.Cells[0].Text.Equals("") || e.Row.Cells[0].Text.Equals(string.Empty)) { e.Row.Cells[0].Text = string.Empty; } // Start Date string[] startdate = e.Row.Cells[2].Text.Split('/'); DropDownList s_m_dl1 = new DropDownList(); s_m_dl1.DataSource = monthDataSource(); s_m_dl1.DataBind(); s_m_dl1.SelectedIndex = Convert.ToInt32(startdate[1]); DropDownList s_y_dl1 = new DropDownList(); s_y_dl1.DataSource = yearDataSource(); s_y_dl1.DataBind(); s_y_dl1.SelectedIndex = Convert.ToInt32(startdate[2]); s_y_dl1.Width = 100; Image mandImg1 = new ImageButton(); mandImg1.ImageUrl = "../common/images/Mandatory.gif"; e.Row.Cells[2].Controls.Add(mandImg1); e.Row.Cells[2].Controls.Add(s_m_dl1); e.Row.Cells[2].Controls.Add(new LiteralControl("<br><br> ")); e.Row.Cells[2].Controls.Add(s_y_dl1); //Shankar : End Date string[] enddate = e.Row.Cells[3].Text.Split('/'); DropDownList e_m_dl1 = new DropDownList(); e_m_dl1.DataSource = monthDataSource(); e_m_dl1.DataBind(); e_m_dl1.SelectedIndex = Convert.ToInt32(enddate[1]); DropDownList e_y_dl1 = new DropDownList(); e_y_dl1.DataSource = yearDataSource(); e_y_dl1.DataBind(); e_y_dl1.SelectedIndex = Convert.ToInt32(enddate[2]); e_y_dl1.Width = 100; Image mandImg2 = new ImageButton(); mandImg2.ImageUrl = "../common/images/Mandatory.gif"; e.Row.Cells[3].Controls.Add(mandImg2); e.Row.Cells[3].Controls.Add(e_m_dl1); e.Row.Cells[3].Controls.Add(new LiteralControl("<br><br> ")); e.Row.Cells[3].Controls.Add(e_y_dl1); //Shankar : ClientID textbox TextBox txtClientData = new TextBox(); txtClientData.Text = e.Row.Cells[0].Text; txtClientData.ID = "clientTXT"; AjaxControlToolkit.FilteredTextBoxExtender FtxtClientData = new AjaxControlToolkit.FilteredTextBoxExtender(); FtxtClientData.FilterMode = AjaxControlToolkit.FilterModes.InvalidChars; FtxtClientData.InvalidChars = "<>#$%&():+=~`_-|@*~!^?/;\",'\\[]{}"; FtxtClientData.TargetControlID = txtClientData.ID; txtClientData.Height = 11; Image mandImg3 = new ImageButton(); mandImg3.ImageUrl = "../common/images/Mandatory.gif"; Label lblProjNum = new Label(); lblProjNum.Text = "Project " + (e.Row.DataItemIndex + 1).ToString(); lblProjNum.Attributes.Add("style", "font-weight:bold;font-size:12px"); e.Row.Cells[0].Controls.Add(mandImg3); e.Row.Cells[0].Controls.Add(txtClientData); e.Row.Cells[0].Controls.Add(FtxtClientData); e.Row.Cells[0].Controls.Add(new LiteralControl("<br>")); e.Row.Cells[0].Controls.Add(lblProjNum); //Shankar : Position/Role textbox TextBox txtPosRole = new TextBox(); if (e.Row.Cells[1].Text.Length == 0 || e.Row.Cells[1].Text.Equals(" ") || e.Row.Cells[1].Text.Equals("") || e.Row.Cells[1].Text.Equals(string.Empty)) { //e.Row.Cells[1].Text = " "; e.Row.Cells[1].Text = string.Empty; } txtPosRole.Text = e.Row.Cells[1].Text; txtPosRole.ID = "txtPosRoleID"; AjaxControlToolkit.FilteredTextBoxExtender FtxtPosRole = new AjaxControlToolkit.FilteredTextBoxExtender(); FtxtPosRole.FilterMode = AjaxControlToolkit.FilterModes.InvalidChars; FtxtPosRole.InvalidChars = "<>#$%&():+=~`_-|@*~!^?/;\",'\\[]{}"; FtxtPosRole.TargetControlID = txtPosRole.ID; txtPosRole.Height = 11; e.Row.Cells[1].Controls.Add(txtPosRole); e.Row.Cells[1].Controls.Add(FtxtPosRole); //Shankar : Project content TextBox txtProjDesc = new TextBox(); txtProjDesc.ID = "txtProjDescID" + e.Row.RowIndex.ToString(); //txtProjDesc.Attributes.Add("onkeypress", "javascript:return fnCheckAlphabets(event);"); AjaxControlToolkit.FilteredTextBoxExtender FtxtProjDesc = new AjaxControlToolkit.FilteredTextBoxExtender(); FtxtProjDesc.FilterMode = AjaxControlToolkit.FilterModes.InvalidChars; FtxtProjDesc.InvalidChars = "<>$%&()=~`_|@*~!^?/;\"'\\[]{}"; FtxtProjDesc.TargetControlID = txtProjDesc.ID; //txtProjDesc.Attributes.Add("onkeypress", "javascript:return fnCheckAlphabets(event);"); txtProjDesc.TextMode = TextBoxMode.MultiLine; txtProjDesc.Rows = 10; txtProjDesc.Columns = 30; if (e.Row.Cells[4].Text.Length == 0 || e.Row.Cells[4].Text.Equals(" ") || e.Row.Cells[4].Text.Equals("") || e.Row.Cells[4].Text.Equals(string.Empty)) { e.Row.Cells[4].Text = string.Empty; } txtProjDesc.Text = e.Row.Cells[4].Text; txtProjDesc.Text = txtProjDesc.Text.Replace(" ", ""); txtProjDesc.Font.Size = FontUnit.Small; e.Row.Cells[4].Controls.Add(txtProjDesc); e.Row.Cells[4].Controls.Add(FtxtProjDesc); //Shankar : Delete Project Button ImageButton imgDelProject = new ImageButton(); imgDelProject.Attributes.Add("runat", "server"); imgDelProject.CausesValidation = false; //imgDelProject.Attributes.Add("UseSubmitBehavior", "true"); //imgDelProject.OnClientClick = "$(this).SuccessBox('Project has been deleted successfully.'); return false;"; imgDelProject.OnClientClick = "javascript:collectJSONData(); return ConfirmDeleteProject();"; imgDelProject.EnableViewState = true; imgDelProject.ImageUrl = "../common/images/delete.jpg"; imgDelProject.ToolTip = "Delete Project"; imgDelProject.Command += new System.Web.UI.WebControls.CommandEventHandler(this.DeleteProject); imgDelProject.CommandName = e.Row.DataItemIndex.ToString(); e.Row.Cells[5].Controls.Add(imgDelProject); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)