문제

I have grid that gets created in the code behind. Grid has columns like Description, Language. Issue is the headertext for these 2 columns is not getting left aligned. The data within the grid have left alignement.

Is there anything I am missing to specify left alignment for the header column text.

Thanks.

                SPGridView gridView = new SPGridView();
                gridView.AutoGenerateColumns = false;

                // create the bound fields
                SPBoundField boundField;
                boundField = new SPBoundField();
                boundField.HeaderText = "Description";
                boundField.DataField = "Description";
                boundField.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
                boundField.ItemStyle.Wrap = false;
                gridView.Columns.Add(boundField); 


                boundField = new SPBoundField();
                boundField.HeaderText = "Language";
                boundField.DataField = "Language";
                boundField.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
                gridView.Columns.Add(boundField);

                gridView.DataSource = dt.DefaultView;
                gridView.DataBind();
도움이 되었습니까?

해결책

You have to set the alignment of the Header as well.

boundField.HeaderStyle.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Left;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top