Hi,
Thanks in advance,
Im developing in portal I created dynamically four columns in gridview rowdata bound .first column is client,2nd columns in role/position,3rd column in from date -todate (dropdownlist),fourth columns is contnent These are executed when parsing resume.Ineed alignment for these fourcolumns,
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;
}
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);
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);
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);
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 = 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);
TextBox txtProjDesc = new TextBox();
txtProjDesc.ID = "txtProjDescID" + e.Row.RowIndex.ToString();
AjaxControlToolkit.FilteredTextBoxExtender FtxtProjDesc = new AjaxControlToolkit.FilteredTextBoxExtender();
FtxtProjDesc.FilterMode = AjaxControlToolkit.FilterModes.InvalidChars;
FtxtProjDesc.InvalidChars = "<>$%&()=~`_|@*~!^?/;\"'\\[]{}";
FtxtProjDesc.TargetControlID = txtProjDesc.ID;
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);
ImageButton imgDelProject = new ImageButton();
imgDelProject.Attributes.Add("runat", "server");
imgDelProject.CausesValidation = 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);
}
}
[edit]code block added[/edit]