void GenerateSurvey(string AnketId, System.Web.UI.WebControls.PlaceHolder plch)
{
var db = new Xrm.XrmDataContext(Microsoft.Xrm.Client.CrmConnection.Parse(Utils.getXrmConnectionString(_PortalBrandHelper.BrandProxy.BrandDedicatedCrmOrgName)));
var AnketSoru = from p in db.new_survey_questions
orderby p.new_rank
select new { p.new_survey_questionid, p.new_question_text, p.new_question_type, p.new_rank, p.new_min_enumerator, p.new_max_enumerator };
HtmlTable tbl = new HtmlTable();
tbl.CellPadding = 2;
tbl.CellSpacing = 3;
HtmlTableRow r = new HtmlTableRow();
HtmlTableCell c = new HtmlTableCell();
c.InnerHtml = "<h3>İMMİB</h3>";
c.ColSpan = 2;
c.Align = "center";
r.Cells.Add(c);
tbl.Border = 1;
tbl.ID = "Survey_Inner";
tbl.Rows.Add(r);
c = new HtmlTableCell();
r = new HtmlTableRow();
c.ColSpan = 2;
c.InnerHtml = "<h4>EĞİTİM DEĞERLENDİRME FORMU</h4>";
c.Align = "center";
r.Cells.Add(c);
tbl.Rows.Add(r);
foreach (var item in AnketSoru)
{
r = new HtmlTableRow();
c = new HtmlTableCell();
c.InnerHtml = item.new_question_text.ToString();
r.Cells.Add(c);
switch (item.new_question_type.ToString())
{
case "2": //FreeText
c = new HtmlTableCell();
TxtFreeText = new TextBox();
TxtFreeText.ID = "Txt_" + item.new_survey_questionid.ToString();
TxtFreeText.TextMode = TextBoxMode.MultiLine;
TxtFreeText.Width = 300;
TxtFreeText.Height = 50;
TxtFreeText.EnableViewState = true;
c.Controls.Add(TxtFreeText);
break;
case "3": //CheckBox
c.ColSpan = 2;
var choises = from c1 in db.new_survey_question_choices
where c1.new_survey_questionid == item.new_survey_questionid
select c1;
ChkSecimler = new CheckBoxList();
ChkSecimler.ID = "Chkl_" + item.new_survey_questionid.ToString();
ChkSecimler.RepeatDirection = RepeatDirection.Horizontal;
ChkSecimler.RepeatColumns = 2;
foreach (var ck in choises)
{
LiSecim = new ListItem();
LiSecim.Text = ck.new_name;
ChkSecimler.Items.Add(LiSecim);
}
c.Controls.Add(ChkSecimler);
break;
case "4": //Enumeration ***RadioButton***
c = new HtmlTableCell();
RdSecimler = new RadioButtonList();
RdSecimler.ID = "Rdl_" + item.new_survey_questionid.ToString();
RdSecimler.RepeatDirection = RepeatDirection.Horizontal;
c.Align = "center";
for (int i = Convert.ToInt32(item.new_min_enumerator); i <= Convert.ToInt32(item.new_max_enumerator); i++)
{
LiSecim = new ListItem();
LiSecim.Text = i.ToString();
RdSecimler.Items.Add(LiSecim);
}
c.Controls.Add(RdSecimler);
break;
default:
break;
}
r.Cells.Add(c);
tbl.Rows.Add(r);
}
plch.Controls.Add(tbl);
}
我想讓單選按鈕適合那個單元不居中但不能做到這一點,我該如何做到這一點?如何將css屬性設置爲動態創建的表格?