将div放入另一个 [英] put div into another

查看:74
本文介绍了将div放入另一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

take a look here
http://www.gfln.org/default4.aspx

now when u click on radio button 1(from 1 to 7) it generate 3 <TD> (two have text name and telephone and other have textbox which is server side control)on run time now problem is whne u click on any other radio button say greater than 1 it overlaps td

here is code behind radiobuttonlist


Protected Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButtonList1.SelectedIndexChanged<br />
<br />
 Dim newdiv As New HtmlGenericControl("div")<br />
            Dim ht As New HtmlTable()<br />
            ht.ID = "mytable" & index<br />
            ht.Width = "100%"<br />
            ht.CellSpacing = "0"<br />
            ht.CellPadding = "0"<br />
            ht.Border = 0<br />
<br />
            Dim htr, htr1 As New HtmlTableRow()<br />
            Dim htc, htc1, htc2, htc3, htc4, htc5 As New HtmlTableCell()<br />
            Dim name_tb As New TextBox()<br />
            name_tb.ID = "name_tb" & index<br />
            Dim Tel_tb1 As New TextBox<br />
            Tel_tb1.ID = "Tel_tb1" & index<br />
            name_tb.TextMode = TextBoxMode.SingleLine<br />
            htc.InnerText = "Name : "<br />
            htc.Width = "20%"<br />
            htc.Align = "Left"<br />
            htc1.InnerText = ""<br />
            htc1.InnerHtml = "<strong></strong>"<br />
            htc1.Width = "10%px"<br />
            htc2.Width = "70%"<br />
            htc2.Align = "left"<br />
<br />
            htc2.Controls.Add(name_tb)<br />
            htr.Controls.Add(htc)<br />
            htr.Controls.Add(htc1)<br />
            htr.Controls.Add(htc2)<br />
            ht.Controls.Add(htr)<br />
<br />
            ''make another  row <br />
            htc3.InnerText = "Telephone : "<br />
            htc3.Width = "20%"<br />
            htc3.Align = "Left"<br />
            htc4.InnerText = ""<br />
            htc4.InnerHtml = "<strong></strong>"<br />
            htc4.Width = "10%px"<br />
            htc5.Width = "70%"<br />
            htc5.Align = "left"<br />
            ''htc3.Controls.Add(Tel_tb1)<br />
            htr1.Controls.Add(htc3)<br />
            htr1.Controls.Add(htc4)<br />
            htr1.Controls.Add(htc5)<br />
<br />
            ht.Controls.Add(htr1)<br />
            newdiv.Controls.Add(ht)<br />
  newdiv.Attributes.Add("table", "ht")<br />
            newdiv.Attributes.Add("class", "right_txt_space_accm")<br />
 Me.PlaceHolder1.Controls.Add(newdiv)<br />
<br />
<br />
<br />
        Next<br />
end sub<br />



请回复



please Reply

推荐答案

