Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Place holder

Status
Not open for further replies.

fmt

Programmer
Aug 5, 2005
53
US
Hello,
I have place holder in my form in a table row. I am adding dynamic controls as a table inside the palace holder. The controls add fine, but theres empty space before table.The place holder shows a big space and then table with controls. Any idea why this is happening?
Thanks
 
Thanks...Here is code

ASP.NET

<TABLE>
<TR>
<TD align=center>
<asp:placeHolder id="phControl" runat="server"></asp:placeHolder></TD>
</TR>
<TR>
<TD>
<asp:Button id="btnPrint" tabIndex="8" runat="server" Text="Print"></asp:Button></TD>
</TR>
</TABLE>

C#
PLACE HOLDER:pH CONTROL

phControl.Controls.Add(new LiteralControl("<table border=1>"));
while (DeviceReader.Read())
{
string ctype = (string)DeviceReader["ControlType"];
if (ctype=="Label")

{
Label lblLabel= new Label();
lblLabel.Text=DeviceReader["LabelText"].ToString();;
lblLabel.Font.Bold=true;
lblLabel.Font.Name="Arial";
lblLabel.Font.Size=System.Web.UI.WebControls.FontUnit.XSmall;
lblLabel.ForeColor=System.Drawing.Color.DarkBlue;

phControl.Controls.Add(new LiteralControl("<tr>"));
phControl.Controls.Add(new LiteralControl("<td class='label'>"));
phControl.Controls.Add(lblLabel);
phControl.Controls.Add(new LiteralControl("</td>"));
}

 
Try butting the placeholder right up against the <TD> tag.
<TD align=center><asp:placeHolder id="phControl" runat="server"></asp:placeHolder>

Also I noticed it looks like you need a closing </tr> and a closing </table> tag.

phControl.Controls.Add(new LiteralControl("<td class='label'>"));
phControl.Controls.Add(lblLabel);
phControl.Controls.Add(new LiteralControl("</td>"));

//Here is what is missing
LiteralControl("</tr>"));
LiteralControl("</table>"));

 
Rather than using tables to position your page layout, try using CSS instead.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Thanks RTomes for your time. I will try that.
Thanks ca8msm for your suggestion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top