placeholder position
-
hi mates, how to alternate the position of placeholder? here's what i did.but i want the result alternating. client side:aspxfile
<table>
<tr>
<td>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
</td>
</tr>
<tr>
<td>
<asp:PlaceHolder ID="PlaceHolder2" runat="server"></asp:PlaceHolder>
</td>
</tr>
</table>server side: page_load
For i As Integer = 1 To 3
Dim dLabel As New Label
Dim dText As New TextBox
dLabel.ID = "lblid" & i.ToString()
dLabel.Text = "label" & i.ToString()
dLabel.Width = 10dText.ID = "txtid" & i.ToString() dText.Text = "text" & i.ToString() dText.Width = 10 PlaceHolder1.Controls.Add(dLabel) PlaceHolder2.Controls.Add(dText)
Next
RESULT: label1 label2 label3 text1 text2 text3 I WANT THE RESULT LIKE THIS: label1 text1 label2 text2 label3 text3
C# コードMicrosoft End User 2000-2008 「「「「「「「「「「「「「「「「「「「「「「「「「「「「 The best things in life are free 」」」」」」」」」」」」」」」」」」」」」」」」」」」」
-
hi mates, how to alternate the position of placeholder? here's what i did.but i want the result alternating. client side:aspxfile
<table>
<tr>
<td>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
</td>
</tr>
<tr>
<td>
<asp:PlaceHolder ID="PlaceHolder2" runat="server"></asp:PlaceHolder>
</td>
</tr>
</table>server side: page_load
For i As Integer = 1 To 3
Dim dLabel As New Label
Dim dText As New TextBox
dLabel.ID = "lblid" & i.ToString()
dLabel.Text = "label" & i.ToString()
dLabel.Width = 10dText.ID = "txtid" & i.ToString() dText.Text = "text" & i.ToString() dText.Width = 10 PlaceHolder1.Controls.Add(dLabel) PlaceHolder2.Controls.Add(dText)
Next
RESULT: label1 label2 label3 text1 text2 text3 I WANT THE RESULT LIKE THIS: label1 text1 label2 text2 label3 text3
C# コードMicrosoft End User 2000-2008 「「「「「「「「「「「「「「「「「「「「「「「「「「「「 The best things in life are free 」」」」」」」」」」」」」」」」」」」」」」」」」」」」
Add this line of code
PlaceHolder1.Controls.Add(new LiteralControl(" "))
before you add control label, same do forPlaceHolder2
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.cacttus.com
-
hi mates, how to alternate the position of placeholder? here's what i did.but i want the result alternating. client side:aspxfile
<table>
<tr>
<td>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
</td>
</tr>
<tr>
<td>
<asp:PlaceHolder ID="PlaceHolder2" runat="server"></asp:PlaceHolder>
</td>
</tr>
</table>server side: page_load
For i As Integer = 1 To 3
Dim dLabel As New Label
Dim dText As New TextBox
dLabel.ID = "lblid" & i.ToString()
dLabel.Text = "label" & i.ToString()
dLabel.Width = 10dText.ID = "txtid" & i.ToString() dText.Text = "text" & i.ToString() dText.Width = 10 PlaceHolder1.Controls.Add(dLabel) PlaceHolder2.Controls.Add(dText)
Next
RESULT: label1 label2 label3 text1 text2 text3 I WANT THE RESULT LIKE THIS: label1 text1 label2 text2 label3 text3
C# コードMicrosoft End User 2000-2008 「「「「「「「「「「「「「「「「「「「「「「「「「「「「 The best things in life are free 」」」」」」」」」」」」」」」」」」」」」」」」」」」」
@BlueBoy Good One..
-
hi mates, how to alternate the position of placeholder? here's what i did.but i want the result alternating. client side:aspxfile
<table>
<tr>
<td>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
</td>
</tr>
<tr>
<td>
<asp:PlaceHolder ID="PlaceHolder2" runat="server"></asp:PlaceHolder>
</td>
</tr>
</table>server side: page_load
For i As Integer = 1 To 3
Dim dLabel As New Label
Dim dText As New TextBox
dLabel.ID = "lblid" & i.ToString()
dLabel.Text = "label" & i.ToString()
dLabel.Width = 10dText.ID = "txtid" & i.ToString() dText.Text = "text" & i.ToString() dText.Width = 10 PlaceHolder1.Controls.Add(dLabel) PlaceHolder2.Controls.Add(dText)
Next
RESULT: label1 label2 label3 text1 text2 text3 I WANT THE RESULT LIKE THIS: label1 text1 label2 text2 label3 text3
C# コードMicrosoft End User 2000-2008 「「「「「「「「「「「「「「「「「「「「「「「「「「「「 The best things in life are free 」」」」」」」」」」」」」」」」」」」」」」」」」」」」
To get the desired results you don't need to use a table. In fact, modern web design doesn't use table layouts. You could use a Repeater control and bind to it. The markup for the repeater could be constructed to format the lines and items in whatever configuration you would like. There is no need to use PlaceHolders.
I know the language. I've read a book. - _Madmatt