好,我涵盖了我的大部分问题,但我仍然需要进一步的帮助
http://www.gfln.org/default4.aspx [
well i covered my most of the problem ,but i still need further help
http://www.gfln.org/default4.aspx[^]
here is the code behind of it i wanted to make bold of name,telephone and email but when i put in div it effect on alignmnet ,
here is the code
Protected Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButtonList1.SelectedIndexChanged

        Dim index As Integer
        For index = 1 To RadioButtonList1.SelectedValue
            Dim newdiv As New HtmlGenericControl(&quot;div&quot;)
            Dim ht As New HtmlTable()
            ht.ID = &quot;mytable&quot; &amp; index
            ht.Width = &quot;100%&quot;
            ht.CellSpacing = &quot;0&quot;
            ht.CellPadding = &quot;0&quot;
            ht.Border = 0

            Dim htr, htr1, htr2 As New HtmlTableRow()
            Dim cell, htc, htc1, htc2, htc3, htc4, htc5, htc6, htc7, htc8 As New HtmlTableCell()
            Dim name_tb As New TextBox()
            Dim sal_ddl As New DropDownList
            Dim name_req As New RequiredFieldValidator
            name_tb.ID = &quot;name_tb&quot; &amp; index
            sal_ddl.ID = &quot;sal_ddl&quot; &amp; index
            name_req.ID = &quot;req&quot; &amp; index
            sal_ddl.Items.Add(&quot;MR&quot;)
            sal_ddl.Items.Add(&quot;Ms&quot;)
            sal_ddl.Items.Add(&quot;Mrs&quot;)

            Dim Tel_tb1 As New TextBox
            Tel_tb1.ID = &quot;Tel_tb1&quot; &amp; index
            name_tb.TextMode = TextBoxMode.SingleLine
            Dim email_tb1 As New TextBox
            email_tb1.ID = &quot;email_tb1&quot; &amp; index
            email_tb1.TextMode = TextBoxMode.SingleLine
            htc.InnerText = &quot;Name : &quot;
            htc.Width = &quot;20%&quot;
            htc.Align = &quot;Left&quot;

            &#39;htc1.InnerHtml = &quot;&lt;strong&gt;&lt;/strong&gt;&quot;
            htc1.Controls.Add(sal_ddl)
            htc1.Width = &quot;10%&quot;
            htc2.Width = &quot;70%&quot;
            htc2.Align = &quot;left&quot;

            htc2.Controls.Add(name_tb)
            htr.Controls.Add(htc)
            htr.Controls.Add(htc1)
            htr.Controls.Add(htc2)
            ht.Controls.Add(htr)
            name_req.ControlToValidate = &quot;name_tb&quot;
            name_req.ErrorMessage = (&quot;Please Enter name of attendenes&quot;)
            &#39;make 2nd  row
            htc3.InnerText = &quot;Telephone : &quot;
            htc3.Width = &quot;20%&quot;
            htc3.Align = &quot;Left&quot;

            htc4.InnerHtml = &quot;&lt;strong&gt;&lt;/strong&gt;&quot;
            htc4.Width = &quot;10%&quot;
            htc5.Width = &quot;70%&quot;
            htc5.Align = &quot;left&quot;
            htc5.Controls.Add(Tel_tb1)
            htr1.Controls.Add(htc3)
            htr1.Controls.Add(htc4)
            htr1.Controls.Add(htc5)

            ht.Controls.Add(htr1)
            &#39;make 3rd  row
            htc6.InnerText = &quot;Email : &quot;
            htc6.Width = &quot;20%&quot;
            htc6.Align = &quot;Left&quot;

            htc7.InnerHtml = &quot;&lt;strong&gt;&lt;/strong&gt;&quot;
            htc7.Width = &quot;10%&quot;
            htc8.Width = &quot;70%&quot;
            htc8.Align = &quot;left&quot;
            htc8.Controls.Add(email_tb1)
            htr2.Controls.Add(htc6)
            htr2.Controls.Add(htc7)
            htr2.Controls.Add(htc8)
            ht.Controls.Add(htr2)
            &#39;Add  a blank row
            cell.ColSpan = 3
            cell.InnerHtml = &quot;&lt;br/&gt;&quot;
            Dim row As New HtmlTableRow
            row.Cells.Add(cell)
            ht.Rows.Add(row)
            newdiv.Controls.Add(ht)
            newdiv.Attributes.Add(&quot;table&quot;, &quot;ht&quot;)
            &#39;            .right_txt_space_accm{ border-bottom:#ccc solid 0px; height:23px; line-height:20px; padding-left:15px; padding-right:15px;}

            newdiv.Attributes.Add(&quot;Style&quot;, &quot;border-bottom :#ccc solid 0px&quot;)
            newdiv.Attributes.Add(&quot;style&quot;, &quot;height:23px&quot;)
            newdiv.Attributes.Add(&quot;style&quot;, &quot;padding-left:15px&quot;)
            &#39;newdiv.Attributes.Add(&quot;style&quot;, &quot;font-weight:bold&quot;)
            &#39;newdiv.Attributes.Add(&quot;style&quot;, &quot;line-height :20px&quot;)
            &#39;newdiv.Attributes.Add(&quot;style&quot;, &quot;padding-right:15px&quot;)
            &#39;&quot;class&quot;, &quot;right_txt_space_accm&quot;)
            Me.PlaceHolder1.Controls.Add(newdiv)
        Next

    End Sub



请在我的代码中进行更改,以使它变粗体.我使用innerhtml尝试了一下,但没有显示



please make changes in my code so that i get make it bold .i tried it with innerhtml but it does not showing me


这篇关于将div放入另一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