0
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);

}

I want to make that radiobuttons fit in that cell not centered but couldnt able to do it, how can i do it any help?

Screenshot

3 Answers 3

2

Simply add Attributes

HtmlTable tbl = new HtmlTable();
tbl.Attributes.Add("class","ClassName");
Sign up to request clarification or add additional context in comments.

Comments

0

remove c.Align = "center"; and put these radiobuttons inside table with one row and n cells with width=100% to fit it in the parent cell

Comments

0

Is it possible to have it created inside a particular div? You could then base all the classes on that div. So lets say the table appears inside:

<div id="new-table"></div>

You could do your css definitions like this:

#new-table table{   }
#new-table tr{   }
#new-table td{text-align:left;}

Do you have a way of giving a unique class to the div with the radio buttons?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.